ping 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 036d44b633820e66e18e6711acace01648034351
4
- data.tar.gz: d27bc8570003420c9507d30fbf48f5f694cffb44
3
+ metadata.gz: 6d4873e809919a2dbae3e2ba7f759413002d7fc1
4
+ data.tar.gz: 6ec66bdfb0f99f3c7ead5a27aea970774e4219f3
5
5
  SHA512:
6
- metadata.gz: 7cbee0d6277080a360aa6a50b119756350692c951c41d9a5fc4576898dc2791d3982bfb9889aae3eb67ab39787c78d4dc703217bb29318157f5c8cd2b18be239
7
- data.tar.gz: 4452025bfd32322e299a0c9140b202621ed6566d1c94a25276530d270fa05e64d3b51b4de1b9f12b7cc27d4bdc1abde25f1c8be78f2f60fa2ee3f4341c3e8a13
6
+ metadata.gz: d459bf0d42d17e01400201fd9a56443ab0b2d5831377479a313b0152623eaac4e6af1cab3ce403fb782b5b7bac4238fcd12760aa627cb78d6a6316b421bb7d80
7
+ data.tar.gz: 20a8203520a10bf9be20a97c1c0b6571aebfb4c0fd2cc55a90e181d7eb5fca3578f92e71a441fe56a4b3983ec6e566758d87c808f6c9f3da1c43b82995deb70a
@@ -7,13 +7,13 @@ module Ping
7
7
  need|needs|needed|require|requires|required
8
8
  /ix
9
9
 
10
- RepositoryName = /[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*/
10
+ RepositoryName = /[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9\-_]*/
11
11
 
12
12
  Pattern = /
13
13
  (?:^|\W) # beginning of string or non-word char
14
14
  (?:(#{Qualifiers})(?:\s))? # qualifier (optional)
15
- (#{RepositoryName})? # repository name (optional)
16
- \#(\d+) # issue number
15
+ (?:(#{RepositoryName})? # repository name (optional)
16
+ \#|(?:GH\-))(\d+) # issue number
17
17
  (?=
18
18
  \.+[ \t\W]| # dots followed by space or non-word character
19
19
  \.+$| # dots at end of line
@@ -22,7 +22,7 @@ module Ping
22
22
  )
23
23
  /ix
24
24
 
25
- # See http://rubular.com/r/LxWUfwmPhM
25
+ # See http://rubular.com/r/bb7Ks0JK9l now http://rubular.com/r/evB7RlvUfI
26
26
 
27
27
  def initialize(qualifier, repository, number)
28
28
  @qualifier = qualifier
@@ -1,3 +1,3 @@
1
1
  module Ping
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -81,6 +81,15 @@ class Ping::ParserTest < MiniTest::Test
81
81
  assert_equal "43", issue.number
82
82
  end
83
83
 
84
+ should "handle odd repository names" do
85
+ text = "giant-sequoia-123/scaling_octokitten#43"
86
+ parser = Ping::Parser.new(text)
87
+ issue = parser.issues.first
88
+
89
+ assert_equal "giant-sequoia-123/scaling_octokitten", issue.repository
90
+ assert_equal "43", issue.number
91
+ end
92
+
84
93
  should "extract multiple references" do
85
94
  text = "You should look at #2 and #4 because #5 fixes codetree/codetree#6"
86
95
  parser = Ping::Parser.new(text)
@@ -121,4 +130,110 @@ class Ping::ParserTest < MiniTest::Test
121
130
  assert_equal "43", issue.number
122
131
  end
123
132
  end
133
+
134
+ context "GH-issues" do
135
+ should "extract single issue references" do
136
+ text = "See GH-43"
137
+ parser = Ping::Parser.new(text)
138
+ issue = parser.issues.first
139
+
140
+ assert_equal nil, issue.qualifier
141
+ assert_equal nil, issue.repository
142
+ assert_equal "43", issue.number
143
+ end
144
+
145
+ should "extract lower case issue references" do
146
+ text = "See gh-43"
147
+ parser = Ping::Parser.new(text)
148
+ issue = parser.issues.first
149
+
150
+ assert_equal nil, issue.qualifier
151
+ assert_equal nil, issue.repository
152
+ assert_equal "43", issue.number
153
+ end
154
+
155
+ should "extract single issue references followed by a period" do
156
+ text = "See GH-43."
157
+ parser = Ping::Parser.new(text)
158
+ issue = parser.issues.first
159
+
160
+ assert_equal nil, issue.qualifier
161
+ assert_equal nil, issue.repository
162
+ assert_equal "43", issue.number
163
+ end
164
+
165
+ should "extract close qualifiers" do
166
+ %w{fix fixes fixed close closes closed resolve resolves resolved}.each do |q|
167
+ text = "#{q} GH-55"
168
+ parser = Ping::Parser.new(text)
169
+ issue = parser.issues.first
170
+
171
+ assert_equal q, issue.qualifier
172
+ assert_equal nil, issue.repository
173
+ assert_equal "55", issue.number
174
+ end
175
+ end
176
+
177
+ should "extract dependency qualifiers" do
178
+ %w{need needs needed require requires required}.each do |q|
179
+ text = "#{q} GH-123"
180
+ parser = Ping::Parser.new(text)
181
+ issue = parser.issues.first
182
+
183
+ assert_equal q, issue.qualifier
184
+ assert_equal nil, issue.repository
185
+ assert_equal "123", issue.number
186
+ end
187
+ end
188
+
189
+ should "extract multiple references" do
190
+ text = "You should look at GH-2 and GH-4 because GH-5 fixes codetree/codetree#6"
191
+ parser = Ping::Parser.new(text)
192
+
193
+ assert parser.issues.include?(2)
194
+ assert parser.issues.include?(4)
195
+ assert parser.issues.include?(5)
196
+ assert parser.issues.include?(6)
197
+ end
198
+
199
+ should "not extract similar non-qualifiers" do
200
+ text = "afixes GH-43"
201
+ parser = Ping::Parser.new(text)
202
+ issue = parser.issues.first
203
+
204
+ assert_equal nil, issue.qualifier
205
+ assert_equal nil, issue.repository
206
+ assert_equal "43", issue.number
207
+ end
208
+
209
+ should "not choke on case" do
210
+ text = "FIxEs GH-43"
211
+ parser = Ping::Parser.new(text)
212
+ issue = parser.issues.first
213
+
214
+ assert_equal "FIxEs", issue.qualifier
215
+ assert_equal nil, issue.repository
216
+ assert_equal "43", issue.number
217
+ end
218
+
219
+ should "require only one space between qualifier and issue" do
220
+ text = "fixes GH-43"
221
+ parser = Ping::Parser.new(text)
222
+ issue = parser.issues.first
223
+
224
+ assert_equal nil, issue.qualifier
225
+ assert_equal nil, issue.repository
226
+ assert_equal "43", issue.number
227
+ end
228
+
229
+ should "require at least one space before GH" do
230
+ text = "fixes codetree/codetreeGH-99 and fixes GH-43"
231
+ parser = Ping::Parser.new(text)
232
+ issue = parser.issues.first
233
+
234
+ assert_equal "fixes", issue.qualifier
235
+ assert_equal nil, issue.repository
236
+ assert_equal "43", issue.number
237
+ end
238
+ end
124
239
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derrick Reimer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-26 00:00:00.000000000 Z
11
+ date: 2014-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler