gb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commands/review.rb +59 -8
- data/lib/gb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b92a4e546c65aa5763dbca8c0d44ce618b7049464a6bd3b2cdd6cab0d40d8319
|
4
|
+
data.tar.gz: a250d44da3534a1e6d7838a85a6c4a29181c1265aff835da5d04bc0b0f82cf4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e51b1b5d76ee3590650665a52731fbdf11dcea9c2a67f9f9ca1034a4c8b53334690ea60c7d77a38e077bd93d74480cee0fc463f2be564aef57c527da3a61df32
|
7
|
+
data.tar.gz: 7a37de109ec6ec2409277f93a2e53b5ee8863ce337723d22ff630314736fac0567cc015d0be8b55af6a5f60a0bd45d1eff876b0c52efe92904761bc8b1d69343
|
data/lib/commands/review.rb
CHANGED
@@ -18,6 +18,7 @@ module Gb
|
|
18
18
|
def self.options
|
19
19
|
[
|
20
20
|
["--assignee=[user name]", "指定review用户名称"],
|
21
|
+
["--at=[user name]", "指定要@用户名称"],
|
21
22
|
["--title", "merge request标题"],
|
22
23
|
["--show-diff", "review前是否显示变更"],
|
23
24
|
].concat(super)
|
@@ -27,6 +28,7 @@ module Gb
|
|
27
28
|
# @working_branch = argv.shift_argument
|
28
29
|
# @remote_branch = argv.shift_argument
|
29
30
|
@assignee = argv.option('assignee')
|
31
|
+
@at = argv.option('at')
|
30
32
|
@title = argv.option('title')
|
31
33
|
@show_diff = argv.flag?('show-diff')
|
32
34
|
super
|
@@ -71,6 +73,11 @@ module Gb
|
|
71
73
|
user = gitlab_search_user(@assignee)
|
72
74
|
end
|
73
75
|
|
76
|
+
at_user = nil
|
77
|
+
if !@at.nil?
|
78
|
+
at_user = gitlab_search_user(@at)
|
79
|
+
end
|
80
|
+
|
74
81
|
self.gb_config.projects.each_with_index do |project, index|
|
75
82
|
project_path = File.expand_path(project.name, './')
|
76
83
|
if File.exist?(project_path)
|
@@ -151,11 +158,24 @@ module Gb
|
|
151
158
|
|
152
159
|
if user.nil?
|
153
160
|
users = gitlab_get_team_members(gitlab_project.id)
|
161
|
+
|
162
|
+
info "Find user to assign."
|
163
|
+
users.each_with_index do |user, index|
|
164
|
+
puts "#{index + 1}、#{user.username}(#{user.name})".green
|
165
|
+
end
|
166
|
+
|
154
167
|
begin
|
155
168
|
info "\nSelect user name or index for review."
|
156
169
|
input_user = STDIN.gets.chomp
|
157
|
-
if input_user
|
158
|
-
user =
|
170
|
+
if input_user.length == 0
|
171
|
+
user = nil
|
172
|
+
elsif input_user =~ /[[:digit:]]/
|
173
|
+
index = input_user.to_i;
|
174
|
+
if index > 0 && index < users.size
|
175
|
+
user = users[input_user.to_i - 1]
|
176
|
+
else
|
177
|
+
user = nil
|
178
|
+
end
|
159
179
|
else
|
160
180
|
user = gitlab_search_user(input_user)
|
161
181
|
end
|
@@ -174,6 +194,40 @@ module Gb
|
|
174
194
|
end until @title.length > 0
|
175
195
|
end
|
176
196
|
|
197
|
+
if at_user.nil?
|
198
|
+
info "Find user for @."
|
199
|
+
puts "0、none".green
|
200
|
+
users.each_with_index do |user, index|
|
201
|
+
puts "#{index + 1}、#{user.username}(#{user.name})".green
|
202
|
+
end
|
203
|
+
|
204
|
+
begin
|
205
|
+
info "\nSelect user name or index for @."
|
206
|
+
input_user = STDIN.gets.chomp
|
207
|
+
if input_user =~ /[[:digit:]]/
|
208
|
+
index = input_user.to_i;
|
209
|
+
if index == 0
|
210
|
+
break
|
211
|
+
end
|
212
|
+
at_user = users[index - 1]
|
213
|
+
else
|
214
|
+
if input_user.length == 0
|
215
|
+
break
|
216
|
+
elsif index < users.size
|
217
|
+
user = users[input_user.to_i - 1]
|
218
|
+
else
|
219
|
+
user = nil
|
220
|
+
end
|
221
|
+
at_user = gitlab_search_user(input_user)
|
222
|
+
end
|
223
|
+
if at_user.nil?
|
224
|
+
error "Can not found user '#{input_user}'."
|
225
|
+
else
|
226
|
+
info "@#{at_user.username}(#{at_user.name})"
|
227
|
+
end
|
228
|
+
end until !at_user.nil?
|
229
|
+
end
|
230
|
+
|
177
231
|
# 总共 0 (差异 0),复用 0 (差异 0)
|
178
232
|
# remote:
|
179
233
|
# remote: To create a merge request for dev-v3.9.0-luobin, visit:
|
@@ -183,8 +237,8 @@ module Gb
|
|
183
237
|
# * [new branch] dev-v3.9.0-luobin -> dev-v3.9.0-luobin
|
184
238
|
|
185
239
|
begin
|
186
|
-
|
187
|
-
|
240
|
+
options = { source_branch: @working_branch, target_branch: @remote_branch, assignee_id:user ? user.id : "", description:at_user ? "@#{at_user.username}":nil }
|
241
|
+
merge_request = Gitlab.create_merge_request(gitlab_project.id, @title, options)
|
188
242
|
info "Create merge request for #{project.name} success. see detail url:#{merge_request.web_url}"
|
189
243
|
if !Gem.win_platform?
|
190
244
|
`open -a "/Applications/Google Chrome.app" '#{merge_request.web_url}/diffs'`
|
@@ -247,10 +301,7 @@ module Gb
|
|
247
301
|
user.username == 'root'
|
248
302
|
}
|
249
303
|
if users.size > 0
|
250
|
-
|
251
|
-
users.each_with_index do |user, index|
|
252
|
-
puts "#{index + 1}、#{user.username}(#{user.name})".green
|
253
|
-
end
|
304
|
+
|
254
305
|
else
|
255
306
|
raise Error.new("Can't find members in project '#{project_id}''.")
|
256
307
|
end
|
data/lib/gb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- binluo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|