コード例 #1
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);
        }
コード例 #2
0
        public IEnumerable<IDirectiveRunner> BuildRunnersFor(DeploymentPlan plan, HostManifest host)
        {
            BuildDirectives(plan, host, _types);
            foreach (var directive in host.Directives)
            {
                var runner = Build(directive);
                runner.Attach(host, directive);

                yield return runner;
            }
        }
コード例 #3
0
ファイル: Bundler.cs プロジェクト: DarthFubuMVC/milkman
        // TODO -- want an end to end test on this mess
        public virtual void CreateBundle(string destination, DeploymentPlan plan)
        {
            var destinationSettings = createDestination(destination);

            var copier = new DeploymentFileCopier(_system, _settings, destinationSettings);
            copyFiles(copier, plan);

            // Need to explode the bottles zip too
            ExplodeDeployerBottles(destination);

            _system.DeleteDirectory(_settings.StagingDirectory);
        }
コード例 #4
0
        public void sets_environment_and_profile_on_deployment_settings()
        {
            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph()
            {
                Environment = theEnvironment,
                Profile = theProfile,
                Recipes = theRecipes,
                Settings = new DeploymentSettings() { TargetDirectory = "target" }
            });

            plan.Settings.Environment.ShouldBeTheSameAs(theEnvironment);
            plan.Settings.Profile.ShouldBeTheSameAs(theProfile);
        }
コード例 #5
0
ファイル: Bundler.cs プロジェクト: DarthFubuMVC/milkman
        private static void copyFiles(DeploymentFileCopier copier, DeploymentPlan plan)
        {
            LogWriter.Current.Indent(() =>
            {
                copier.CopyFile(x => x.EnvironmentFile);
                copier.CopyFile(x => x.ProfileFileNameFor(plan.ProfileName));

                plan.Settings.Profile.ProfileDependencyNames.Each(dep => copier.CopyFile(x=> x.ProfileFileNameFor(dep)));

                plan.BottleNames().Each(name => copier.CopyFile(x => x.BottleFileFor(name)));

                plan.Recipes.Each(r => copier.CopyFile(x => x.GetRecipeDirectory(r.Name)));
            });
        }
コード例 #6
0
        public void combine_overrides_and_provenance()
        {
            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph(){
                Environment = theEnvironment,
                Profile = theProfile,
                Recipes = theRecipes,
                Settings = new DeploymentSettings(){TargetDirectory = "target"}
            });

            plan.GetSubstitutionDiagnosticReport().ShouldHaveTheSameElementsAs(
                new SettingDataSource(){Key = "Env1", Provenance = "Environment settings", Value = "Env1-Val"},
                new SettingDataSource() { Key = "Profile1", Provenance = "Profile:  profile1", Value = "Profile1-Val" },
                new SettingDataSource() { Key = EnvironmentSettings.ROOT, Provenance = "DeploymentSettings", Value = "target" },
                new SettingDataSource() { Key = "Shared", Provenance = "Profile:  profile1", Value = "Shared-Profile-Val" }

                );
        }
コード例 #7
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");
        }
コード例 #8
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]);
                    });
                });
            });
        }
コード例 #9
0
        public void HostManifest_can_create_all_directives_for_itself()
        {
            var host = new HostManifest("h1");
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Age, 11);
            host.RegisterValue<BottleDeployers1.OneDirective>(x => x.Name, "Robert");

            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Direction, "North");
            host.RegisterValue<BottleDeployers2.SixDirective>(x => x.Threshold, 5);

            var registry = theContainer.GetInstance<DirectiveTypeRegistry>();

            var factory = theContainer.GetInstance<DirectiveRunnerFactory>();

            var profile = new Profile("profile1");
            profile.AddRecipe("something");

            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph(){
                Environment = new EnvironmentSettings(),
                Profile = profile,
                Recipes = new Recipe[]{new Recipe("something"), },
                Settings = new DeploymentSettings()

            });

            factory.BuildDirectives(plan, host, registry);
            var directives = host.Directives;

            directives.Count().ShouldEqual(2);
            var directiveOne = directives.OfType<BottleDeployers1.OneDirective>().Single();
            directiveOne.Age.ShouldEqual(11);
            directiveOne.Name.ShouldEqual("Robert");

            var directiveSix = directives.OfType<SixDirective>().Single();
            directiveSix.Direction.ShouldEqual("North");
            directiveSix.Threshold.ShouldEqual(5);
        }
コード例 #10
0
ファイル: DeploymentReport.cs プロジェクト: rsanders1/bottles
        private void writeOptions(DeploymentPlan plan)
        {
            wrapInSection("Options","Options used at runtime", div =>
            {

                var table = new TableTag();
                table.AddClass("table");
                table.AddProperty("Written at", DateTime.Now.ToLongTimeString());
                table.AddProperty("Profile", plan.Options.ProfileName);

                table.AddBodyRow(tr =>
                {
                    tr.Add("th", th =>
                    {
                        th.Text("Recipes").Append(new HtmlTag("small").Text(" (in order)"));
                    });
                    tr.Add("td", td =>
                    {
                        td.Text(plan.Recipes.Select(x => x.Name).Join(" > "));
                    });
                });

                table.AddProperty("Hosts", plan.Hosts.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Bottles",
                                  plan.Hosts.SelectMany(host => host.BottleReferences).Select(bottle => bottle.Name).
                                      Distinct().OrderBy(x => x).Join(", "));
                div.Append(table);
            });
        }
コード例 #11
0
ファイル: DeploymentReport.cs プロジェクト: rsanders1/bottles
 public void WriteDeploymentPlan(DeploymentPlan plan)
 {
     writeOptions(plan);
     writeEnvironmentSettings(plan);
     writeHostSettings(plan);
 }
コード例 #12
0
ファイル: DeploymentReport.cs プロジェクト: rsanders1/bottles
        private void writeEnvironmentSettings(DeploymentPlan plan)
        {
            wrapInSection("Settings", "Profile / Environment Substitutions", div =>
            {
                var report = plan.GetSubstitutionDiagnosticReport();

                div.Append(writeSettings(findProvenanceRoot(), report));
            });
        }
コード例 #13
0
ファイル: DeploymentReport.cs プロジェクト: rsanders1/bottles
 private void writeHostSettings(DeploymentPlan plan)
 {
     var provRoot = findProvenanceRoot();
     wrapInSection("Directive Values","by host", div =>
     {
         plan.Hosts.Each(h =>
         {
             div.Append(writeHostSettings(provRoot, h));
         });
     });
 }
コード例 #14
0
 private void writeHostSettings(DeploymentPlan plan)
 {
     var provRoot = findProvenanceRoot(plan);
     wrapInCollapsable("Directive Values by Host", div =>
     {
         plan.Hosts.Each(h =>
         {
             div.Append(writeHostSettings(provRoot, h));
         });
     });
 }
コード例 #15
0
        private void writeOptions(DeploymentPlan plan)
        {
            wrapInCollapsable("Options", div =>
            {

                var table = new TableTag();
                table.Id("properties");
                table.AddProperty("Written at", DateTime.Now.ToLongTimeString());
                table.AddProperty("Profile", plan.Options.ProfileName + " at " + plan.Options.ProfileFileName); // TODO -- add file name
                table.AddProperty("Recipes", plan.Recipes.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Hosts", plan.Hosts.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Bottles",
                                  plan.Hosts.SelectMany(host => host.BottleReferences).Select(bottle => bottle.Name).
                                      Distinct().OrderBy(x => x).Join(", "));
                div.Append(table);
            });
        }
コード例 #16
0
 private string findProvenanceRoot(DeploymentPlan plan)
 {
     return System.Environment.CurrentDirectory;
 }
コード例 #17
0
        public void set_the_target_directory_if_root_exists_in_environment_and_profile_THE_PROFILE_SHOULD_WIN()
        {
            theEnvironment.Data[EnvironmentSettings.ROOT] = "env-root";
            theProfile.Data[EnvironmentSettings.ROOT] = "profile-root";

            var deploymentSettings = new DeploymentSettings();
            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph()
            {
                Environment = theEnvironment,
                Profile = theProfile,
                Recipes = theRecipes,
                Settings = deploymentSettings
            });

            deploymentSettings.TargetDirectory.ShouldEqual("profile-root");
        }
コード例 #18
0
        // overridden in testing classes
        public virtual void BuildDirectives(DeploymentPlan plan, HostManifest host, IDirectiveTypeRegistry typeRegistry)
        {
            var provider = SettingsProvider.For(host.AllSettingsData().Union(plan.Substitutions()).ToArray());

            host.BuildDirectives(provider, typeRegistry);
        }
コード例 #19
0
 public void LogDeployment(DeploymentPlan plan)
 {
 }
コード例 #20
0
 // Pass in DeploymentPlan instead
 public IEnumerable<IDirectiveRunner> BuildRunners(DeploymentPlan plan)
 {
     return plan.Hosts.SelectMany(x => BuildRunnersFor(plan, x));
 }
コード例 #21
0
 public void LogHost(DeploymentPlan plan, HostManifest hostManifest)
 {
 }
コード例 #22
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;
        }
コード例 #23
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);
        }
コード例 #24
0
        public void set_the_root_from_deployment_settings_if_root_is_in_neither_environment_or_profile()
        {
            var deploymentSettings = new DeploymentSettings(){
                TargetDirectory = "settings-target"
            };

            var plan = new DeploymentPlan(new DeploymentOptions(), new DeploymentGraph()
            {
                Environment = theEnvironment,
                Profile = theProfile,
                Recipes = theRecipes,
                Settings = deploymentSettings
            });

            var sourcing = plan.GetSubstitutionDiagnosticReport().Single(x => x.Key == EnvironmentSettings.ROOT);
            sourcing.Value.ShouldEqual("settings-target");
            sourcing.Provenance.ShouldEqual("DeploymentSettings");
        }