Sha256: 68c5749d6565fd15207833ea083738f700d4c26185978c900f8f7fc165066da0
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 KB
Contents
#!/usr/bin/env ruby require "bundler/setup" require "octokit" require "thor" class GithubCommitStatusUpdater < Thor STATUSES = %w(pending success failure error) STATUSES.each do |method| method_option :repo, :type => :string, :required => true, :aliases => "-r" method_option :sha1, :type => :string, :required => true, :aliases => "-s" method_option :username, :type => :string, :aliases => "-u" method_option :password, :type => :string, :aliases => "-p" method_option :oauth_token, :type => :string method_option :target_url, :type => :string method_option :description, :type => :string method_option :web_endpoint, :type => :string method_option :context, :type => :string desc "#{method}", "commit status #{method}" define_method "#{method}" do begin if options.web_endpoint Octokit.configure do |c| c.api_endpoint = options.web_endpoint + 'api/v3' c.web_endpoint = options.web_endpoint end end status_options = { target_url: options.target_url, description: options.description, context: options.context } client.create_status(options.repo, options.sha1, method, status_options) puts "Changed status as #{method}" rescue Octokit::Error => e abort "Update error: #{e.message}" end end end private def client if options.username && options.password Octokit::Client.new(:login => options.username, :password => options.password) elsif options.username && options.oauth_token Octokit::Client.new(:login => options.username, :access_token => options.oauth_token) else Octokit::Client.new end end end GithubCommitStatusUpdater.start
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github-commit-status-updater-1.1.0 | bin/github-commit-status-updater |