Sha256: ce454e526374c818db83f1b4ca5bfd8683d4a5c190a08899a2014980e634ff3e

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

require 'json'

module Bellows
  class Gerrit

    def self.run_cmd(command)
      return %x{ssh review gerrit #{command}}
    end

    def self.reviews(project, status="open", branch="master")
      reviews = []
      out=Gerrit.run_cmd(%{query status:#{status} project:openstack/#{project} branch:#{branch} limit:500 --current-patch-set --format JSON})
      out.each_line do |line|
        data = JSON.parse(line)
        if data['project'] and data['project'] == "openstack/#{project}" and data['branch'] and data['branch'] == branch
          if block_given?
            yield data
          else
            reviews << data 
          end
        end
      end
      reviews
    end

    def self.comment(revision, message)
      Gerrit.run_cmd(%{review --code-review 0 -m \"'#{message}'\" #{revision}})
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bellows-1.0.10 lib/bellows/gerrit.rb
bellows-1.0.9 lib/bellows/gerrit.rb
bellows-1.0.8 lib/bellows/gerrit.rb
bellows-1.0.7 lib/bellows/gerrit.rb