Skip to content

Instantly share code, notes, and snippets.

@steakunderscore
Forked from anonymous/gist:a6b10d78e32fc32ccb5d
Last active August 29, 2015 14:06
Show Gist options
  • Save steakunderscore/828eba7b60551187c9c3 to your computer and use it in GitHub Desktop.
Save steakunderscore/828eba7b60551187c9c3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/ssh'
require 'json'
users = %w(user)
host = localhost
Net::SSH.start(host, ENV['USER'] , port: 29418) do |ssh|
result = ssh.exec!('gerrit ls-projects --type code --format json')
data = JSON.parse(result)
projects = data.keys
projects.each do |project|
puts "For the #{project} project"
users.each do |user|
result = ssh.exec!("gerrit query --format=JSON -- -owner:#{user} status:open -reviewer:#{user} project:#{project} -is:draft")
data = JSON.parse("[#{result.lines.to_a.join(',')}]")
count = data[-1]['rowCount']
puts " #{user} has #{count} patchs to review" if count > 0
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment