コード例 #1
0
        // TODO -- end to end tests on this monster -- including failure cases
        public void Deploy(DeploymentOptions options)
        {
            // need to log inside of reader
            var plan = BuildPlan(options);

            plan.AssertAllRequiredValuesAreFilled();

            try
            {
                var runners = _factory.BuildRunners(plan);

                int totalCount = runners.Sum(x => x.InitializerCount + x.DeployerCount + x.FinalizerCount);
                StartSteps(totalCount, "Running all directives");

                //LOG: running initializers
                runners.Each(x => x.InitializeDeployment());

                //LOG: running deployers
                runners.Each(x => x.Deploy());

                //LOG: running finalizer
                runners.Each(x => x.FinalizeDeployment());
            }
            finally
            {
                _reporter.WriteReport(options, plan);
                _system.DeleteDirectory(plan.Settings.StagingDirectory);
            }
        }
コード例 #2
0
 // TESTING CTOR ONLY!!!!!!!!
 private DeploymentPlan(DeploymentSettings settings, DeploymentOptions options, IEnumerable<Recipe> recipes, IEnumerable<HostManifest> hosts)
 {
     _recipes = recipes;
     settings.Plan = this;
     _hosts = hosts;
     _options = options;
     _rootData = new SettingsData();
 }
コード例 #3
0
        public DeploymentPlan BuildPlan(DeploymentOptions options)
        {
            var plan = _reader.Read(options);

            plan.WriteToConsole();

            _bottles.AssertAllBottlesExist(plan.BottleNames());
            return plan;
        }
コード例 #4
0
        public void SetUp()
        {
            theInput = new DeployInput()
                       {
                           ProfileFlag = "milkman"
                       };
            theInput.OverrideFlag = "a:1;b:2;c:3";

            theOptions = theInput.CreateDeploymentOptions();
        }
コード例 #5
0
        public void WriteReport(DeploymentOptions options, DeploymentPlan plan)
        {
            var report = new DeploymentReport("Deployment Report");
            report.WriteDeploymentPlan(plan);
            report.WriteLoggingSession(_diagnostics.Session);

            ConsoleWriter.Line();
            ConsoleWriter.PrintHorizontalLine();
            ConsoleWriter.Write("Writing deployment report to " + options.ReportName.ToFullPath());
            report.Document.WriteToFile(options.ReportName);
        }
コード例 #6
0
        public DeploymentGraph Read(DeploymentOptions options)
        {
            _settings.AddImportedFolders(options.ImportedFolders);

            var allRecipes = _settings.Directories.Select(x => x.AppendPath(ProfileFiles.RecipesDirectory)).SelectMany(RecipeReader.ReadRecipes);
            return new DeploymentGraph{
                Environment = EnvironmentSettings.ReadFrom(_settings.EnvironmentFile()),
                Profile = Profile.ReadFrom(_settings, options.ProfileName),
                Recipes = allRecipes,
                Settings = _settings
            };
        }
コード例 #7
0
        public DeploymentGraph Read(DeploymentOptions options)
        {
            _settings.AddImportedFolders(options.ImportedFolders);

            var allRecipes = _settings.AllRecipies();
            var env = EnvironmentSettings.ReadFrom(_settings.EnvironmentFile);
            var profile = Profile.ReadFrom(_settings, options.ProfileName, options.SettingProfileName);

            return new DeploymentGraph {
                Environment = env,
                Profile = profile,
                Recipes = allRecipes,
                Settings = _settings
            };
        }
コード例 #8
0
ファイル: PlanInput.cs プロジェクト: DarthFubuMVC/milkman
        public DeploymentOptions CreateDeploymentOptions()
        {
            var options = new DeploymentOptions(GetProfile()){
                ReportName = ReportFlag
            };
            enhanceDeploymentOptions(options);

            if(RecipeFlag != null)
            {
                options.RecipeNames.Fill(RecipeFlag);
            }

            if (SettingsProfileFlag != null)
            {
                options.SettingProfileName = SettingsProfileFlag;
            }

            return options;
        }
コード例 #9
0
ファイル: PlanInput.cs プロジェクト: rsanders1/bottles
        public DeploymentOptions CreateDeploymentOptions()
        {
            var options = new DeploymentOptions(GetProfile()){
                ReportName = ReportFlag
            };
            enhanceDeploymentOptions(options);

            if(RecipeFlag != null)
            {
                options.RecipeNames.Fill(RecipeFlag);
            }

            if (ImportedFolders != null)
            {
                options.ImportedFolders.AddRange(ImportedFolders);
            }

            return options;
        }
コード例 #10
0
        public void puts_any_overrides_onto_profile()
        {
            var options = new DeploymentOptions();
            options.Overrides["Shared"] = "override-val";
            options.Overrides["Profile1"] = "override-profile1-val";

            var plan = new DeploymentPlan(options, new DeploymentGraph()
            {
                Environment = theEnvironment,
                Profile = theProfile,
                Recipes = theRecipes,
                Settings = new DeploymentSettings() { TargetDirectory = "target" }
            });

            plan.GetSubstitutionDiagnosticReport().Single(x => x.Key == "Shared")
                .Value.ShouldEqual("override-val");

            plan.GetSubstitutionDiagnosticReport().Single(x => x.Key == "Profile1")
                .Value.ShouldEqual("override-profile1-val");
        }
コード例 #11
0
        public DeploymentPlan(DeploymentOptions options, DeploymentGraph graph)
        {
            _options = options;
            _graph = graph;
            _recipes = readRecipes();
            _hosts = collateHosts(_recipes);

            addProfileSettings();
            addEnvironmentSettings();

            readRoot();

            graph.Settings.Plan = this;
            graph.Settings.Environment = _graph.Environment;
            graph.Settings.Profile = _graph.Profile;

            options.Overrides.Each((key, value) =>
            {
                _graph.Profile.Data[key] = value;
            });
        }
コード例 #12
0
        public void WriteReport(DeploymentOptions options, DeploymentPlan plan)
        {
            Console.WriteLine("Environment");
            plan.Settings.Environment.Data.AllKeys.Each(key =>
            {
                var value = plan.Settings.Environment.Data[key];
                //province data?
                //resolve substitutions
                Console.WriteLine("{0}={1}",key, value);
            });

            plan.Hosts.Each(host =>
            {
                host.AllSettingsData().Each(s =>
                {
                    s.AllKeys.Each(key =>
                    {
                        Console.WriteLine("{0}:{1}:{2}:{3}", s.Category, s.Provenance, key, s[key]);
                    });
                });
            });
        }
コード例 #13
0
ファイル: PlanInput.cs プロジェクト: rsanders1/bottles
 protected virtual void enhanceDeploymentOptions(DeploymentOptions options)
 {
 }
コード例 #14
0
ファイル: Bundler.cs プロジェクト: DarthFubuMVC/milkman
 public void CreateBundle(string destination, DeploymentOptions options)
 {
     var plan = _controller.BuildPlan(options);
     CreateBundle(destination, plan);
 }
コード例 #15
0
ファイル: IProfileReader.cs プロジェクト: emiaj/bottles
 public DeploymentPlan Read(DeploymentOptions options)
 {
     var graph = _reader.Read(options);
     return new DeploymentPlan(options, graph);
 }
コード例 #16
0
        public void SetUp()
        {
            var writer = new DeploymentWriter("clonewars");

            var recipeDefinition = writer.RecipeFor("r1");
            var host = recipeDefinition.HostFor("h1");

            host.AddDirective(new SimpleSettings
            {
                One = "one",
                Two = "two"
            });

            host.AddDirective(new OneSettings()
            {
                Name = "Jeremy",
                Age = 37
            });

            host.AddReference(new BottleReference()
            {
                Name = "bottle1"
            });

            host.AddReference(new BottleReference()
            {
                Name = "bottle2"
            });

            recipeDefinition.HostFor("h2").AddProperty<ThreeSettings>(x => x.Direction, "North");
            recipeDefinition.HostFor("h3").AddProperty<TwoSettings>(x => x.City, "Austin");

            writer.RecipeFor("r2").HostFor("h3").AddProperty<SimpleSettings>(x => x.One, "one");
            writer.RecipeFor("r3").HostFor("h3").AddProperty<SimpleSettings>(x => x.Two, "two");
            writer.RecipeFor("r4").HostFor("h4").AddProperty<SimpleSettings>(x => x.Two, "ten");
            writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.Two, "ten");
            writer.RecipeFor("r4").HostFor("h5").AddProperty<SimpleSettings>(x => x.One, "*{dbName}*");

            writer.AddEnvironmentSetting<SimpleSettings>(x => x.Two, "h4", "env-value");
            writer.AddEnvironmentSetting("dbName", "blue");

            writer.ProfileFor("default").AddRecipe("r1");
            writer.ProfileFor("default").AddRecipe("r2");
            writer.ProfileFor("default").AddRecipe("r3");
            writer.ProfileFor("default").AddRecipe("r4");

            writer.Flush(FlushOptions.Wipeout);

            var settings = new DeploymentSettings("clonewars");
            var reader = new DeploymentGraphReader(settings);
            var options = new DeploymentOptions("default");
            var graph = reader.Read(options);
            thePlan = new DeploymentPlan(options, graph);

            theHosts = thePlan.Hosts;
        }
コード例 #17
0
 public override void SetUp(ITestContext context)
 {
     _options = new DeploymentOptions();
     context.Store(_options);
 }
コード例 #18
0
        public override void SetUp(ITestContext context)
        {
            _deploymentSettings = context.Retrieve<DeploymentSettings>();
            _deploymentOptions = context.Retrieve<DeploymentOptions>();

            var reader = new DeploymentGraphReader(_deploymentSettings);
            var graph = reader.Read(_deploymentOptions);
            _plan = new DeploymentPlan(_deploymentOptions, graph);
        }