punchlist 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/bin/punchlist +1 -1
- data/lib/punchlist.rb +13 -10
- data/lib/punchlist/options.rb +15 -9
- data/lib/punchlist/version.rb +1 -1
- data/punchlist.gemspec +2 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b55daebbda4fa31c4a30fc093c1ae858ef627e9
|
4
|
+
data.tar.gz: 7b8ccb20957e194e5d00a9624d653112b0ae3b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d1747d4ce4a85fa0834692b4e196a2f298ec8afd1a733a260812926bc81ed9d798e2762c26979a00ffbbbcb6c36dce4e635a31e407d4ad6fe711cf8aa07f22
|
7
|
+
data.tar.gz: f005b8d0bc9c58fe89c193840535e94bd3396c84c4e657c947de4628ea60a0469c588134849ea7b892b262c4149bed1d3a72d377171a4b307ac4326070dd2bc4
|
data/bin/punchlist
CHANGED
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(
|
10
|
-
|
9
|
+
def initialize(args,
|
10
|
+
outputter: STDOUT,
|
11
11
|
file_opener: File,
|
12
|
-
options_parser: Options.new(
|
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
|
-
@
|
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
|
data/lib/punchlist/options.rb
CHANGED
@@ -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(
|
8
|
-
|
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
|
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
|
data/lib/punchlist/version.rb
CHANGED
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.
|
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-
|
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
|