Exemplo n.º 1
0
 public SubstituteInFiles(ILog log, ICalamariFileSystem fileSystem, IFileSubstituter substituter, IVariables variables)
 {
     this.log         = log;
     this.fileSystem  = fileSystem;
     this.substituter = substituter;
     this.variables   = variables;
 }
 public SubstituteInFilesConvention(ICalamariFileSystem fileSystem, IFileSubstituter substituter)
 {
     this.fileSystem  = fileSystem;
     this.substituter = substituter;
     predicate        = (deployment) => deployment.Variables.GetFlag(SpecialVariables.Package.SubstituteInFilesEnabled);
     fileTargets      = (deployment) => deployment.Variables.GetPaths(SpecialVariables.Package.SubstituteInFilesTargets);
 }
 public SubstituteInFilesConvention(ICalamariFileSystem fileSystem, IFileSubstituter substituter,
                                    Func <RunningDeployment, bool> predicate,
                                    Func <RunningDeployment, IEnumerable <string> > fileTargetFactory) : this(fileSystem, substituter)
 {
     this.predicate   = predicate;
     this.fileTargets = fileTargetFactory;
 }
        public void SetUp()
        {
            fileSystem = Substitute.For<ICalamariFileSystem>();
            substituter = Substitute.For<IFileSubstituter>();
            variables = new VariableDictionary();

            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("packages"), variables)
            {
                StagingDirectory = StagingDirectory
            };
        }
Exemplo n.º 5
0
        public void SetUp()
        {
            fileSystem  = Substitute.For <ICalamariFileSystem>();
            substituter = Substitute.For <IFileSubstituter>();
            variables   = new CalamariVariableDictionary();

            deployment = new RunningDeployment(TestEnvironment.ConstructRootedPath("packages"), variables)
            {
                StagingDirectory = StagingDirectory
            };
        }
Exemplo n.º 6
0
        public void SetUp()
        {
            fileSystem  = Substitute.For <ICalamariFileSystem>();
            substituter = Substitute.For <IFileSubstituter>();
            variables   = new VariableDictionary();

            deployment = new RunningDeployment("C:\\packages", variables)
            {
                StagingDirectory = stagingDirectory
            };
        }
Exemplo n.º 7
0
 public UploadAwsS3Convention(ICalamariFileSystem fileSystem,
                              IAwsEnvironmentGeneration awsEnvironmentGeneration,
                              string bucket,
                              S3TargetMode targetMode,
                              IProvideS3TargetOptions optionsProvider,
                              IFileSubstituter fileSubstituter
                              )
 {
     this.fileSystem = fileSystem;
     this.awsEnvironmentGeneration = awsEnvironmentGeneration;
     this.bucket           = bucket;
     this.targetMode       = targetMode;
     this.optionsProvider  = optionsProvider;
     this.fileSubstituter  = fileSubstituter;
     this.md5HashSupported = HashCalculator.IsAvailableHashingAlgorithm(MD5.Create);
 }
Exemplo n.º 8
0
        public override int Execute(string[] commandLineArguments)
        {
            Options.Parse(commandLineArguments);

            var fileSystem        = CalamariPhysicalFileSystem.GetPhysicalFileSystem();
            var commandLineRunner = new CommandLineRunner(new SplitCommandOutput(new ConsoleCommandOutput(),
                                                                                 new ServiceMessageCommandOutput(variables)));

            fileSubstituter = new FileSubstituter(fileSystem);
            var configurationTransformer = ConfigurationTransformer.FromVariables(variables);
            var transformFileLocator     = new TransformFileLocator(fileSystem);
            var replacer             = new ConfigurationVariablesReplacer(variables.GetFlag(SpecialVariables.Package.IgnoreVariableReplacementErrors));
            var jsonVariableReplacer = new JsonConfigurationVariableReplacer();
            var extractor            = new GenericPackageExtractorFactory().createStandardGenericPackageExtractor();

            ValidateArguments();
            WriteVariableScriptToFile();

            var conventions = new List <IConvention>
            {
                new ContributeEnvironmentVariablesConvention(),
                new ContributeVariablesFromJsonFileConvention(),
                new LogVariablesConvention(),
                new StageScriptPackagesConvention(packageFile, fileSystem, extractor),
                // Substitute the script source file
                new SubstituteInFilesConvention(fileSystem, fileSubstituter, _ => true, ScriptFileTargetFactory),
                // Substitute any user-specified files
                new SubstituteInFilesConvention(fileSystem, fileSubstituter),
                new ConfigurationTransformsConvention(fileSystem, configurationTransformer, transformFileLocator),
                new ConfigurationVariablesConvention(fileSystem, replacer),
                new JsonConfigurationVariablesConvention(jsonVariableReplacer, fileSystem),
                new ExecuteScriptConvention(scriptEngine, commandLineRunner)
            };

            var deployment       = new RunningDeployment(packageFile, variables);
            var conventionRunner = new ConventionProcessor(deployment, conventions);

            conventionRunner.RunConventions();
            var exitCode = variables.GetInt32(SpecialVariables.Action.Script.ExitCode);

            deploymentJournalWriter.AddJournalEntry(deployment, exitCode == 0, packageFile);
            return(exitCode.Value);
        }
Exemplo n.º 9
0
        public DeployAzureServiceFabricAppCommand(
            ILog log,
            IScriptEngine scriptEngine,
            ICertificateStore certificateStore,
            IVariables variables,
            ICommandLineRunner commandLineRunner,
            ISubstituteInFiles substituteInFiles,
            IFileSubstituter fileSubstituter,
            IExtractPackage extractPackage
            )
        {
            Options.Add("package=", "Path to the NuGet package to install.", v => pathToPackage = new PathToPackage(Path.GetFullPath(v)));

            this.log               = log;
            this.scriptEngine      = scriptEngine;
            this.certificateStore  = certificateStore;
            this.variables         = variables;
            this.commandLineRunner = commandLineRunner;
            this.substituteInFiles = substituteInFiles;
            this.fileSubstituter   = fileSubstituter;
            this.extractPackage    = extractPackage;
        }
Exemplo n.º 10
0
 public SubstituteInFilesConvention(ICalamariFileSystem fileSystem, IFileSubstituter substituter)
 {
     this.fileSystem  = fileSystem;
     this.substituter = substituter;
 }
Exemplo n.º 11
0
 public SubstituteVariablesInAzureServiceFabricPackageConvention(ICalamariFileSystem fileSystem, IFileSubstituter substituter)
 {
     this.fileSystem  = fileSystem;
     this.substituter = substituter;
 }
 public SubstituteInFilesConvention(ICalamariFileSystem fileSystem, IFileSubstituter substituter)
 {
     this.fileSystem = fileSystem;
     this.substituter = substituter;
 }