Example #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;
        }
        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);
        }
        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);
        }
 public void Before_Each_Test_Is_Run()
 {
     cataloger = new RecipeCataloger(Environment.CurrentDirectory + "..\\..\\..\\..\\");
     found = cataloger.CatalogueRecipes();
 }
Example #5
0
 public TaskRunner(RecipeCataloger aCataloger)
 {
     cataloger = aCataloger;
 }
 public void Finder_Caches_Assemblies_Containing_Recipes()
 {
     var cataloger = new RecipeCataloger(Environment.CurrentDirectory);
     cataloger.CatalogueRecipes();
     Assert.AreEqual(1, cataloger.LoadedAssembliesContainingRecipes.Count);
 }