Пример #1
0
        public void created_folder_is_named_after_version_with_suffix_if_folder_exists()
        {
            var step = new PrepareVersionedFolderDeploymentStep(
                "TestProject",
                "Core/TestData/VersionedFolders",
                "TestProject",
                new Lazy <string>(() => "1.0.3.5"));

            step.PrepareAndExecute();

            Assert.IsTrue(Directory.Exists("Core/TestData/VersionedFolders/TestProject/1.0.3.5.1"));

            Directory.Delete("Core/TestData/VersionedFolders/TestProject/1.0.3.5.1");
        }
        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));
        }