Module: Fuel::CLI::GerritCommon

Included in:
Gerrit, Jenkins
Defined in:
lib/fuel/cli/gerrit_common.rb

Instance Method Summary collapse

Instance Method Details

#changes_endpoint(change_id = nil, path = nil) ⇒ Object



18
19
20
21
22
23
# File 'lib/fuel/cli/gerrit_common.rb', line 18

def changes_endpoint(change_id = nil, path = nil)
  url = "#{gerrit_url}/a/changes/"
  url += "#{change_id}/" if change_id
  url += path if path
  url
end

#fetch_change_id_or_failObject



4
5
6
7
# File 'lib/fuel/cli/gerrit_common.rb', line 4

def fetch_change_id_or_fail
  change_id = commit_message =~ /Change-Id: (.*)/ && $1
  change_id or raise Thor::Error, set_color("No appropriate commit found at HEAD", :red)
end

#gerrit_ref(result) ⇒ Object



13
14
15
16
# File 'lib/fuel/cli/gerrit_common.rb', line 13

def gerrit_ref(result)
  current_rev = result['current_revision']
  result['revisions'][current_rev]['fetch']['ssh']['ref']
end

#gerrit_urlObject



9
10
11
# File 'lib/fuel/cli/gerrit_common.rb', line 9

def gerrit_url
  Fuel::Util::Config.get('gerrit', 'url').chomp('/')
end