watson-ruby 1.6.2 → 1.6.3

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
  SHA1:
3
- metadata.gz: 514fedab81cf81f62c7a4fb415d83750ebf05ad5
4
- data.tar.gz: 4b63e079270286b0fd7bea2a3d1a5fc3e17310ff
3
+ metadata.gz: b8a024874dc8eeea248cbe763168012a330e18c8
4
+ data.tar.gz: ace9f356ed3afa6ca4e569c02796c0b09a4b485d
5
5
  SHA512:
6
- metadata.gz: db6f2c055827b284eb40682f5bb137c7ee21cbdb85dde8924f3a2653c9f334922f6493af9c974d603957b0d3901cbd3f80fa31b84ebf8ef0be7a95dcd243dc10
7
- data.tar.gz: 14a2b0d85756bb5357c49de86029be86d6a467f955d687af9269326049196809d16d342cc41b49de1dd6ad22ba65ae3924c3923245c60b63eba82aba94a9ff9e
6
+ metadata.gz: 54fb65d9d2cf0b41109cca529045a41aa0e0db0d8885dd919174df8cb2356b8e87e522db58594c01d416dc51d513f90d8f11ed4196d166e8aec51cec51d27142
7
+ data.tar.gz: 8e1522e949c5f4f7dc8b13e63ac760eb41121826333803157faf4b3b97735d677184e3e67284dc9273ac67455869299e10253dfed9eeb89b7690cdceefdfd763
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watson-ruby (1.6.2)
4
+ watson-ruby (1.6.3)
5
5
  json
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -70,6 +70,7 @@ submit a pull request (comment parsing happens in **lib/watson/paser.rb**)
70
70
  - **HTML**
71
71
  - **Emacslisp**
72
72
  - **LaTex**
73
+ - **Handlebars**
73
74
 
74
75
 
75
76
  ## Command line arguments
@@ -172,6 +172,8 @@ module Watson
172
172
  @config.run
173
173
  structure = @parser.run
174
174
  @printer.run(structure)
175
+
176
+ print RESET;
175
177
  end
176
178
 
177
179
 
@@ -251,6 +253,9 @@ module Watson
251
253
  return false
252
254
  end
253
255
 
256
+ # Set config flag for CL context_set in config
257
+ @config.cl_context_set = true
258
+ debug_print "Updated cl_context_set flag: #{ @config.cl_context_set }\n"
254
259
 
255
260
  # For context_depth we do NOT append to RC, ALWAYS overwrite
256
261
  # For each argument passed, make sure valid, then set @config.parse_depth
@@ -393,6 +398,10 @@ module Watson
393
398
  return false
394
399
  end
395
400
 
401
+ # Set config flag for CL parse_set in config
402
+ @config.cl_parse_set = true
403
+ debug_print "Updated cl_parse_set flag: #{ @config.cl_parse_set }\n"
404
+
396
405
  # For max_dpeth we do NOT append to RC, ALWAYS overwrite
397
406
  # For each argument passed, make sure valid, then set @config.parse_depth
398
407
  args.each do | _parse_depth |
@@ -539,6 +548,10 @@ module Watson
539
548
  return false
540
549
  end
541
550
 
551
+ # Set config flag for CL tag set in config
552
+ @config.cl_output_set = true
553
+ debug_print "Updated cl_output_set flag: #{ @config.cl_output_set }\n"
554
+
542
555
  @config.output_format = case args.pop.to_s
543
556
  when 'j', 'json'
544
557
  Watson::Formatters::JsonFormatter
@@ -546,6 +559,8 @@ module Watson
546
559
  Watson::Formatters::UniteFormatter
547
560
  when 'silent'
548
561
  Watson::Formatters::SilentFormatter
562
+ when 'nocolor'
563
+ Watson::Formatters::NoColorFormatter
549
564
  else
550
565
  Watson::Formatters::DefaultFormatter
551
566
  end
@@ -568,6 +583,10 @@ module Watson
568
583
  return false
569
584
  end
570
585
 
586
+ # Set config flag for CL tag set in config
587
+ @config.cl_show_set = true
588
+ debug_print "Updated cl_show_set flag: #{ @config.cl_show_set }\n"
589
+
571
590
  args.each do | _show |
572
591
  case _show.downcase
573
592
  when 'clean'
@@ -47,6 +47,14 @@ module Watson
47
47
  attr_accessor :cl_ignore_set
48
48
  # Flag for command line setting of tag to parse for
49
49
  attr_accessor :cl_tag_set
50
+ # Flag for command line setting of showtype
51
+ attr_accessor :cl_show_set
52
+ # Flag for command line setting of output format
53
+ attr_accessor :cl_output_set
54
+ # Flag for command line setting of context depth
55
+ attr_accessor :cl_context_set
56
+ # Flag for command line setting of parse depth
57
+ attr_accessor :cl_parse_set
50
58
 
51
59
  # Entries that watson should show
52
60
  attr_accessor :show_type
@@ -130,9 +138,11 @@ module Watson
130
138
  @context_depth = 15
131
139
 
132
140
  # State flags
133
- @cl_entry_set = false
134
- @cl_tag_set = false
135
- @cl_ignore_set = false
141
+ @cl_entry_set = false
142
+ @cl_tag_set = false
143
+ @cl_ignore_set = false
144
+ @cl_show_set = false
145
+ @cl_output_set = false
136
146
 
137
147
  @show_type = 'all'
138
148
 
@@ -183,7 +193,8 @@ module Watson
183
193
  @asana_issues = Hash.new()
184
194
 
185
195
 
186
- @output_format = Watson::Formatters::DefaultFormatter
196
+ @output_format = STDOUT.tty? ? Watson::Formatters::DefaultFormatter :
197
+ Watson::Formatters::NoColorFormatter
187
198
 
188
199
 
189
200
  end
@@ -362,15 +373,29 @@ module Watson
362
373
 
363
374
  case _section
364
375
  when "context_depth"
376
+ # If set from command line, ignore config file
377
+ if @cl_context_set
378
+ debug_print "Directories or files set from command line ignoring rc [context_depth]\n"
379
+ next
380
+ end
381
+
365
382
  # No need for regex on context value, command should read this in only as a #
366
383
  # Chomp to get rid of any nonsense
367
384
  @context_depth = _line.chomp!.to_i
385
+ debug_print "@context_depth --> #{ @context_depth }\n"
368
386
 
369
387
 
370
388
  when "parse_depth"
389
+ # If set from command line, ignore config file
390
+ if @cl_parse_set
391
+ debug_print "Directories or files set from command line ignoring rc [parse_depth]\n"
392
+ next
393
+ end
394
+
371
395
  # No need for regex on parse value, command should read this in only as a #
372
396
  # Chomp to get rid of any nonsense
373
397
  @parse_depth = _line.chomp!
398
+ debug_print "@parse_depth --> #{ @parse_depth }\n"
374
399
 
375
400
 
376
401
  when "dirs"
@@ -393,6 +418,36 @@ module Watson
393
418
  debug_print "@dir_list --> #{ @dir_list }\n"
394
419
 
395
420
 
421
+ when "output_format"
422
+ if @cl_output_set
423
+ debug_print "Output type set from command line, ignoring rc [output_format]\n"
424
+ next
425
+ end
426
+
427
+ # Set default output format for printing
428
+ _output = _line.chomp!
429
+
430
+ @output_format = case _output.downcase
431
+ when 'json'
432
+ debug_print "Output format set to JSON\n"
433
+ Watson::Formatters::JsonFormatter
434
+ when 'unite'
435
+ debug_print "Output format set to Unite\n"
436
+ Watson::Formatters::UniteFormatter
437
+ when 'silent'
438
+ debug_print "Output format set to Silent\n"
439
+ Watson::Formatters::SilentFormatter
440
+ when 'nocolor'
441
+ debug_print "Output format set to NoColor\n"
442
+ Watson::Formatters::NoColorFormatter
443
+ else
444
+ debug_print "Output format set to default (color or nocolor depending on tty)\n"
445
+ STDOUT.tty? ? Watson::Formatters::DefaultFormatter :
446
+ Watson::Formatters::NoColorFormatter
447
+ end
448
+
449
+ debug_print "@output_format --> #{ @output_format }\n"
450
+
396
451
  when "tags"
397
452
  # Same as previous for tags
398
453
  # [review] - Populate @tag_list, then check size instead
@@ -414,7 +469,7 @@ module Watson
414
469
 
415
470
  when "tag_format"
416
471
  @tag_format = _line.chomp!
417
- debug_print @tag_format
472
+ debug_print "@tag_format --> #{ @tag_format }\n"
418
473
 
419
474
  when "type"
420
475
  # Regex to grab ".type" => ["param1", "param2"]
@@ -425,16 +480,17 @@ module Watson
425
480
  @type_list[_ext] = _type
426
481
  end
427
482
 
483
+ deug_print "@type_list --> #{ @type_list }\n"
428
484
 
429
- when "ignore"
430
- # Same as previous for ignores
431
- # [review] - Populate @tag_list, then check size instead
432
485
 
486
+ when "ignore"
433
487
  if @cl_ignore_set
434
488
  debug_print "Ignores set from command line, ignoring rc [ignores]\n"
435
489
  next
436
490
  end
437
491
 
492
+ # Same as previous for ignores
493
+ # [review] - Populate @tag_list, then check size instead
438
494
  # Convert each ignore into a regex
439
495
  # Grab ignore and remove leading ./ and trailing /
440
496
  _mtch = _line.match(/^(\.\/)?(\S+)/)[0].gsub(/\/$/, '')
@@ -449,8 +505,12 @@ module Watson
449
505
 
450
506
 
451
507
  when "show_type"
452
- # No need for parsing, just check case
508
+ if @cl_show_set
509
+ debug_print "Show type set from command line, ignoring rc [show_type]\n"
510
+ next
511
+ end
453
512
 
513
+ # No need for parsing, just check case
454
514
  case _line.chomp.downcase
455
515
  when "clean"
456
516
  @show_type = "clean"
@@ -463,9 +523,10 @@ module Watson
463
523
  else
464
524
  @show_type = "all"
465
525
  debug_print "@show_type set to \"all\" from config\n"
466
-
467
526
  end
468
527
 
528
+ debug_print "@show_type --> #{ @show_type }\n"
529
+
469
530
 
470
531
  # Project directories reference $HOME/.watsonrc for GitHub API token
471
532
  # If we don't find a username=token format string, use username
@@ -4,4 +4,5 @@ module Watson::Formatters
4
4
  autoload :JsonFormatter, 'watson/formatters/json_formatter'
5
5
  autoload :UniteFormatter, 'watson/formatters/unite_formatter'
6
6
  autoload :SilentFormatter, 'watson/formatters/silent_formatter'
7
+ autoload :NoColorFormatter, 'watson/formatters/nocolor_formatter'
7
8
  end
@@ -0,0 +1,198 @@
1
+ module Watson::Formatters
2
+ class NoColorFormatter < BaseFormatter
3
+ def initialize(config)
4
+ super
5
+
6
+ @output = STDOUT
7
+ end
8
+
9
+ def run(structure)
10
+ debug_print "#{self} : #{__method__}\n"
11
+
12
+ output_result do
13
+ # Check Config to see if we have access to less for printing
14
+ # If so, open our temp file as the output to write to
15
+ # Else, just print out to STDOUT
16
+ # Print header for output
17
+ debug_print "Printing Header\n"
18
+
19
+ print_header
20
+
21
+ # Print out structure that was passed to this Printer
22
+ debug_print "Starting structure printing\n"
23
+ print_structure(structure)
24
+ end
25
+ end
26
+
27
+ ###########################################################
28
+ # Standard header print for class call (uses member cprint)
29
+ def print_header
30
+ # Identify method entry
31
+ debug_print "#{ self } : #{ __method__ }\n"
32
+
33
+ # Header
34
+ cprint <<-MESSAGE.gsub(/^(\s+)/, '')
35
+ ------------------------------
36
+ watson - inline issue manager\n
37
+
38
+ Run in: #{Dir.pwd}
39
+ Run @ #{Time.now.asctime}
40
+ ------------------------------\n
41
+ MESSAGE
42
+ end
43
+
44
+ ###########################################################
45
+ # Status printer for member call (uses member cprint)
46
+ # Print status block in standard format
47
+ def print_status(msg)
48
+ cprint "[ #{msg} ]"
49
+ end
50
+
51
+ private
52
+
53
+ def output_result(&block)
54
+ debug_print "#{self} : #{__method__}\n"
55
+ @output = if @config.use_less
56
+ debug_print "Unix less avaliable, setting output to #{@config.tmp_file}\n"
57
+ File.open(@config.tmp_file, 'w')
58
+ else
59
+ debug_print "Unix less is unavaliable, setting output to STDOUT\n"
60
+ STDOUT
61
+ end
62
+
63
+ yield
64
+
65
+ # If we are using less, close the output file, display with less, then delete
66
+ if @config.use_less
67
+ @output.close
68
+ # [review] - Way of calling a native Ruby less?
69
+ system("less -R #{@config.tmp_file}")
70
+ debug_print "File displayed with less, now deleting...\n"
71
+ File.delete(@config.tmp_file)
72
+ end
73
+ end
74
+
75
+ ###########################################################
76
+ # Go through all files and directories and call necessary printing methods
77
+ # Print all individual entries, call print_structure on each subdir
78
+ def print_structure(structure)
79
+ # Identify method entry
80
+ debug_print "#{self} : #{__method__}\n"
81
+
82
+ # First go through all the files in the current structure
83
+ # The current "structure" should reflect a dir/subdir
84
+ structure[:files].each do |file|
85
+ debug_print "Printing info for #{file}\n"
86
+ print_entry(file)
87
+ end
88
+
89
+ # Next go through all the subdirs and pass them to print_structure
90
+ structure[:subdirs].each do |subdir|
91
+ debug_print "Entering #{subdir} to print further\n"
92
+ print_structure(subdir)
93
+ end
94
+ end
95
+
96
+ ###########################################################
97
+ # Individual entry printer
98
+ # Uses issue hash to format printed output
99
+ def print_entry(entry)
100
+ # Identify method entry
101
+ debug_print "#{self} : #{__method__}\n"
102
+
103
+ # If no issues for this file, print that and break
104
+ # The filename print is repetative, but reduces another check later
105
+ if entry[:has_issues]
106
+ return true if @config.show_type == 'clean'
107
+
108
+ debug_print "Issues found for #{entry}\n"
109
+ cprint "\n"
110
+ print_status 'x'
111
+ cprint " #{entry[:relative_path]}\n"
112
+ else
113
+ unless @config.show_type == 'dirty'
114
+ debug_print "No issues for #{entry}\n"
115
+ print_status 'o'
116
+ cprint " #{entry[:relative_path]}\n"
117
+ return true
118
+ end
119
+ end
120
+
121
+ # [review] - Should the tag structure be self contained in the hash
122
+ # Or is it ok to reference @config to figure out the tags
123
+ @config.tag_list.each do | tag |
124
+ debug_print "Checking for #{ tag }\n"
125
+ print_tag(tag, entry)
126
+ end
127
+ end
128
+
129
+ def print_tag(tag, entry)
130
+ # [review] - Better way to ignore tags through structure (hash) data
131
+ # Maybe have individual has_issues for each one?
132
+ if entry[tag].size.zero?
133
+ debug_print "#{ tag } has no issues, skipping\n"
134
+ return
135
+ end
136
+
137
+ debug_print "#{tag} has issues in it, print!\n"
138
+ print_status "#{tag}"
139
+ cprint "\n"
140
+
141
+ # Go through each issue in tag
142
+ entry[tag].each do |issue|
143
+ cprint " line #{issue[:line_number]} - #{issue[:title]} "
144
+
145
+
146
+ # If there are any remote issues, print status and issue #
147
+ if _GH = @config.github_issues[issue[:md5]]
148
+ debug_print "Found #{ issue[:title]} in remote issues\n"
149
+
150
+ cprint <<-MESSAGE.gsub(/^(\s+)/, '').chomp
151
+ [GH##{_GH[:id]}]
152
+ MESSAGE
153
+ end
154
+
155
+ if _BB = @config.bitbucket_issues[issue[:md5]]
156
+ debug_print "Found #{ issue[:title]} in remote issues\n"
157
+
158
+ cprint <<-MESSAGE.gsub(/^(\s+)/, '').chomp
159
+ [BB##{_BB[:id]}]
160
+ MESSAGE
161
+ end
162
+
163
+
164
+ if _GL = @config.gitlab_issues[issue[:md5]]
165
+ debug_print "Found #{ issue[:title]} in remote issues\n"
166
+
167
+ cprint <<-MESSAGE.gsub(/^(\s+)/, '').chomp
168
+ [GL##{_GL[:id]}]
169
+ MESSAGE
170
+ end
171
+
172
+ if _AS = @config.asana_issues[issue[:md5]]
173
+ debug_print "Found #{ issue[:title]} in remote issues\n"
174
+ completed = _AS[:state]
175
+
176
+ cprint <<-MESSAGE.gsub(/^(\s+)/, '').chomp
177
+ [AS##{_AS[:id]}]
178
+ MESSAGE
179
+ end
180
+
181
+
182
+ cprint "\n"
183
+ end
184
+
185
+ cprint "\n"
186
+ end
187
+
188
+ ###########################################################
189
+ # Custom color print for member call
190
+ # Allows not only for custom color printing but writing to file vs STDOUT
191
+ def cprint(msg)
192
+ # Identify method entry
193
+ debug_print "#{self} : #{__method__}\n"
194
+
195
+ @output.write(msg)
196
+ end
197
+ end
198
+ end
@@ -12,6 +12,56 @@ module Watson
12
12
  require 'digest'
13
13
  require 'pp'
14
14
 
15
+ COMMENT_DEFINITIONS = {
16
+ '.cpp' => ['//', '/*'], # C++
17
+ '.cxx' => ['//', '/*'],
18
+ '.cc' => ['//', '/*'],
19
+ '.hpp' => ['//', '/*'],
20
+ '.hxx' => ['//', '/*'],
21
+ '.c' => ['//', '/*'], # C
22
+ '.h' => ['//', '/*'],
23
+ '.java' => ['//', '/*', '/**'], # Java
24
+ '.class' => ['//', '/*', '/**'],
25
+ '.cs' => ['//', '/*'], # C#
26
+ '.scss' => ['//', '/*'], # SASS SCSS
27
+ '.sass' => ['//', '/*'], # SASS SCSS
28
+ '.js' => ['//', '/*'], # JavaScript
29
+ '.php' => ['//', '/*', '#'], # PHP
30
+ '.m' => ['//', '/*'], # ObjectiveC
31
+ '.mm' => ['//', '/*'],
32
+ '.go' => ['//', '/*'], # Go(lang)
33
+ '.scala' => ['//', '/*'], # Scala
34
+ '.erl' => ['%%', '%'], # Erlang
35
+ '.f' => ['!'], # Fortran
36
+ '.f90' => ['!'], # Fortran
37
+ '.F' => ['!'], # Fortran
38
+ '.F90' => ['!'], # Fortran
39
+ '.hs' => ['--'], # Haskell
40
+ '.sh' => ['#'], # Bash
41
+ '.rb' => ['#'], # Ruby
42
+ '.haml' => ['-#'], # Haml
43
+ '.pl' => ['#'], # Perl
44
+ '.pm' => ['#'],
45
+ '.t' => ['#'],
46
+ '.py' => ['#'], # Python
47
+ '.coffee' => ['#'], # CoffeeScript
48
+ '.zsh' => ['#'], # Zsh
49
+ '.clj' => [';;'], # Clojure
50
+ '.sql' => ['---', '//', '#' ], # SQL and PL types
51
+ '.lua' => ['--', '--[['], # Lua
52
+ '.vim' => ['"'], # VimL
53
+ '.md' => ['<!--'], # Markdown
54
+ '.html' => ['<!--'], # HTML
55
+ '.el' => [';'], # Emacslisp
56
+ '.sqf' => ['//','/*'], # SQF
57
+ '.sqs' => [';'], # SQS
58
+ '.d' => ['//','/*'], # D
59
+ '.tex' => ['%'], # LaTex
60
+ '.hbs' => ['{{!--'], # Handlebars
61
+ '.twig' => ['{#'] # Twig
62
+ }.freeze
63
+
64
+
15
65
  ###########################################################
16
66
  # Initialize the parser with the current watson config
17
67
  def initialize(config)
@@ -269,9 +319,9 @@ module Watson
269
319
  _issue_list[:has_issues] = true
270
320
 
271
321
  # [review] - This could probably be done better, elsewhere!
272
- # If it's a HTML comment, remove trailing -->
273
- if _mtch[0].match(/<!--/)
274
- _title = _mtch[2].gsub(/-->/, "")
322
+ # If it's a HTML or Handlebars comment, remove trailing -->, --}}
323
+ if _mtch[0].match(/[<{]+(!--)?(#)?/)
324
+ _title = _mtch[2].gsub(/(--)?(#)?[>}]+/, "")
275
325
  else
276
326
  _title = _mtch[2]
277
327
  end
@@ -365,88 +415,16 @@ module Watson
365
415
  # Identify method entry
366
416
  debug_print "#{ self } : #{ __method__ }\n"
367
417
 
368
- # Grab the file extension (.something)
369
- # Check to see whether it is recognized and set comment type
370
- # If unrecognized, try to grab the next .something extension
371
- # This is to account for file.cpp.1 or file.cpp.bak, ect
372
-
373
- # [review] - Matz style while loop a la http://stackoverflow.com/a/10713963/1604424
374
- # Create _mtch var so we can access it outside of the do loop
375
-
376
-
377
-
378
- _ext = { '.cpp' => ['//', '/*'], # C++
379
- '.cxx' => ['//', '/*'],
380
- '.cc' => ['//', '/*'],
381
- '.hpp' => ['//', '/*'],
382
- '.hxx' => ['//', '/*'],
383
- '.c' => ['//', '/*'], # C
384
- '.h' => ['//', '/*'],
385
- '.java' => ['//', '/*', '/**'], # Java
386
- '.class' => ['//', '/*', '/**'],
387
- '.cs' => ['//', '/*'], # C#
388
- '.scss' => ['//', '/*'], # SASS SCSS
389
- '.sass' => ['//', '/*'], # SASS SCSS
390
- '.js' => ['//', '/*'], # JavaScript
391
- '.php' => ['//', '/*', '#'], # PHP
392
- '.m' => ['//', '/*'], # ObjectiveC
393
- '.mm' => ['//', '/*'],
394
- '.go' => ['//', '/*'], # Go(lang)
395
- '.scala' => ['//', '/*'], # Scala
396
- '.erl' => ['%%', '%'], # Erlang
397
- '.f' => ['!'], # Fortran
398
- '.f90' => ['!'], # Fortran
399
- '.F' => ['!'], # Fortran
400
- '.F90' => ['!'], # Fortran
401
- '.hs' => ['--'], # Haskell
402
- '.sh' => ['#'], # Bash
403
- '.rb' => ['#'], # Ruby
404
- '.pl' => ['#'], # Perl
405
- '.pm' => ['#'],
406
- '.t' => ['#'],
407
- '.py' => ['#'], # Python
408
- '.coffee' => ['#'], # CoffeeScript
409
- '.zsh' => ['#'], # Zsh
410
- '.clj' => [';;'], # Clojure
411
- '.sql' => ['---', '//', '#' ], # SQL and PL types
412
- '.lua' => ['--', '--[['], # Lua
413
- '.vim' => ['"'], # VimL
414
- '.md' => ['<!--'], # Markdown
415
- '.html' => ['<!--'], # HTML
416
- '.el' => [';'], # Emacslisp
417
- '.sqf' => ['//','/*'], # SQF
418
- '.sqs' => [';'], # SQS
419
- '.d' => ['//','/*'], # D
420
- '.tex' => ['%'] # LaTex
421
- }
422
-
423
418
  # Merge config file type list with defaults
424
- _ext.merge!(@config.type_list)
425
-
426
-
427
- loop do
428
- _mtch = filename.match(/(\.(\S+))$/)
429
- debug_print "Extension: #{ _mtch }\n"
430
-
431
- # Break if we don't find a match
432
- break if _mtch.nil?
419
+ _comments = COMMENT_DEFINITIONS.merge(@config.type_list)
433
420
 
434
- return _ext[_mtch[0]] if _ext.has_key?(_mtch[0])
421
+ # Grab all possible extensions, check for comment match in reverse order
422
+ # Return comment type if found in comment definitions, else false
423
+ filename.split('.')[1..-1].each { |_ext| return _comments['.' << _ext] if _comments.has_key?('.' << _ext) }
435
424
 
436
- # Can't recognize extension, keep looping in case of .bk, .#, ect
437
- filename = filename.gsub(/(\.(\S+))$/, '')
438
- debug_print "Didn't recognize, searching #{ filename }\n"
439
-
440
- end
441
-
442
- # We didn't find any matches from the filename, return error (0)
443
- # Deal with what default to use in calling method
444
- # [review] - Is Ruby convention to return 1 or 0 (or -1) on failure/error?
445
425
  debug_print "Couldn't find any recognized extension type\n"
446
426
  false
447
427
 
448
428
  end
449
-
450
-
451
429
  end
452
430
  end
@@ -1,3 +1,3 @@
1
1
  module Watson
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.3"
3
3
  end
@@ -93,6 +93,14 @@ describe Parser do
93
93
  it 'return correct extension (;; for clojure)' do
94
94
  @parser.get_comment_type('lib/watson.clj').should eql [';;']
95
95
  end
96
+
97
+ it 'return correct extension handlebars' do
98
+ @parser.get_comment_type('lib/watson.hbs').should eql ['{{!--']
99
+ end
100
+
101
+ it 'return correct extension jst handlebars' do
102
+ @parser.get_comment_type('lib/watson.jst.hbs').should eql ['{{!--']
103
+ end
96
104
  end
97
105
 
98
106
  context 'unknown extension' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watson-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nhmood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -78,6 +78,7 @@ files:
78
78
  - lib/watson/formatters/base_formatter.rb
79
79
  - lib/watson/formatters/default_formatter.rb
80
80
  - lib/watson/formatters/json_formatter.rb
81
+ - lib/watson/formatters/nocolor_formatter.rb
81
82
  - lib/watson/formatters/silent_formatter.rb
82
83
  - lib/watson/formatters/unite_formatter.rb
83
84
  - lib/watson/fs.rb