Sha256: 845a87dc40c13e095d4eef26001a74e25b85906c5e1ec539461a33fcd615e9fe

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

#!/usr/bin/env ruby

require 'docopt'
require 'stash_pull_request_commenter/inputs/rubocop_json'
require 'stash_pull_request_commenter/inputs/coffeelint_raw'
require 'logger'
require 'stash/config'
require 'stash/server'

begin
  USAGE = "#{File.dirname(__FILE__)}/../USAGE"
  args = Docopt.docopt(File.read(USAGE))

  project         = args['<project>']
  repository      = args['<repository>']
  pull_request_id = args['<pull_request_id>']

  config = Stash::Config.new
  server = Stash::Server.new(config.host, config.user, config.password, Logger.new(STDOUT))
  repository = server.repository(project, repository)
  pull_request = repository.pull_request(pull_request_id)

  [Inputs::RubocopJson, Inputs::CoffeeLintRaw].each do |input_class|
    input = input_class.new
    input.comments.each do |comment|
      pull_request.add_comment(comment.file, comment.line, comment.text)
    end
  end
rescue Docopt::Exit => e
  puts e.message
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stash_pull_request_commenter-0.2.1 bin/stash-comment
stash_pull_request_commenter-0.2.0 bin/stash-comment