public static void InstallGitHubHooksUsingAppConfig()
 {
     if (!string.IsNullOrWhiteSpace(GitHubUsername) && !string.IsNullOrWhiteSpace(GitHubPassword))
     {
         try
         {
             var hookInstaller = new GitHubHookInstaller(GitHubUsername, GitHubPassword);
             if (string.IsNullOrWhiteSpace(GitHubHookId))
             {
                 Console.WriteLine("Attempting to get the list of github hooks so you can choose one...");
                 List<GitHubHookResponse> hooks = hookInstaller.GetAllGitHubHooks(GitHubUsername, GitHubRepo);
                 foreach (GitHubHookResponse hook in hooks)
                 {
                     Console.WriteLine(string.Format("Hook Id {0}: {1} {2}", hook.id, hook.name, hook.config.url));
                 }
                 Console.WriteLine(
                     "Please select one of these and put the hook Id (just the number) into app settings under the key GitHubHookId and I'll configure it for you.");
             }
             else
             {
                 hookInstaller.ConfigureHook(GitHubHookId, GitHubUsername, GitHubRepo);
             }
         }
         finally
         {
             Console.ReadLine();
             Environment.Exit(0);
         }
     }
 }
示例#2
0
 public void RunInteractiveConfigurator(CommandLineOptions options)
 {
     if (string.IsNullOrWhiteSpace(options.Username)) options.Username = GetUsername();
     if (string.IsNullOrWhiteSpace(options.Password)) options.Password = GetPassword();
     if (string.IsNullOrWhiteSpace(options.Repo)) options.Repo = GetRepo();
     _installer = _installer ?? new GitHubHookInstaller(options.Username, options.Password);
     if (string.IsNullOrWhiteSpace(options.HookId)) options.HookId = GetHookId(options);
 }
示例#3
0
 public void ConfigureHooks(CommandLineOptions options)
 {
     _installer = _installer ?? new GitHubHookInstaller(options.Username, options.Password);
     _installer.ConfigureHook(options.HookId, options.Username, options.Repo);
 }