#!/usr/bin/env ruby require 'docopt' require 'stash_pull_request_commenter/inputs/rubocop_json' require 'logger' require 'stash/config' require 'stash/server' begin USAGE = "#{File.dirname(__FILE__)}/../USAGE" args = Docopt.docopt(File.read(USAGE)) project = args[''] repository = args[''] pull_request_id = args[''] input = Inputs::RubocopJson.new 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) input.comments.each do |comment| pull_request.add_comment(comment.file, comment.line, comment.text) end rescue Docopt::Exit => e puts e.message end