danger-auto_label 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +1 -4
- data/Gemfile.lock +28 -29
- data/LICENSE.txt +1 -1
- data/README.md +18 -5
- data/danger-auto_label.gemspec +2 -2
- data/gif/sample.gif +0 -0
- data/lib/auto_label/gem_version.rb +3 -1
- data/lib/auto_label/plugin.rb +25 -23
- data/lib/danger_auto_label.rb +2 -0
- data/lib/danger_plugin.rb +2 -0
- data/spec/auto_label_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b9625df6d1d9a8bf3fff361c4f40d3d60ad6a46
|
4
|
+
data.tar.gz: c6cb8f6aa92c817bd6762d9905b7041cde02baec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7bf2d9d0cddb9f0170f0111672d0828c721b0b03311c2f2fb22b5c32db0d186520a7c8eccf11180f5414a82c8e826c10c1ce32e413dbc7e45fb2c4de93ab0ac
|
7
|
+
data.tar.gz: e752b3034e5f44a60f079eee4e618b3ba3191abb38881f2975e59668c736b2663eaab4e9db45a7c9df946bc2cd3c5f620c028132fd02dafce7f114bea4a54654
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# If you don't like these settings, just delete this file :)
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.3
|
7
7
|
|
8
8
|
Style/StringLiterals:
|
9
9
|
EnforcedStyle: double_quotes
|
@@ -127,9 +127,6 @@ Metrics/BlockLength:
|
|
127
127
|
Style/MixinGrouping:
|
128
128
|
Enabled: false
|
129
129
|
|
130
|
-
Style/FileName:
|
131
|
-
Enabled: false
|
132
|
-
|
133
130
|
Layout/IndentHeredoc:
|
134
131
|
Enabled: false
|
135
132
|
|
data/Gemfile.lock
CHANGED
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
colored2 (3.1.2)
|
20
20
|
cork (0.3.0)
|
21
21
|
colored2 (~> 3.1)
|
22
|
-
danger (5.5.
|
22
|
+
danger (5.5.5)
|
23
23
|
claide (~> 1.0)
|
24
24
|
claide-plugins (>= 0.9.2)
|
25
25
|
colored2 (~> 3.1)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
guard (~> 2.1)
|
56
56
|
guard-compat (~> 1.1)
|
57
57
|
rspec (>= 2.99.0, < 4.0)
|
58
|
-
kramdown (1.
|
58
|
+
kramdown (1.16.2)
|
59
59
|
listen (3.0.7)
|
60
60
|
rb-fsevent (>= 0.9.3)
|
61
61
|
rb-inotify (>= 0.9.7)
|
@@ -64,45 +64,44 @@ GEM
|
|
64
64
|
multipart-post (2.0.0)
|
65
65
|
nap (1.1.0)
|
66
66
|
nenv (0.3.0)
|
67
|
-
no_proxy_fix (0.1.
|
67
|
+
no_proxy_fix (0.1.2)
|
68
68
|
notiffany (0.1.1)
|
69
69
|
nenv (~> 0.1)
|
70
70
|
shellany (~> 0.0)
|
71
|
-
octokit (4.
|
71
|
+
octokit (4.8.0)
|
72
72
|
sawyer (~> 0.8.0, >= 0.5.3)
|
73
73
|
open4 (1.3.4)
|
74
|
-
parallel (1.12.
|
75
|
-
parser (2.4.0.
|
76
|
-
ast (~> 2.
|
74
|
+
parallel (1.12.1)
|
75
|
+
parser (2.4.0.2)
|
76
|
+
ast (~> 2.3)
|
77
77
|
powerpack (0.1.1)
|
78
|
-
pry (0.11.
|
78
|
+
pry (0.11.3)
|
79
79
|
coderay (~> 1.1.0)
|
80
80
|
method_source (~> 0.9.0)
|
81
|
-
public_suffix (
|
82
|
-
rainbow (
|
83
|
-
rake
|
81
|
+
public_suffix (3.0.1)
|
82
|
+
rainbow (3.0.0)
|
84
83
|
rake (10.5.0)
|
85
84
|
rb-fsevent (0.10.2)
|
86
85
|
rb-inotify (0.9.10)
|
87
86
|
ffi (>= 0.5.0, < 2)
|
88
|
-
rspec (3.
|
89
|
-
rspec-core (~> 3.
|
90
|
-
rspec-expectations (~> 3.
|
91
|
-
rspec-mocks (~> 3.
|
92
|
-
rspec-core (3.
|
93
|
-
rspec-support (~> 3.
|
94
|
-
rspec-expectations (3.
|
87
|
+
rspec (3.7.0)
|
88
|
+
rspec-core (~> 3.7.0)
|
89
|
+
rspec-expectations (~> 3.7.0)
|
90
|
+
rspec-mocks (~> 3.7.0)
|
91
|
+
rspec-core (3.7.0)
|
92
|
+
rspec-support (~> 3.7.0)
|
93
|
+
rspec-expectations (3.7.0)
|
95
94
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
-
rspec-support (~> 3.
|
97
|
-
rspec-mocks (3.
|
95
|
+
rspec-support (~> 3.7.0)
|
96
|
+
rspec-mocks (3.7.0)
|
98
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
-
rspec-support (~> 3.
|
100
|
-
rspec-support (3.
|
101
|
-
rubocop (0.
|
98
|
+
rspec-support (~> 3.7.0)
|
99
|
+
rspec-support (3.7.0)
|
100
|
+
rubocop (0.52.0)
|
102
101
|
parallel (~> 1.10)
|
103
|
-
parser (>= 2.
|
102
|
+
parser (>= 2.4.0.2, < 3.0)
|
104
103
|
powerpack (~> 0.1)
|
105
|
-
rainbow (>= 2.2.2, <
|
104
|
+
rainbow (>= 2.2.2, < 4.0)
|
106
105
|
ruby-progressbar (~> 1.7)
|
107
106
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
108
107
|
ruby-progressbar (1.9.0)
|
@@ -114,7 +113,7 @@ GEM
|
|
114
113
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
115
114
|
thor (0.20.0)
|
116
115
|
unicode-display_width (1.3.0)
|
117
|
-
yard (0.9.
|
116
|
+
yard (0.9.12)
|
118
117
|
|
119
118
|
PLATFORMS
|
120
119
|
ruby
|
@@ -128,8 +127,8 @@ DEPENDENCIES
|
|
128
127
|
pry
|
129
128
|
rake (~> 10.0)
|
130
129
|
rspec (~> 3.4)
|
131
|
-
rubocop (~> 0.
|
132
|
-
yard (~> 0.
|
130
|
+
rubocop (~> 0.52)
|
131
|
+
yard (~> 0.9.12)
|
133
132
|
|
134
133
|
BUNDLED WITH
|
135
|
-
1.
|
134
|
+
1.16.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -3,15 +3,28 @@
|
|
3
3
|
No more set label to issue or pull request manually.
|
4
4
|
Example, you can set labels simply by changing the PR title.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
![sample](gif/sample.gif)
|
7
|
+
|
8
|
+
### Usage
|
9
|
+
|
10
|
+
Very simple usage.
|
11
|
+
|
12
|
+
First, install gem.
|
13
|
+
|
14
|
+
```
|
15
|
+
$ gem install danger-auto_label
|
16
|
+
```
|
17
|
+
|
18
|
+
Set wip label automatically when the PR title contains '[WIP]'.
|
19
|
+
|
20
|
+
```sample.rb
|
8
21
|
if github.pr_title.include? "[WIP]"
|
9
|
-
auto_label.
|
22
|
+
auto_label.wip=(github.pr_json["number"])
|
10
23
|
end
|
11
|
-
|
24
|
+
```
|
12
25
|
|
13
26
|
#### Methods
|
14
27
|
|
15
|
-
`
|
28
|
+
`wip=` - Set WIP label to PR.
|
16
29
|
|
17
30
|
`set` - Set any labels to PR by this.
|
data/danger-auto_label.gemspec
CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
29
|
|
30
30
|
# Linting code and docs
|
31
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
32
|
-
spec.add_development_dependency "yard", "~> 0.
|
31
|
+
spec.add_development_dependency "rubocop", "~> 0.52"
|
32
|
+
spec.add_development_dependency "yard", "~> 0.9.12"
|
33
33
|
|
34
34
|
# Makes testing easy via `bundle exec guard`
|
35
35
|
spec.add_development_dependency 'guard', '~> 2.14'
|
data/gif/sample.gif
ADDED
Binary file
|
data/lib/auto_label/plugin.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Danger
|
2
4
|
# No more set label to pull request manually.
|
3
5
|
# Example, you can set labels simply by changing the PR title.
|
4
6
|
#
|
5
|
-
# @example Very simple usage. Set wip label automatically when the PR title contains
|
7
|
+
# @example Very simple usage. Set wip label automatically when the PR title contains "[WIP]".
|
6
8
|
# if github.pr_title.include? "[WIP]"
|
7
|
-
# auto_label.
|
9
|
+
# auto_label.wip=(github.pr_json["number"])
|
8
10
|
# end
|
9
11
|
#
|
10
|
-
# @see
|
12
|
+
# @see kaelaela/danger-auto_label
|
11
13
|
# @tags github auto-label
|
12
14
|
#
|
13
15
|
class DangerAutoLabel < Plugin
|
@@ -16,21 +18,21 @@ module Danger
|
|
16
18
|
# A number of issue or pull request for set label.
|
17
19
|
# @return [void]
|
18
20
|
#
|
19
|
-
def
|
20
|
-
label_names =
|
21
|
+
def wip=(pr)
|
22
|
+
label_names = []
|
21
23
|
labels.each do |label|
|
22
24
|
label_names << label.name
|
23
25
|
end
|
24
|
-
puts(
|
25
|
-
|
26
|
+
puts("exist labels:" + label_names.join(", "))
|
27
|
+
unless wip?
|
26
28
|
begin
|
27
|
-
add_label(
|
29
|
+
add_label("WIP")
|
28
30
|
rescue Octokit::UnprocessableEntity => e
|
29
|
-
puts
|
31
|
+
puts "WIP label is already exists."
|
30
32
|
puts e
|
31
33
|
end
|
32
34
|
end
|
33
|
-
github.api.add_labels_to_an_issue(repo, pr, [
|
35
|
+
github.api.add_labels_to_an_issue(repo, pr, [wip_label])
|
34
36
|
end
|
35
37
|
|
36
38
|
# Set any labels to PR by this.
|
@@ -38,13 +40,12 @@ module Danger
|
|
38
40
|
# A number of issue or pull request for set label.
|
39
41
|
# @param [String] name
|
40
42
|
# A new label name.
|
41
|
-
# @param [
|
42
|
-
# A color, in hex, without the leading #. Default is
|
43
|
+
# @param [String] color
|
44
|
+
# A color, in hex, without the leading #. Default is "fef2c0"
|
43
45
|
# @return [void]
|
44
46
|
def set(pr, name, color)
|
45
|
-
message =
|
46
|
-
|
47
|
-
if has_label
|
47
|
+
message = ""
|
48
|
+
if label?(name)
|
48
49
|
message = "Set #{name} label. (Color: #{color})"
|
49
50
|
else
|
50
51
|
message = "Add #{name} new label. (Color: #{color})"
|
@@ -55,31 +56,32 @@ module Danger
|
|
55
56
|
end
|
56
57
|
|
57
58
|
private
|
59
|
+
|
58
60
|
# Add new label to repo. Use octolit api.
|
59
|
-
#
|
60
|
-
def add_label(name, color=
|
61
|
+
# http://octokit.github.io/octokit.rb/Octokit/Client/Labels.html#add_label-instance_method
|
62
|
+
def add_label(name, color = "fef2c0")
|
61
63
|
puts "color: #{color}"
|
62
64
|
github.api.add_label(repo, name, color)
|
63
65
|
end
|
64
66
|
|
65
|
-
def
|
67
|
+
def label?(name)
|
66
68
|
labels.each do |label|
|
67
69
|
return true if label.name == name
|
68
70
|
end
|
69
71
|
false
|
70
72
|
end
|
71
73
|
|
72
|
-
def
|
74
|
+
def wip?
|
73
75
|
labels.each do |label|
|
74
|
-
return true if label.name ==
|
76
|
+
return true if label.name == "WIP" || label.name == "in progress"
|
75
77
|
end
|
76
78
|
false
|
77
79
|
end
|
78
80
|
|
79
|
-
def
|
80
|
-
wip_label =
|
81
|
+
def wip_label
|
82
|
+
wip_label = ""
|
81
83
|
labels.each do |label|
|
82
|
-
if
|
84
|
+
if label.name == "WIP" || label.name == "in progress"
|
83
85
|
wip_label = label.name
|
84
86
|
end
|
85
87
|
end
|
data/lib/danger_auto_label.rb
CHANGED
data/lib/danger_plugin.rb
CHANGED
data/spec/auto_label_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-auto_label
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaelaela
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.52'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.52'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: yard
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.9.12
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.9.12
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.14'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.14'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: guard-rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '4.7'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '4.7'
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -140,14 +140,14 @@ dependencies:
|
|
140
140
|
name: pry
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
description: A simple auto labeler for issue or PR. Made by Danger plugin.
|
@@ -157,8 +157,8 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
-
- .gitignore
|
161
|
-
- .rubocop.yml
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rubocop.yml"
|
162
162
|
- Gemfile
|
163
163
|
- Gemfile.lock
|
164
164
|
- Guardfile
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- README.md
|
167
167
|
- Rakefile
|
168
168
|
- danger-auto_label.gemspec
|
169
|
+
- gif/sample.gif
|
169
170
|
- lib/auto_label/gem_version.rb
|
170
171
|
- lib/auto_label/plugin.rb
|
171
172
|
- lib/danger_auto_label.rb
|
@@ -182,17 +183,17 @@ require_paths:
|
|
182
183
|
- lib
|
183
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
185
|
requirements:
|
185
|
-
- -
|
186
|
+
- - ">="
|
186
187
|
- !ruby/object:Gem::Version
|
187
188
|
version: '0'
|
188
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
190
|
requirements:
|
190
|
-
- -
|
191
|
+
- - ">="
|
191
192
|
- !ruby/object:Gem::Version
|
192
193
|
version: '0'
|
193
194
|
requirements: []
|
194
195
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
196
|
+
rubygems_version: 2.5.2
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: No more set label to pull request manually. Example, you can set labels simply
|