Пример #1
0
 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 ConfigureHooks(CommandLineOptions options)
 {
     _installer = _installer ?? new GitHubHookInstaller(options.Username, options.Password);
     _installer.ConfigureHook(options.HookId, options.Username, options.Repo);
 }