public static bool IsFeatureEnabled(this IVariables variables, string featureName) { var features = variables.GetStrings(KnownVariables.Package.EnabledFeatures) .Where(s => !string.IsNullOrWhiteSpace(s)).ToList(); return(features.Contains(featureName)); }
List <string> MatchingFiles(string currentDirectory, string target) { var files = fileSystem.EnumerateFilesWithGlob(currentDirectory, target).Select(Path.GetFullPath).ToList(); foreach (var path in variables.GetStrings(ActionVariables.AdditionalPaths).Where(s => !string.IsNullOrWhiteSpace(s))) { var pathFiles = fileSystem.EnumerateFilesWithGlob(path, target).Select(Path.GetFullPath); files.AddRange(pathFiles); } return(files); }
List <string> MatchingFiles(string currentDirectory, string[] sourceExtensions) { var files = fileSystem.EnumerateFilesRecursively(currentDirectory, sourceExtensions).ToList(); foreach (var path in variables.GetStrings(ActionVariables.AdditionalPaths).Where(s => !string.IsNullOrWhiteSpace(s))) { var pathFiles = fileSystem.EnumerateFilesRecursively(path, sourceExtensions); files.AddRange(pathFiles); } return(files); }
public void DoTransforms(string currentDirectory) { var appliedAsTransforms = variables.GetStrings(KnownVariables.AppliedXmlConfigTransforms, '|'); log.Verbose("Looking for appSettings, applicationSettings, and connectionStrings in any .config files"); if (variables.GetFlag(KnownVariables.Package.IgnoreVariableReplacementErrors)) { log.Info("Variable replacement errors are suppressed because the variable Octopus.Action.Package.IgnoreVariableReplacementErrors has been set."); } foreach (var configurationFile in MatchingFiles(currentDirectory)) { if (appliedAsTransforms.Contains(configurationFile)) { log.VerboseFormat("File '{0}' was interpreted as an XML configuration transform; variable substitution won't be attempted.", configurationFile); continue; } replacer.ModifyConfigurationFile(configurationFile, variables); } }
private static void ApplyPreservePathsDeploymentRule(DeploymentSyncOptions syncOptions, IVariables variables) { // If PreservePaths variable set, then create SkipDelete rules for each path regex var preservePaths = variables.GetStrings(SpecialVariables.Action.Azure.PreservePaths, ';'); // ReSharper disable once InvertIf if (preservePaths != null) { for (var i = 0; i < preservePaths.Count; i++) { var path = preservePaths[i]; syncOptions.Rules.Add(new DeploymentSkipRule("SkipDeleteFiles_" + i, "Delete", "filePath", path, null)); syncOptions.Rules.Add(new DeploymentSkipRule("SkipDeleteDir_" + i, "Delete", "dirPath", path, null)); } } }
void ApplyPreservePathsDeploymentRule(DeploymentSyncOptions syncOptions, IVariables variables) { // If PreservePaths variable set, then create SkipDelete rules for each path regex var preservePaths = variables.GetStrings(SpecialVariables.Action.Azure.PreservePaths, ';'); for (var i = 0; i < preservePaths.Count; i++) { var path = preservePaths[i]; syncOptions.Rules.Add(new DeploymentSkipRule($"SkipDeleteFiles_{i}", "Delete", "filePath", path, null)); syncOptions.Rules.Add(new DeploymentSkipRule($"SkipDeleteDir_{i}", "Delete", "dirPath", path, null)); } }