Sha256: 7056c5e8f005b2c9a4ccbad9fe153b36e0bad16bee468eccd5c96da2b4aaff40
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'thor' module GithubStatusNotifier class CLI < Thor def self.exit_on_failure? true end desc 'version', 'Show the GithubStatusNotifier version' map %w(-v --version) => :version def version puts "GithubStatusNotifier version #{::GithubStatusNotifier::VERSION}" end desc 'notify', 'Notify current status to GitHub status' option :exit_status, type: :numeric option :keep_exit_status, type: :boolean, default: false option :debug, type: :boolean, default: false option :verbose, type: :boolean, default: false option :state, type: :string, enum: %w(pending success error failure) option :target_url, type: :string option :description, type: :string option :context, type: :string def notify if options[:debug] logger.level = Logger::DEBUG elsif options[:verbose] logger.level = Logger::INFO end logger.debug(options.inspect) if options[:keep_exit_status] && !options[:exit_status] logger.error 'keep-exit-status requires exit-status' abort end params = { state: options[:state], exit_status: options[:exit_status], target_url: options[:target_url], description: options[:description], context: options[:context] } Notifier.new.notify(params) if options[:keep_exit_status] exit options[:exit_status] end end no_commands do def logger ::GithubStatusNotifier.logger end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github_status_notifier-0.1.1 | lib/github_status_notifier/cli.rb |