danger-gitlab_reviewbot 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/gitlab_reviewbot/gem_version.rb +1 -1
- data/lib/gitlab_reviewbot/plugin.rb +13 -15
- data/spec/gitlab_reviewbot_spec.rb +23 -32
- 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: 78868b60ea86cc9289c4a13598fe7807228c548190c02769f6a7007144c25bb9
|
4
|
+
data.tar.gz: c4a7efe442933e89acb1efdca5602ca5bc3742c51f8874b0d220a7fd0988cae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72813a9d97245481c458864a9478e0641200e529c072adb9ab4e245954c250c3ab88d64147e23d3a82896cbdadfaa0f7463454fe1db45e4072f6ab898b4090ad
|
7
|
+
data.tar.gz: 56a3308398621751ce1bed2efb53a1b4f82ddf29bf105a00bd5197b06210276f0cd270b273125da66ad4ecb86e3671ba61cc67c1eb05ab12f557384ffbbfd142
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-gitlab_reviewbot (1.0.
|
4
|
+
danger-gitlab_reviewbot (1.0.2)
|
5
5
|
danger-gitlab
|
6
6
|
danger-plugin-api (~> 1.0)
|
7
7
|
|
@@ -79,7 +79,7 @@ GEM
|
|
79
79
|
method_source (1.0.0)
|
80
80
|
mime-types (3.3.1)
|
81
81
|
mime-types-data (~> 3.2015)
|
82
|
-
mime-types-data (3.2020.
|
82
|
+
mime-types-data (3.2020.0512)
|
83
83
|
multi_xml (0.6.0)
|
84
84
|
multipart-post (2.1.1)
|
85
85
|
nap (1.1.0)
|
@@ -98,7 +98,7 @@ GEM
|
|
98
98
|
pry (0.13.1)
|
99
99
|
coderay (~> 1.1)
|
100
100
|
method_source (~> 1.0)
|
101
|
-
public_suffix (4.0.
|
101
|
+
public_suffix (4.0.5)
|
102
102
|
rainbow (3.0.0)
|
103
103
|
rake (13.0.1)
|
104
104
|
rb-fsevent (0.10.4)
|
@@ -49,10 +49,6 @@ module Danger
|
|
49
49
|
@strategy || Danger::AssignStrategies::RandomStrategy
|
50
50
|
end
|
51
51
|
|
52
|
-
# Add verbosity to the logs
|
53
|
-
# @return Bool
|
54
|
-
attr_accessor :verbose
|
55
|
-
|
56
52
|
# Call this method from the Dangerfile to assign reviewers to your merge requests
|
57
53
|
# @return The usernames list of assigned reviewes [Array<String>]
|
58
54
|
#
|
@@ -67,23 +63,25 @@ module Danger
|
|
67
63
|
raise "Env variable CI_PROJECT_ID doesn't point to a valid project id"
|
68
64
|
end
|
69
65
|
|
70
|
-
current_assignees = (ENV['CI_MERGE_REQUEST_ASSIGNEES'] || '').split(',')
|
71
|
-
|
66
|
+
current_assignees = (ENV['CI_MERGE_REQUEST_ASSIGNEES'] || '').split(',') #buggy?
|
67
|
+
already_assigned_count = current_assignees.length
|
68
|
+
required_assignees_count = [assignees_amount - already_assigned_count, 0].max
|
72
69
|
|
73
|
-
puts "Project ID: #{project_id}" if
|
74
|
-
puts "MR IID: #{mr_iid}" if
|
75
|
-
puts "Currently assigned: #{current_assignees}" if
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
puts "Project ID: #{project_id}" if verbose
|
71
|
+
puts "MR IID: #{mr_iid}" if verbose
|
72
|
+
puts "Currently assigned: #{current_assignees}" if verbose
|
73
|
+
# puts "Required: #{required_assignees_count}" if @verbose
|
74
|
+
|
75
|
+
# if required_assignees_count == 0
|
76
|
+
# puts "Nothing to do" if @verbose
|
77
|
+
# return
|
78
|
+
# end
|
81
79
|
|
82
80
|
strategy_class = strategy.new(client: gitlab.api, project: project_id, mr: mr_iid, group: gitlab_group)
|
83
81
|
|
84
82
|
assignees = strategy_class.assign! assignees_amount
|
85
83
|
|
86
|
-
puts "Assigning: #{assignees}" if
|
84
|
+
puts "Assigning: #{assignees}" if verbose
|
87
85
|
return assignees
|
88
86
|
end
|
89
87
|
end
|
@@ -27,38 +27,29 @@ module Danger
|
|
27
27
|
|
28
28
|
@plugin.assign!
|
29
29
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# @plugin.assign!
|
54
|
-
# end
|
55
|
-
#
|
56
|
-
# ['CI_PROJECT_ID', 'CI_MERGE_REQUEST_IID'].each do |var|
|
57
|
-
# it "Fails when required #{var} variables are not available" do
|
58
|
-
# ENV[var] = nil
|
59
|
-
# expect{@plugin.assign!}.to raise_error(RuntimeError)
|
60
|
-
# end
|
61
|
-
# end
|
30
|
+
it "Assign one reviewer" do
|
31
|
+
@plugin.gitlab_group = 'tech/ios'
|
32
|
+
|
33
|
+
expect(@strategy_mock).to receive(:assign!).with(1).and_return(['Sam'])
|
34
|
+
|
35
|
+
@plugin.assign!
|
36
|
+
end
|
37
|
+
|
38
|
+
it "Assign multiple reviewers" do
|
39
|
+
@plugin.gitlab_group = 'tech/ios'
|
40
|
+
@plugin.assignees_amount = 2
|
41
|
+
|
42
|
+
expect(@strategy_mock).to receive(:assign!).with(2).and_return(['Sam, Nic'])
|
43
|
+
|
44
|
+
@plugin.assign!
|
45
|
+
end
|
46
|
+
|
47
|
+
['CI_PROJECT_ID', 'CI_MERGE_REQUEST_IID'].each do |var|
|
48
|
+
it "Fails when required #{var} variables are not available" do
|
49
|
+
ENV[var] = nil
|
50
|
+
expect{@plugin.assign!}.to raise_error(RuntimeError)
|
51
|
+
end
|
52
|
+
end
|
62
53
|
end
|
63
54
|
end
|
64
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-gitlab_reviewbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Gallonetto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|