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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b732c4099468c0343e8b699704319a26ed7673e10eaa8de447fa9d0f4f5314e
4
- data.tar.gz: 23fcc491ac6224d9afc3fb50b5149d59568f6a94147675493c79c0a31f9eadbf
3
+ metadata.gz: 78868b60ea86cc9289c4a13598fe7807228c548190c02769f6a7007144c25bb9
4
+ data.tar.gz: c4a7efe442933e89acb1efdca5602ca5bc3742c51f8874b0d220a7fd0988cae0
5
5
  SHA512:
6
- metadata.gz: e4f3a3ba3e1ea7bbf437a35412036c30e696547b35cf1ecbef85cbe491a8e0e04f0243fba5cb38dc39262d8f7398b45d1c7aa5eb2092c0bb81ca70da216e420b
7
- data.tar.gz: 4ff3d2fa865e58f0b694630f489f730ade355c9c0a2165ad608aee98705ec9eb920b87a4578334be6438bc551b93b257f840a3930c28f141b05aa9d87a91337a
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.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.0425)
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.4)
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)
@@ -1,3 +1,3 @@
1
1
  module GitlabReviewbot
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.0.2".freeze
3
3
  end
@@ -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
- required_assignees_count = [assignees_amount - current_assignees.length, 0].max
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 @verbose
74
- puts "MR IID: #{mr_iid}" if @verbose
75
- puts "Currently assigned: #{current_assignees}" if @verbose
76
- puts "Required: #{required_assignees_count}" if @verbose
77
- if required_assignees_count == 0
78
- puts "Nothing to do" if @verbose
79
- return
80
- end
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 @verbose
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
- # 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
- # it "Doesn't assign if already asssigned" do
48
- # ENV['CI_MERGE_REQUEST_ASSIGNEES'] = 'Sam'
49
- # @plugin.gitlab_group = 'tech/ios'
50
- #
51
- # expect(@strategy_mock).not_to receive(:assign!)
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.1
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-12 00:00:00.000000000 Z
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