public void Install(RunningDeployment deployment)
        {
            if (!predicate(deployment))
            {
                return;
            }

            foreach (var target in fileTargets(deployment))
            {
                var matchingFiles = MatchingFiles(deployment, target);

                if (!matchingFiles.Any())
                {
                    if (deployment.Variables.GetFlag(SpecialVariables.Package.EnableNoMatchWarning, true))
                    {
                        Log.WarnFormat("No files were found that match the substitution target pattern '{0}'", target);
                    }

                    continue;
                }

                foreach (var file in matchingFiles)
                {
                    substituter.PerformSubstitution(file, deployment.Variables);
                }
            }
        }
Exemple #2
0
        public void Install(RunningDeployment deployment)
        {
            if (!deployment.Variables.GetFlag(SpecialVariables.Package.SubstituteInFilesEnabled))
            {
                return;
            }

            foreach (var target in deployment.Variables.GetPaths(SpecialVariables.Package.SubstituteInFilesTargets))
            {
                var matchingFiles = fileSystem.EnumerateFiles(deployment.CurrentDirectory, target)
                                    .Select(Path.GetFullPath).ToList();

                if (!matchingFiles.Any())
                {
                    Log.WarnFormat("No files were found that match the substitution target pattern '{0}'", target);
                    continue;
                }

                foreach (var file in matchingFiles)
                {
                    Log.Info("Performing variable substitution on '{0}'", file);
                    substituter.PerformSubstitution(file, deployment.Variables);
                }
            }
        }
Exemple #3
0
        public void Install(RunningDeployment deployment)
        {
            var configurationFiles = fileSystem.EnumerateFilesRecursively(deployment.CurrentDirectory, "*.config", "*.xml");

            foreach (var configurationFile in configurationFiles)
            {
                substituter.PerformSubstitution(configurationFile, deployment.Variables);
            }
        }
Exemple #4
0
        public void Substitute(RunningDeployment deployment, IList <string> filesToTarget)
        {
            foreach (var target in filesToTarget)
            {
                var matchingFiles = MatchingFiles(deployment, target);

                if (!matchingFiles.Any())
                {
                    if (deployment.Variables.GetFlag(PackageVariables.EnableNoMatchWarning, true))
                    {
                        log.WarnFormat("No files were found that match the substitution target pattern '{0}'", target);
                    }

                    continue;
                }

                foreach (var file in matchingFiles)
                {
                    substituter.PerformSubstitution(file, deployment.Variables);
                }
            }
        }
Exemple #5
0
        public void Substitute(string currentDirectory, IList <string> filesToTarget, bool warnIfFileNotFound = true)
        {
            foreach (var target in filesToTarget)
            {
                var matchingFiles = MatchingFiles(currentDirectory, target);

                if (!matchingFiles.Any())
                {
                    if (warnIfFileNotFound && variables.GetFlag(PackageVariables.EnableNoMatchWarning, true))
                    {
                        log.WarnFormat("No files were found in {0} that match the substitution target pattern '{1}'", currentDirectory, target);
                    }

                    continue;
                }

                foreach (var file in matchingFiles)
                {
                    substituter.PerformSubstitution(file, variables);
                }
            }
        }