punchlist 1.0.0 → 1.1.0

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: 6b24e5a71761e3b922d69c22ecc75f783b5a1e52
4
- data.tar.gz: 774499da75a38f680a5b8576ae46a89ed33c9f33
3
+ metadata.gz: 1b55daebbda4fa31c4a30fc093c1ae858ef627e9
4
+ data.tar.gz: 7b8ccb20957e194e5d00a9624d653112b0ae3b47
5
5
  SHA512:
6
- metadata.gz: 0464696dabb58e2936812720133e0287a5ffa13c806c44ba946860c48f8fec76176ba57db05f2265003945039345c003850dbd260de919074c2163e375701ebe
7
- data.tar.gz: f56075dc8576ae3121bb4263545bb46aac9d8a4c128df19c28f47f3a7f37b71f89186fa6c9e760c15969d8d57871fb5aea99409e31a2714a71368c596b385e61
6
+ metadata.gz: c7d1747d4ce4a85fa0834692b4e196a2f298ec8afd1a733a260812926bc81ed9d798e2762c26979a00ffbbbcb6c36dce4e635a31e407d4ad6fe711cf8aa07f22
7
+ data.tar.gz: f005b8d0bc9c58fe89c193840535e94bd3396c84c4e657c947de4628ea60a0469c588134849ea7b892b262c4149bed1d3a72d377171a4b307ac4326070dd2bc4
data/bin/punchlist CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative '../lib/punchlist'
4
4
 
5
- Punchlist::Punchlist.new.run
5
+ Punchlist::Punchlist.new(ARGV).run
data/lib/punchlist.rb CHANGED
@@ -6,14 +6,16 @@ require_relative 'punchlist/options'
6
6
  module Punchlist
7
7
  # Counts the number of 'todo' comments in your code.
8
8
  class Punchlist
9
- def initialize(outputter: STDOUT,
10
- globber: Dir,
9
+ def initialize(args,
10
+ outputter: STDOUT,
11
11
  file_opener: File,
12
- options_parser: Options.new(default_punchlist_line_regexp))
12
+ options_parser: Options.new(args),
13
+ source_file_globber: SourceFinder::SourceFileGlobber.new)
14
+ @args = args
13
15
  @outputter = outputter
14
- @globber = globber
15
16
  @file_opener = file_opener
16
17
  @options_parser = options_parser
18
+ @source_file_globber = source_file_globber
17
19
  end
18
20
 
19
21
  def run
@@ -24,11 +26,6 @@ module Punchlist
24
26
  0
25
27
  end
26
28
 
27
- def source_files_glob
28
- @options[:glob] ||
29
- '{app,lib,test,spec,feature}/**/*.{rb,swift,scala,js,cpp,c,java,py}'
30
- end
31
-
32
29
  def analyze_files
33
30
  all_output = []
34
31
  source_files.each do |filename|
@@ -38,7 +35,13 @@ module Punchlist
38
35
  end
39
36
 
40
37
  def source_files
41
- @globber.glob(source_files_glob)
38
+ if @options[:glob]
39
+ @source_file_globber.source_files_glob = @options[:glob]
40
+ end
41
+ if @options[:exclude]
42
+ @source_file_globber.source_files_exclude_glob = @options[:exclude]
43
+ end
44
+ @source_file_globber.source_files
42
45
  end
43
46
 
44
47
  def default_punchlist_line_regexp
@@ -1,24 +1,30 @@
1
1
  require 'optparse'
2
+ require 'source_finder/option_parser'
2
3
 
3
4
  module Punchlist
5
+ # Parse command line options
4
6
  class Options
5
7
  attr_reader :default_punchlist_line_regexp
6
8
 
7
- def initialize(default_punchlist_line_regexp)
8
- @default_punchlist_line_regexp = default_punchlist_line_regexp
9
+ def initialize(args,
10
+ source_finder_option_parser: SourceFinder::OptionParser.new)
11
+ @args = args
12
+ @source_finder_option_parser = source_finder_option_parser
9
13
  end
10
14
 
11
- def setup_options(opts)
12
- options = {}
13
- opts.banner = 'Usage: punchlist [options]'
14
- opts.on('-g', '--glob g', 'Filename glob to identify source files') do |v|
15
- options[:glob] = v
16
- end
15
+ def parse_regexp(opts, options)
17
16
  opts.on('-r', '--regexp r',
18
17
  'Regexp to trigger on - ' \
19
18
  'default is XXX|TODO') do |v|
20
19
  options[:regexp] = v
21
20
  end
21
+ end
22
+
23
+ def setup_options(opts)
24
+ options = {}
25
+ opts.banner = 'Usage: punchlist [options]'
26
+ @source_finder_option_parser.add_options(opts, options)
27
+ parse_regexp(opts, options)
22
28
  options
23
29
  end
24
30
 
@@ -26,7 +32,7 @@ module Punchlist
26
32
  options = nil
27
33
  OptionParser.new do |opts|
28
34
  options = setup_options(opts)
29
- end.parse!
35
+ end.parse!(@args)
30
36
  options
31
37
  end
32
38
  end
@@ -1,5 +1,5 @@
1
1
  # Counts the number of 'todo' comments in your code ('Comment
2
2
  # annotations').
3
3
  module Punchlist
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
data/punchlist.gemspec CHANGED
@@ -26,6 +26,8 @@ Gem::Specification.new do |s|
26
26
  s.rubygems_version = '1.3.6'
27
27
  s.summary = 'Finds largest source files in a project'
28
28
 
29
+ s.add_dependency('source_finder')
30
+
29
31
  s.add_development_dependency('bundler')
30
32
  s.add_development_dependency('rake')
31
33
  s.add_development_dependency('quality')
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punchlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-27 00:00:00.000000000 Z
11
+ date: 2015-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: source_finder
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement