Sha256: bb099fb5ff17414b4400dbf41cf2ecc9656add842c1354880395706f2bee8a5d

Contents?: true

Size: 1009 Bytes

Versions: 29

Compression:

Stored size: 1009 Bytes

Contents

require_relative "lib/compare_linker"
require "optparse"

options = {}
opt = OptionParser.new
opt.on("-f VAL", "--format VAL") { |val|
  case val
  when /t(ext)?/i
    options[:formatter] = CompareLinker::Formatter::Text.new
  when /m(arkdown|d)?/i
    options[:formatter] = CompareLinker::Formatter::Markdown.new
  end
}
opt.on("--post-comment") { options[:post_comment] = true }
opt.parse!

repo_full_name, pr_number = *ARGV
if repo_full_name.nil? || pr_number.nil?
  puts <<USAGE
Usage: ruby #{$0} [repo_full_name] [pr_number]
       ruby #{$0} [repo_full_name] [pr_number] OCTOKIT_ACCESS_TOKEN=[your github access token]
USAGE
  exit!
end

compare_linker = CompareLinker.new(repo_full_name, pr_number.to_i)
compare_linker.formatter = options[:formatter] if options[:formatter]
puts compare_linker.make_compare_links
if options[:post_comment]
  compare_linker.formatter = CompareLinker::Formatter::Markdown.new
  puts compare_linker.add_comment(repo_full_name, pr_number, compare_linker.compare_links)
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
compare_linker-1.1.9 runner.rb
compare_linker-1.1.8 runner.rb
compare_linker-1.1.7 runner.rb
compare_linker-1.1.6 runner.rb
compare_linker-1.1.5 runner.rb
compare_linker-1.1.4 runner.rb
compare_linker-1.1.3 runner.rb
compare_linker-1.1.2 runner.rb
compare_linker-1.1.1 runner.rb