Пример #1
0
        public void version_is_extracted_from_sample_file()
        {
            ExtractVersionDeploymentStep step =
                new ExtractVersionDeploymentStep(
                    new Lazy <string>(() => "Core\\TestData\\TestVersionExtract"),
                    "subst.exe");

            step.PrepareAndExecute();

            Assert.AreEqual("6.1.7600.16385", step.Version);
        }
        protected override void DoPrepare()
        {
            EnvironmentInfo        environmentInfo = GetEnvironmentInfo();
            TerminalAppProjectInfo projectInfo     = GetProjectInfo <TerminalAppProjectInfo>();

            // create a step for downloading the artifacts
            var downloadArtifactsDeploymentStep =
                new DownloadArtifactsDeploymentStep(
                    projectInfo,
                    DeploymentInfo,
                    GetTempDirPath(),
                    _artifactsRepository);

            AddSubTask(downloadArtifactsDeploymentStep);

            // create a step for extracting the artifacts
            var extractArtifactsDeploymentStep =
                new ExtractArtifactsDeploymentStep(
                    projectInfo,
                    environmentInfo,
                    DeploymentInfo,
                    downloadArtifactsDeploymentStep.ArtifactsFilePath,
                    GetTempDirPath(),
                    _fileAdapter,
                    _directoryAdapter,
                    _zipFileAdapter);

            AddSubTask(extractArtifactsDeploymentStep);

            if (projectInfo.ArtifactsAreEnvironmentSpecific)
            {
                var binariesConfiguratorStep =
                    new ConfigureBinariesStep(
                        environmentInfo.ConfigurationTemplateName,
                        GetTempDirPath());

                AddSubTask(binariesConfiguratorStep);
            }

            var extractVersionDeploymentStep =
                new ExtractVersionDeploymentStep(
                    new Lazy <string>(() => extractArtifactsDeploymentStep.BinariesDirPath),
                    projectInfo.TerminalAppExeName
                    );

            AddSubTask(extractVersionDeploymentStep);

            var prepareVersionedFolderDeploymentStep =
                new PrepareVersionedFolderDeploymentStep(
                    DeploymentInfo.ProjectName,
                    environmentInfo.GetTerminalServerNetworkPath(environmentInfo.TerminalAppsBaseDirPath),
                    projectInfo.TerminalAppDirName,
                    new Lazy <string>(() => extractVersionDeploymentStep.Version));

            AddSubTask(prepareVersionedFolderDeploymentStep);

            AddSubTask(
                new CleanDirectoryDeploymentStep(
                    _directoryAdapter,
                    _fileAdapter,
                    new Lazy <string>(() => prepareVersionedFolderDeploymentStep.VersionDeploymentDirPath),
                    excludedDirs: new string[] { }));

            AddSubTask(
                new CopyFilesDeploymentStep(
                    _directoryAdapter,
                    new Lazy <string>(() => extractArtifactsDeploymentStep.BinariesDirPath),
                    new Lazy <string>(() => prepareVersionedFolderDeploymentStep.VersionDeploymentDirPath)));

            AddSubTask(
                new UpdateApplicationShortcutDeploymentStep(
                    environmentInfo.GetTerminalServerNetworkPath(environmentInfo.TerminalAppsShortcutFolder),
                    new Lazy <string>(() => prepareVersionedFolderDeploymentStep.VersionDeploymentDirPath),
                    projectInfo.TerminalAppExeName,
                    projectInfo.Name));
        }