예제 #1
0
        protected void SetupGit(NPath pathToSetupGitInto, string testName)
        {
            var installDetails = new GitInstaller.GitInstallDetails(pathToSetupGitInto, Environment.IsWindows);
            var gitInstaller   = new GitInstaller(Environment, ProcessManager, TaskManager.Token, installDetails);
            var state          = gitInstaller.SetDefaultPaths(new GitInstaller.GitInstallationState());

            Environment.GitInstallationState = state;
            GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            installDetails.GitInstallationPath.DeleteIfExists();

            installDetails.GitZipPath.EnsureParentDirectoryExists();
            installDetails.GitLfsZipPath.EnsureParentDirectoryExists();

            AssemblyResources.ToFile(ResourceType.Platform, "git.zip", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git.json", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", installDetails.GitZipPath.Parent, Environment);
            AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.json", installDetails.GitZipPath.Parent, Environment);

            var tempZipExtractPath = TestBasePath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var extractPath        = tempZipExtractPath.Combine("git").CreateDirectory();
            var path = new UnzipTask(TaskManager.Token, installDetails.GitZipPath, extractPath, null, Environment.FileSystem)
                       .Catch(e => true)
                       .RunSynchronously();
            var source = path;

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);

            extractPath = tempZipExtractPath.Combine("git-lfs").CreateDirectory();
            path        = new UnzipTask(TaskManager.Token, installDetails.GitLfsZipPath, extractPath, null, Environment.FileSystem)
                          .Catch(e => true)
                          .RunSynchronously();
            installDetails.GitLfsInstallationPath.EnsureParentDirectoryExists();
            path.Move(installDetails.GitLfsInstallationPath);
        }
예제 #2
0
        protected void SetupGit(NPath pathToSetupGitInto, string testName)
        {
            var installDetails = new GitInstaller.GitInstallDetails(pathToSetupGitInto, Environment);
            var state          = installDetails.GetDefaults();

            Environment.GitInstallationState = state;
            GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            var key = installDetails.GitManifest.FileNameWithoutExtension + "_updatelastCheckTime";

            Environment.UserSettings.Set(key, DateTimeOffset.Now);

            var localCache = TestLocation.Combine("Resources");

            localCache.CopyFiles(pathToSetupGitInto, true);
            // skip checking for updates

            state.GitPackage = DugiteReleaseManifest.Load(installDetails.GitManifest, GitInstaller.GitInstallDetails.GitPackageFeed, Environment);
            var asset = state.GitPackage.DugitePackage;

            state.GitZipPath = installDetails.ZipPath.Combine(asset.Name);

            installDetails.GitInstallationPath.DeleteIfExists();

            state.GitZipPath.EnsureParentDirectoryExists();

            var gitExtractPath = TestBasePath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var source         = new UnzipTask(TaskManager.Token, state.GitZipPath, gitExtractPath, null, Environment.FileSystem)
                                 .RunSynchronously();

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);
        }
예제 #3
0
        public void InstallTestGit()
        {
            var installDetails = Environment.GitDefaultInstallation;
            var state          = installDetails.GetDefaults();

            Environment.GitInstallationState = state;

            if (installDetails.GitExecutablePath.FileExists() && installDetails.GitLfsExecutablePath.FileExists())
            {
                return;
            }

            var key = installDetails.GitManifest.FileNameWithoutExtension + "_updatelastCheckTime";

            Environment.UserSettings.Set(key, DateTimeOffset.Now);

            var localCache = SourceDirectory.Combine("files/git");

            localCache.CopyFiles(installDetails.ZipPath.Parent, true);
            // skip checking for updates

            state.GitPackage = DugiteReleaseManifest.Load(TaskManager, installDetails.GitManifest,
                                                          GitInstaller.GitInstallDetails.ManifestFeed, Environment);
            var asset = state.GitPackage.DugitePackage;

            state.GitZipPath = installDetails.ZipPath.Combine(asset.Name);

            installDetails.GitInstallationPath.DeleteIfExists();

            state.GitZipPath.EnsureParentDirectoryExists();

            var gitExtractPath = TestPath.Combine("setup", "git_zip_extract_zip_paths").EnsureDirectoryExists();
            var source         = new UnzipTask(TaskManager, state.GitZipPath, gitExtractPath)
                                 .RunSynchronously();

            installDetails.GitInstallationPath.EnsureParentDirectoryExists();
            source.Move(installDetails.GitInstallationPath);
        }