Sha256: b07bbe673832b4f158d8d3ba554bb8055bad17b71e6b753d6ad44a4b9a8aa40e
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 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 desc "#{method}", "commit status #{method}" define_method "#{method}" do begin client.create_status(options.repo, options.sha1, method, {target_url: options.target_url, description: options.description}) puts "Changed status as #{method}" rescue Octokit::Error => e $stderr.puts "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, :oauth_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.0.1 | bin/github-commit-status-updater |