Sha256: 14b267a2bee91419e26c05e04d993e1ab55575c899fa02b6aaf8171fb1bdd546

Contents?: true

Size: 565 Bytes

Versions: 3

Compression:

Stored size: 565 Bytes

Contents

require 'json'

module Bellows
  class Gerrit

    def self.reviews(project, status="open", branch="master")
      reviews = []
      out=%x{ssh review gerrit query "status: #{status}" --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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bellows-1.0.4 lib/bellows/gerrit.rb
bellows-1.0.2 lib/bellows/gerrit.rb
bellows-1.0.1 lib/bellows/gerrit.rb