예제 #1
0
        private void readDirectivesFromFile(FileSystem fileSystem)
        {
            Console.WriteLine("Reading directives from " + _file);

            if (!fileSystem.FileExists(_file))
            {
                throw new CommandFailureException("Designated serenity/jasmine file at {0} does not exist".ToFormat(_file));
            }

            fileSystem.ReadTextFile(_file, ReadText);
        }
예제 #2
0
        public void ReadFile()
        {
            Console.WriteLine("Reading directives from " + _file);

            var fileSystem = new FileSystem();
            if (!fileSystem.FileExists(_file))
            {
                throw new CommandFailureException("Designated serenity/jasmine file at {0} does not exist".ToFormat(_file));
            }

            fileSystem.ReadTextFile(_file, ReadText);
        }
예제 #3
0
        public static Recipe ReadFrom(string recipeDirectory)
        {
            var recipeName = Path.GetFileName(recipeDirectory);
            var recipe = new Recipe(recipeName);
            var fileSystem = new FileSystem();

            fileSystem.ReadTextFile(recipeDirectory.AppendPath(Milkman.ProfileFiles.RecipesControlFile), s =>
                {
                    //TODO: Harden this for bad syntax
                    var parts = s.Split(':');
                    recipe.RegisterDependency(parts[1]);
                });

            fileSystem.FindFiles(recipeDirectory, new FileSet(){
                Include = "*.host"
            }).Each(file =>
            {
                var host = HostReader.ReadFrom(file);
                recipe.RegisterHost(host);
            });

            return recipe;
        }