Save() public method

public Save ( ) : void
return void
Exemplo n.º 1
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);
        }
Exemplo n.º 2
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;
        }