Beispiel #1
0
 public GetResponse<RepoPathPair> Check(
     GetResponse<string> remote,
     DirectoryPath localDir,
     CancellationToken cancel)
 {
     try
     {
         cancel.ThrowIfCancellationRequested();
         if (ShouldKeep.ShouldKeep(localDir: localDir, remoteUrl: remote))
         {
             return GetResponse<RepoPathPair>.Succeed(new(remote.Value, localDir), remote.Reason);
         }
         cancel.ThrowIfCancellationRequested();
         
         DeleteEntireDirectory.DeleteEntireFolder(localDir);
         cancel.ThrowIfCancellationRequested();
         
         if (remote.Failed) return GetResponse<RepoPathPair>.Fail(new(remote.Value, string.Empty), remote.Reason);
         _logger.Information("Cloning remote {RemotePath}", remote.Value);
         var clonePath = CloneRepo.Clone(remote.Value, localDir);
         return GetResponse<RepoPathPair>.Succeed(new(remote.Value, clonePath), remote.Reason);
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "Failure while checking/cloning repository");
         return GetResponse<RepoPathPair>.Fail(new(remote.Value, string.Empty), ex);
     }
 }
Beispiel #2
0
        private void tsRes_Click(object sender, EventArgs e)
        {
            Console.WriteLine("NEW RESOURCE: " + resourceLabel.Text);

            // removes whitespace
            System.Threading.Thread.Sleep(3000);
            string input_info = resourceLabel.Text.Replace(" ", string.Empty);

            SendKeys.Send(input_info);

            // this will eventually clone a repo to the selected directory
            CloneRepo repo = new CloneRepo();

            repo.Clone(selectedPath, "https://github.com/itschip/cfa-templates.git");

            resourcePanel.Hide();
        }