Creates the files for a new blank book from a template book
Exemplo n.º 1
0
		public void Setup()
		{
			var library = new Moq.Mock<CollectionSettings>();
			library.SetupGet(x => x.IsSourceCollection).Returns(false);
			library.SetupGet(x => x.Language2Iso639Code).Returns("en");
			library.SetupGet(x => x.Language1Iso639Code).Returns("xyz");
			library.SetupGet(x => x.XMatterPackName).Returns("Factory");

			ErrorReport.IsOkToInteractWithUser = false;
			_fileLocator = new FileLocator(new string[]
											{
												//FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"),
												BloomFileLocator.GetFactoryBookTemplateDirectory("Basic Book"),
												BloomFileLocator.GetFactoryBookTemplateDirectory("Wall Calendar"),
												FileLocator.GetDirectoryDistributedWithApplication( BloomFileLocator.BrowserRoot),
												BloomFileLocator.GetBrowserDirectory("bookLayout"),
												BloomFileLocator.GetBrowserDirectory("bookEdit","css"),
												BloomFileLocator.GetInstalledXMatterDirectory()
											});

			var projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection");
			var collectionSettings = new CollectionSettings(Path.Combine(projectFolder.Path, "test.bloomCollection"));

			_starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), library.Object);
			_shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection");
			_libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection");
		}
Exemplo n.º 2
0
        public BookServer(Book.Factory bookFactory, BookStorage.Factory storageFactory,
						  BookStarter.Factory bookStarterFactory)
        {
            _bookFactory = bookFactory;
            _storageFactory = storageFactory;
            _bookStarterFactory = bookStarterFactory;
        }
Exemplo n.º 3
0
        public BookServer(Book.Factory bookFactory, BookStorage.Factory storageFactory,
						  BookStarter.Factory bookStarterFactory, Configurator.Factory configuratorFactory)
        {
            _bookFactory = bookFactory;
            _storageFactory = storageFactory;
            _bookStarterFactory = bookStarterFactory;
            _configuratorFactory = configuratorFactory;
        }
Exemplo n.º 4
0
        private static Book MakeBook(CollectionSettings collectionSettings, string sourceBookFolderPath)
        {
            var xmatterLocations = new List<string>();
            xmatterLocations.Add(ProjectContext.XMatterAppDataFolder);
            xmatterLocations.Add(FileLocator.GetDirectoryDistributedWithApplication( kpathToSHRPTemplates));
            xmatterLocations.Add(FileLocator.GetDirectoryDistributedWithApplication("xMatter"));
            var locator = new BloomFileLocator(collectionSettings, new XMatterPackFinder(xmatterLocations), new string[] {});

            var starter = new BookStarter(locator,
                                          path =>
                                          new BookStorage(path, locator, new BookRenamedEvent(),
                                                          collectionSettings),
                                          collectionSettings);
            var pathToFolderOfNewBook = starter.CreateBookOnDiskFromTemplate(sourceBookFolderPath, collectionSettings.FolderPath);

            var newBookInfo = new BookInfo(pathToFolderOfNewBook, false /*saying not editable works us around a langdisplay issue*/);

            BookStorage bookStorage = new BookStorage(pathToFolderOfNewBook, locator, new BookRenamedEvent(), collectionSettings);
            var book = new Book(newBookInfo, bookStorage, null,
                            collectionSettings, null, null, null, null);

            return book;
        }
Exemplo n.º 5
0
        public void Setup()
        {
            var library = new Moq.Mock<CollectionSettings>();
            library.SetupGet(x => x.IsSourceCollection).Returns(false);
            library.SetupGet(x => x.Language2Iso639Code).Returns("en");
            library.SetupGet(x => x.Language1Iso639Code).Returns("xyz");
            library.SetupGet(x => x.XMatterPackName).Returns("Factory");

            ErrorReport.IsOkToInteractWithUser = false;
            _fileLocator = new FileLocator(new string[]
                                            {
                                                FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"),
                                                FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates"),
                                                FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates", "Basic Book"),
                                                FileLocator.GetDirectoryDistributedWithApplication( "BloomBrowserUI"),
                                                FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserui/bookLayout"),
                                                FileLocator.GetDirectoryDistributedWithApplication( "xMatter")
                                            });
            _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), new CollectionSettings()), library.Object);
            _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection");
            _libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection");

            Browser.SetUpXulRunner();
        }
Exemplo n.º 6
0
        public void Setup()
        {
            _librarySettings = new Moq.Mock<CollectionSettings>();
            _librarySettings.SetupGet(x => x.IsSourceCollection).Returns(false);
            _librarySettings.SetupGet(x => x.Language1Iso639Code).Returns("xyz");
            _librarySettings.SetupGet(x => x.Language2Iso639Code).Returns("fr");
            _librarySettings.SetupGet(x => x.Language3Iso639Code).Returns("es");
            _librarySettings.SetupGet(x => x.XMatterPackName).Returns("Factory");
            ErrorReport.IsOkToInteractWithUser = false;
            _fileLocator = new FileLocator(new string[]{});
            foreach (var location in ProjectContext.GetFileLocations())
            {
                _fileLocator.AddPath(location);
            }

            //			new FileLocator(new string[]
            //			                               	{
            //			                               		FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI"),
            //												FileLocator.GetDirectoryDistributedWithApplication("browserui/bookCSS"),
            //												FileLocator.GetDirectoryDistributedWithApplication("xMatter"),
            //												FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"),
            //												FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates"),
            //			                               		FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates", "Basic Book"),
            //												FileLocator.GetDirectoryDistributedWithApplication( "xMatter", "Factory-XMatter")
            //			                               	});

            _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), new CollectionSettings()), _librarySettings.Object);
            _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection");
            _projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection");
        }
Exemplo n.º 7
0
        public void Setup()
        {
            _librarySettings = new Moq.Mock<CollectionSettings>();
            _librarySettings.SetupGet(x => x.IsSourceCollection).Returns(false);
            _librarySettings.SetupGet(x => x.Language1Iso639Code).Returns("xyz");
            _librarySettings.SetupGet(x => x.Language2Iso639Code).Returns("fr");
            _librarySettings.SetupGet(x => x.Language3Iso639Code).Returns("es");
            _librarySettings.SetupGet(x => x.XMatterPackName).Returns("Factory");
            ErrorReport.IsOkToInteractWithUser = false;
            _projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection");
            var collectionSettings = new CollectionSettings(Path.Combine(_projectFolder.Path, "test.bloomCollection"));

            var xmatterFinder = new XMatterPackFinder(new []{ BloomFileLocator.GetInstalledXMatterDirectory()});

            _fileLocator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), ProjectContext.GetFoundFileLocations(), ProjectContext.GetAfterXMatterFileLocations());

            _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), _librarySettings.Object);
            _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection");
        }