watson-ruby 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/watson/config.rb +1 -1
- data/lib/watson/parser.rb +18 -3
- data/lib/watson/version.rb +1 -1
- data/spec/parser_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c844168342cec7be1e4f91e7e13c875a43ba57e
|
4
|
+
data.tar.gz: fa9e80a9cc46fe538a7cd7526a65eca20c072262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a33eed2db55fe71083e6bf4f7bbf3a48d820b671d4830ea8cd08faa2804f5ad8b321340a937d6e70c14b47607dc672a97c92c4265b43e3e1dd11ab77f1b1cb3f
|
7
|
+
data.tar.gz: 8c2ae5068a18f17685a42d752b444e51e6205fbafcf120315037543183237e7147281577c366c3cf95d5603d978d451e1c8b01965bfcf1c5179a03a48c52577e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# watson-ruby
|
2
2
|
### an inline issue manager
|
3
3
|
[watson](http://goosecode.com/watson) ([mirror](http://nhmood.github.io/watson-ruby)) is a tool for creating and tracking bug reports, issues, and internal notes in code.
|
4
|
-
It is avaliable in two flavors, [watson-ruby](http://github.com/nhmood/watson-ruby) and [watson-perl](http://github.com/watson-perl)
|
4
|
+
It is avaliable in two flavors, [watson-ruby](http://github.com/nhmood/watson-ruby) and [watson-perl](http://github.com/nhmood/watson-perl)
|
5
5
|
|
6
6
|
### See watson in action [here](http://goosecode.com/watson) ([mirror](http://nhmood.github.io/watson-ruby))
|
7
7
|
### See the RDoc documentation [here](http://goosecode.com/watson/ruby/doc/) ([mirror](http://nhmood.github.io/watson-ruby/ruby/doc/))
|
data/lib/watson/config.rb
CHANGED
@@ -176,7 +176,7 @@ module Watson
|
|
176
176
|
|
177
177
|
# Generate full path since File doesn't care about the LOAD_PATH
|
178
178
|
# [review] - gsub uses (.?)+ to grab anything after lib (optional), better regex?
|
179
|
-
_full_path = __dir__.gsub(
|
179
|
+
_full_path = __dir__.gsub(%r!/lib/watson(.?)+!, '') + "/assets/defaultConf"
|
180
180
|
debug_print "Full path to defaultConf (in gem): #{ _full_path }\n"
|
181
181
|
|
182
182
|
# Check to make sure we can access the default file
|
data/lib/watson/parser.rb
CHANGED
@@ -207,8 +207,15 @@ module Watson
|
|
207
207
|
_data = Array.new()
|
208
208
|
File.open(_absolute_path, 'r').read.each_line do | _line |
|
209
209
|
_data.push(_line)
|
210
|
+
# If we can't encode (ever) to UTF-8, clear _data and break
|
211
|
+
begin
|
212
|
+
_line.encode('UTF-8', :invalid => :replace)
|
213
|
+
rescue ArgumentError
|
214
|
+
debug_print "Could not encode to UTF-8, non-text\n"
|
215
|
+
_data = Array.new()
|
216
|
+
break
|
217
|
+
end
|
210
218
|
end
|
211
|
-
|
212
219
|
|
213
220
|
# Initialize issue list hash
|
214
221
|
_issue_list = Hash.new()
|
@@ -227,7 +234,7 @@ module Watson
|
|
227
234
|
# Find any comment line with [tag] - text (any comb of space and # acceptable)
|
228
235
|
# Using if match to stay consistent (with config.rb) see there for
|
229
236
|
# explanation of why I do this (not a good good one persay...)
|
230
|
-
_mtch = _line.
|
237
|
+
_mtch = _line.match(/^[#{ _comment_type }+?\s+?]+\[(\w+)\]\s+-\s+(.+)/)
|
231
238
|
if !_mtch
|
232
239
|
debug_print "No valid tag found in line, skipping\n"
|
233
240
|
next
|
@@ -378,9 +385,17 @@ module Watson
|
|
378
385
|
".java", ".class", ".cs", ".js", ".php"
|
379
386
|
debug_print "Comment type is: //\n"
|
380
387
|
return "//"
|
388
|
+
|
389
|
+
when ".hs"
|
390
|
+
debug_print "Comment type is: --\n"
|
391
|
+
return "--"
|
392
|
+
|
393
|
+
when ".erl"
|
394
|
+
debug_print "Comment type is: %\n"
|
395
|
+
return "%"
|
381
396
|
|
382
397
|
# Bash, Ruby, Perl, Python
|
383
|
-
when ".sh", ".rb", ".pl", ".py"
|
398
|
+
when ".sh", ".rb", ".pl", ".py", ".coffee"
|
384
399
|
debug_print "Comment type is: #\n"
|
385
400
|
return "#"
|
386
401
|
|
data/lib/watson/version.rb
CHANGED
data/spec/parser_spec.rb
CHANGED
@@ -22,6 +22,10 @@ describe Parser do
|
|
22
22
|
@parser.get_comment_type('lib/watson.rb').should eql '#'
|
23
23
|
end
|
24
24
|
|
25
|
+
it 'return correct extension (# for coffee)' do
|
26
|
+
@parser.get_comment_type('lib/watson.coffee').should eql '#'
|
27
|
+
end
|
28
|
+
|
25
29
|
it 'return correct extension (// for c/c++)' do
|
26
30
|
@parser.get_comment_type('lib/watson.cpp').should eql '//'
|
27
31
|
end
|