fuel-cli 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDkwYzI5YWYwOGQ1YTBjYWNiYTc1NWE5ODM3ZTdjNDVlNWRkMDNjYw==
4
+ ZDI2OTZkZmZjMDA2YzZhNGUyZTk5ZDJkNGM4MGQyZmNkMzc0YWVmNg==
5
5
  data.tar.gz: !binary |-
6
- NmE0OTZhNjhmYWNiMmNiMTkwYjk2YzJkN2EyYjcxYmI0ZWY1NjkyNQ==
6
+ M2M0MjVhM2E0MDMzZGUwZjJiMjY1YTFlZmUwNDgxYzhmYjM1OGY2Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmQ3MTAxM2YwZWNjMzM1MjM1NzE0Y2FlN2EzM2E1YmI2NTc5ZjM0MjUzZWU4
10
- ZWMwZWZjYTAwODgzY2RjNWYxZmJmOWU1NmE4MzQyYjI0YjViZWUwYTNmOTE3
11
- MjJmMjEyZDc1NDQyYTFlYzdiNGUzOTM0MGFjNmYwNjgyMjdhOTM=
9
+ NTBlNjc5MjljMTQzN2VmNzBkOTBkNWZmNGU4NDgwMzIzNjRkZGIxZDA0MGM0
10
+ M2YwZjhmN2NmZDExZDdkNDcyNWZjOGNmNGUyZWY3ZWMwNTIwODQ3OTI3MDBh
11
+ MTVhZGY3NTJjOTdkNTg1Nzc3NGFjZjI1YjVjMDExZmYzMzM0ZWY=
12
12
  data.tar.gz: !binary |-
13
- ODM0NmFmOTM1OWI2NDI5OTRjYjlmMDllMTE0MGNkZTMzMjc2ZTg4NDMwOTVj
14
- Yzc4YzA1OTNjNmMyN2Y0M2YxZWJiMGEzN2YyMDdhN2RhMjc2NGZmNDc4M2Vl
15
- ZjM0MDdiN2IyYzNiZWYwYTA3Zjc3MjgwODZkZTI1NDc0NTMyMWY=
13
+ YzIzMzZhOWMxOWFhOGEyYmIxZjIxMmY4M2FmY2U3ZDc2NTg2YzdlZDEwNzI0
14
+ MDUxOTdkOTcwMzA0NDViMmI0NDYyYmJhZmZkMzdhM2E2M2FlNTgyMTA1MmZh
15
+ NTFlZTM5MDM2MTA2N2FjMDhkMDc5ZjQxYTU0OTg0YjM4NGEyZTM=
@@ -81,8 +81,6 @@ module Fuel
81
81
  def submit
82
82
  change_id = fetch_change_id_or_fail
83
83
  result = self.class.post(changes_endpoint(change_id, 'submit'), body: { wait_for_merge: true }.to_json)
84
- puts result.code
85
- puts result.parsed_response.inspect
86
84
  end
87
85
 
88
86
  option :message, :aliases => '-m'
@@ -91,7 +89,6 @@ module Fuel
91
89
  change_id = fetch_change_id_or_fail
92
90
  params = options['message'] ? { body: { message: options['message'] }.to_json } : {}
93
91
  result = self.class.post(changes_endpoint(change_id, 'abandon'), params).parsed_response
94
- puts result.inspect
95
92
  end
96
93
 
97
94
  option :message, :aliases => '-m'
@@ -100,7 +97,6 @@ module Fuel
100
97
  change_id = fetch_change_id_or_fail
101
98
  params = options['message'] ? { body: { message: options['message'] }.to_json } : {}
102
99
  result = self.class.post(changes_endpoint(change_id, 'restore'), params).parsed_response
103
- puts result.inspect
104
100
  end
105
101
 
106
102
  desc "rebase", "Rebase the current change"
@@ -166,7 +162,7 @@ module Fuel
166
162
  h
167
163
  end
168
164
  comments_to_post = comments_for_lines.map do |line, cc|
169
- next if cc.all? { |c| c['author']['username'] != gerrit_user }
165
+ next if cc.all? { |c| c['author']['username'] == gerrit_user }
170
166
  system 'tput smcup'
171
167
 
172
168
  line_in_array = line - 1
@@ -186,9 +182,7 @@ module Fuel
186
182
  { line: line, message: reply }
187
183
  end.compact
188
184
  say 'No comments to respond to!', :green and return if comments_to_post.empty?
189
- puts comments_to_post.inspect
190
185
  result = self.class.post(revisions_endpoint(change_id, revision_id, 'review'), body: { comments: { file => comments_to_post } }.to_json).parsed_response
191
- puts result.inspect
192
186
  end
193
187
 
194
188
  no_commands do
@@ -240,6 +234,7 @@ module Fuel
240
234
  def format_row(row)
241
235
  result = [row["name"]]
242
236
  approvals = row["approvals"]
237
+
243
238
  result << format_review(approvals && approvals["Code-Review"])
244
239
  result << format_verified(approvals && approvals["QA-Test-Passed"])
245
240
  result << format_verified(approvals && approvals["Verified"])
@@ -247,7 +242,7 @@ module Fuel
247
242
  end
248
243
 
249
244
  def format_review(cell)
250
- characters = { "0" => " ", "-1" => set_color("-1", :red), "+1" => set_color("+1", :green), "+2" => tick }
245
+ characters = { "0" => " ", "-1" => set_color("-1", :red), "+1" => set_color("+1", :green), "+2" => tick, "-2" => cross }
251
246
  characters[(cell || "").strip]
252
247
  end
253
248
 
@@ -261,11 +256,11 @@ module Fuel
261
256
  end
262
257
 
263
258
  def tick
264
- set_color([10003].pack("U*"), :green)
259
+ set_color(" " + [10003].pack("U*"), :green)
265
260
  end
266
261
 
267
262
  def cross
268
- set_color([10008].pack("U*"), :red)
263
+ set_color(" " + [10008].pack("U*"), :red)
269
264
  end
270
265
 
271
266
  def revisions_endpoint(change_id, revision_id = nil, path = nil)
@@ -14,7 +14,8 @@ module Fuel
14
14
  say "#{jira_id}: #{fields['summary']}", :bold
15
15
  table = [['Type', fields['issuetype']['name']]]
16
16
  table << ['Status', fields['status']['name']]
17
- table << ['Assignee', fields['assignee']['displayName']]
17
+ assignee = fields['assignee'] && fields['assignee']['displayName'] || 'Unassigned'
18
+ table << ['Assignee', assignee]
18
19
  print_table table
19
20
  end
20
21
 
@@ -44,8 +45,8 @@ module Fuel
44
45
  jira_id = jira || fetch_jira_or_fail
45
46
  body = { transition: { id: get_transition_id(jira_id, name) } }.merge(extra_body)
46
47
  result = self.class.post(issue_endpoint(jira_id, "transitions"),
47
- body: body.to_json).parsed_response
48
- puts result.inspect
48
+ body: body.to_json)
49
+ say 'Jira status changed.', :green if result.code.to_i < 400
49
50
  end
50
51
 
51
52
  def jira_url
@@ -7,8 +7,9 @@ module Fuel
7
7
 
8
8
  desc "setup", "Set up the CLI interactively"
9
9
  def setup
10
+ say "############################################\n\n", [:cyan, :bold]
10
11
  say flame, [:cyan, :bold]
11
- say "\nWelcome to Fuel-CLI!\n\n", :bold
12
+ say "\n########### Welcome to Fuel-CLI! ###########\n\n", [:cyan, :bold]
12
13
 
13
14
  setup_gerrit
14
15
  setup_jira
@@ -40,10 +41,12 @@ module Fuel
40
41
 
41
42
  def setup_gerrit
42
43
  say "[Setting up gerrit]", :yellow
43
- gerrit_url = ask "URL:"
44
+ gerrit_url = ask("URL:").chomp('/')
44
45
  self.class.new.invoke :config, [], gerrit_url: gerrit_url
45
46
  gerrit_user = ask "User name:"
46
- say "Please go to your Gerrit user settings now, and generate an HTTP password there."
47
+ say "Your Gerrit user settings will open now, please generate an HTTP password there."
48
+ sleep 3
49
+ `open #{gerrit_url}/#/settings/http-password`
47
50
  Gerrit.new.invoke :auth, [gerrit_user]
48
51
 
49
52
  say "gerrit configured successfully!\n\n", :green
@@ -1,5 +1,5 @@
1
1
  module Fuel
2
2
  module CLI
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuel-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Zherdev