Ejemplo n.º 1
0
        private static RecipeCataloger CreateCataloger(out IList<Recipe> found)
        {
            RecipeCataloger finder;

            var config = new Configuration();

            //TODO: Remove false when ready. Caching location of recipes isn't going to be useful until we can dynamically load dependant assemblies on the fly
            if (false && config.SearchPaths.Count > 0)
                finder = new RecipeCataloger(config.SearchPaths.ToArray());
            else
            {
                Console.WriteLine("Scanning directories for Build Recipes...");

                var searchPaths = GetSearchPaths();

                finder = new RecipeCataloger(searchPaths.ToArray());
            }

            found = finder.CatalogueRecipes();

            if(config.SearchPaths.Count == 0)
            {
                config.SearchPaths.AddRange(finder.LoadedAssemblies.Select(s=>s.File.FullName));
                config.Save();
            }
            return finder;
        }
Ejemplo n.º 2
0
        public void Cataloger_Uses_Search_Locations()
        {
            var config = new Configuration();
            var cataloger = new RecipeCataloger(Environment.CurrentDirectory);
            cataloger.CatalogueRecipes();
            config.SearchPaths.AddRange(cataloger.LoadedAssembliesContainingRecipes.Select(la => la.File.FullName));
            Assert.Greater(cataloger.AssembliesExamined.Count, 1);

            var cataloger2 = new RecipeCataloger(config.SearchPaths.ToArray());
            cataloger2.CatalogueRecipes();
            Assert.AreEqual(1, cataloger2.AssembliesExamined.Count);
        }
Ejemplo n.º 3
0
        public void Can_Automatically_Generate_First_Config_File()
        {
            Assert.IsFalse(Configuration.ConfigFileExists);

            var config = new Configuration();

            Assert.IsTrue(config.IsNew);
            Assert.IsTrue(Configuration.ConfigFileExists);

            var cataloger = new RecipeCataloger(Environment.CurrentDirectory);
            cataloger.CatalogueRecipes();

            if(config.IsNew)
                config.SearchPaths.AddRange(
                    cataloger.LoadedAssembliesContainingRecipes.Select(la=>la.Assembly.FullName)
                    );

            config.Save();

            var config2 = new Configuration();
            Assert.IsFalse(config2.IsNew);
            Assert.AreEqual(1, config2.SearchPaths.Count);
        }
Ejemplo n.º 4
0
 public void Before_Each_Test_Is_Run()
 {
     cataloger = new RecipeCataloger(Environment.CurrentDirectory + "..\\..\\..\\..\\");
     found = cataloger.CatalogueRecipes();
 }
Ejemplo n.º 5
0
 public TaskRunner(RecipeCataloger aCataloger)
 {
     cataloger = aCataloger;
 }
Ejemplo n.º 6
0
 public void Finder_Caches_Assemblies_Containing_Recipes()
 {
     var cataloger = new RecipeCataloger(Environment.CurrentDirectory);
     cataloger.CatalogueRecipes();
     Assert.AreEqual(1, cataloger.LoadedAssembliesContainingRecipes.Count);
 }