public void VerifyCanOverride() { IFileSystem fileSystem = new FileSystem(); var root = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory); var settings = new DeploymentSettings(root.AppendPath("dev", "test-profile")); IBottleRepository bottles = new BottleRepository(fileSystem, new ZipFileService(fileSystem), settings); var initializer = new WebAppOfflineInitializer(fileSystem); var deployer = new IisWebsiteCreator(); var directive = new Website(); directive.WebsiteName = "fubu"; directive.WebsitePhysicalPath = root.AppendPath("dev", "test-web"); directive.VDir = "bob"; directive.VDirPhysicalPath = root.AppendPath("dev", "test-app"); directive.AppPool = "fubizzle"; directive.DirectoryBrowsing = Activation.Enable; initializer.Execute(directive, new HostManifest("something"), new PackageLog()); deployer.Create(directive); //override test directive.ForceWebsite = true; directive.VDirPhysicalPath = root.AppendPath("dev", "test-app2"); deployer.Create(directive); }
public void DeployHelloWorld() { IFileSystem fileSystem = new FileSystem(); var settings = new DeploymentSettings(@"C:\dev\test-profile\"); IBottleRepository bottles = new BottleRepository(fileSystem, new PackageExploder(new ZipFileService(fileSystem), new PackageExploderLogger(s=>{ }), fileSystem ), settings); var initializer = new IisFubuInitializer(fileSystem, new DeploymentSettings()); var deployer = new IisFubuDeployer(fileSystem, bottles); var directive = new FubuWebsite(); directive.HostBottle = "test"; directive.WebsiteName = "fubu"; directive.WebsitePhysicalPath = @"C:\dev\test-web"; directive.VDir = "bob"; directive.VDirPhysicalPath = @"C:\dev\test-app"; directive.AppPool = "fubizzle"; directive.DirectoryBrowsing = Activation.Enable; initializer.Execute(directive, new HostManifest("something"), new PackageLog()); var host = new HostManifest("a"); deployer.Execute(directive, host, new PackageLog()); }
public override void SetUp(ITestContext context) { _settings = new DeploymentSettings("storyteller"); context.Store(_settings); _writer = new DeploymentWriter("storyteller"); }
public void find_environment_file_from_included_folders_when_it_is_not_in_the_root() { var settings = new DeploymentSettings("firefly"); writeEnvironmentFileTo("a"); settings.AddImportedFolder("a"); settings.EnvironmentFile().ShouldEqual("a".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName)); }
public void find_the_environment_file_with_no_included_folders() { var settings = new DeploymentSettings("firefly"); var defaultEnvironmentFile = "firefly".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName); system.WriteStringToFile(defaultEnvironmentFile, "something"); settings.Directories.Count().ShouldEqual(1); settings.EnvironmentFile.ShouldEqual("firefly".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName)); }
public void find_environment_file_with_included_folders_should_still_choose_the_main_environment_settings_file() { var settings = new DeploymentSettings("firefly"); var defaultEnvironmentFile = "firefly".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName); system.WriteStringToFile(defaultEnvironmentFile, "something"); writeEnvironmentFileTo("a"); settings.AddImportedFolder("a"); settings.EnvironmentFile.ShouldEqual("firefly".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName)); }
public void build_the_default_ctor() { setupValidDeploymentFolderAt("dir"); //review there is a check inside of here var settings = new DeploymentSettings("dir"); settings.BottlesDirectory.ShouldEqual("dir".AppendPath("bottles")); settings.RecipesDirectory.ShouldEqual("dir".AppendPath("recipes")); settings.EnvironmentFile.ShouldEqual("dir".AppendPath("environment.settings")); settings.TargetDirectory.ShouldEqual("dir".AppendPath("target")); settings.DeploymentDirectory.ShouldEqual("dir"); settings.DeployersDirectory.ShouldEqual("dir".AppendPath("deployers")); settings.ProfilesDirectory.ShouldEqual(FileSystem.Combine("dir", ProfileFiles.ProfilesDirectory)); settings.GetHost("x", "z").ShouldEqual("dir".AppendPath("recipes", "x", "z.host")); settings.GetRecipeDirectory("a").ShouldEqual("dir".AppendPath("recipes","a")); }
public void build_the_default_ctor() { setupValidDeploymentFolderAt("dir"); //review there is a check inside of here var settings = new DeploymentSettings("dir"); settings.BottlesDirectory.ShouldEqual("dir\\bottles"); settings.RecipesDirectory.ShouldEqual("dir\\recipes"); settings.EnvironmentFile.ShouldEqual("dir\\environment.settings"); settings.TargetDirectory.ShouldEqual("dir\\target"); settings.DeploymentDirectory.ShouldEqual("dir"); settings.BottleManifestFile.ShouldEqual("dir\\bottles.manifest"); settings.ProfilesDirectory.ShouldEqual(FileSystem.Combine("dir", ProfileFiles.ProfilesDirectory)); settings.EnvironmentsDirectory.ShouldEqual(FileSystem.Combine("dir", ProfileFiles.EnvironmentsDirectory)); settings.GetHost("x", "z").ShouldEqual("dir\\recipes\\x\\z.host"); settings.GetRecipeDirectory("a").ShouldEqual("dir\\recipes\\a"); }
public static Profile ReadFrom(DeploymentSettings settings, string profileName, string settingsProfileName = null) { var profile = new Profile(profileName); var profileFile = settings.ProfileFileNameFor(profileName); var fileSystem = new FileSystem(); if (!fileSystem.FileExists(profileFile)) { var sb = new StringBuilder(); sb.AppendFormat("Couldn't find the profile '{0}'", profileFile); sb.AppendLine(); sb.AppendLine("Looked in:"); settings.Directories.Each(d => sb.AppendLine(" {0}".ToFormat(d))); throw new Exception(sb.ToString()); } // Settings profile goes first if (settingsProfileName != null) { profile.AddProfileDependency(settingsProfileName); } fileSystem.ReadTextFile(profileFile, profile.ReadText); profile._childProfileNames.Each(childName => { var childProfile = ReadFrom(settings, childName); profile._childProfiles.Add(childProfile); childProfile.Data.AllKeys.Each(childKey => { // do not override main profile settings from dependencies. // NOTE: Has(childKey) doesn't work here because SettingsData has a weird inner dictionary with a special key structure if (profile.Data.AllKeys.Any(k => k == childKey)) return; profile.Data[childKey] = childProfile.Data[childKey]; }); }); return profile; }
public static Profile ReadFrom(DeploymentSettings settings, string profileName) { var profile = new Profile(profileName); var profileFile = settings.ProfileFileNameFor(profileName); var fileSystem = new FileSystem(); if (!fileSystem.FileExists(profileFile)) { var sb = new StringBuilder(); sb.AppendFormat("Couldn't find the profile '{0}'", profileFile); sb.AppendLine(); sb.AppendLine("Looked in:"); settings.Directories.Each(d => sb.AppendLine(" {0}".ToFormat(d))); throw new Exception(sb.ToString()); } fileSystem.ReadTextFile(profileFile, profile.ReadText); return profile; }
public void SetUp() { var fileSystem = new FileSystem(); fileSystem.DeleteDirectory("hoth"); fileSystem.CreateDirectory("hoth"); new InitializeCommand().Execute(new InitializeInput() { DeploymentFlag = "hoth".AppendPath("deployment"), ForceFlag = true }); fileSystem.DeleteDirectory("tatooine"); fileSystem.CreateDirectory("tatooine"); new InitializeCommand().Execute(new InitializeInput() { DeploymentFlag = "tatooine".AppendPath("deployment"), ForceFlag = true }); theSettings = new DeploymentSettings("hoth".AppendPath("deployment")); theSettings.AddImportedFolder("tatooine".AppendPath("deployment")); }
public void staging_directory() { setupValidDeploymentFolderAt("dir"); //review there is a check inside of here var settings = new DeploymentSettings("dir"); settings.StagingDirectory.ShouldEqual(Path.GetTempPath().AppendPath("bottles").AppendPath("staging")); }
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"); }
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; }
private void readDotProfileFile() { var settings = new DeploymentSettings(_deploymentFolderPath); _theProfile = Profile.ReadFrom(settings, "main", "mainsettings"); }
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"); }
public void find_the_environment_file_defaults_to_the_main_directory_if_it_cannot_be_found() { var settings = new DeploymentSettings("firefly"); var defaultEnvironmentFile = "firefly".AppendPath(EnvironmentSettings.EnvironmentSettingsFileName); settings.EnvironmentFile.ShouldEqual(defaultEnvironmentFile); }
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); }
public BottleRepository(IFileSystem fileSystem, IPackageExploder exploder, DeploymentSettings settings) { _fileSystem = fileSystem; _settings = settings; _exploder = exploder; }