punchlist 0.0.2 → 1.0.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 +20 -12
- data/lib/punchlist/options.rb +33 -0
- data/lib/punchlist/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b24e5a71761e3b922d69c22ecc75f783b5a1e52
|
4
|
+
data.tar.gz: 774499da75a38f680a5b8576ae46a89ed33c9f33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0464696dabb58e2936812720133e0287a5ffa13c806c44ba946860c48f8fec76176ba57db05f2265003945039345c003850dbd260de919074c2163e375701ebe
|
7
|
+
data.tar.gz: f56075dc8576ae3121bb4263545bb46aac9d8a4c128df19c28f47f3a7f37b71f89186fa6c9e760c15969d8d57871fb5aea99409e31a2714a71368c596b385e61
|
data/bin/punchlist
CHANGED
data/lib/punchlist.rb
CHANGED
@@ -1,26 +1,23 @@
|
|
1
|
+
require_relative 'punchlist/options'
|
2
|
+
|
1
3
|
# XXX: need to include BUG in list
|
2
4
|
# XXX: need to include BUG in my rubocop config
|
3
5
|
# BUG need to fix the fact that we create blank lines on files with no issues
|
4
6
|
module Punchlist
|
5
7
|
# Counts the number of 'todo' comments in your code.
|
6
8
|
class Punchlist
|
7
|
-
def initialize(
|
8
|
-
outputter: STDOUT,
|
9
|
+
def initialize(outputter: STDOUT,
|
9
10
|
globber: Dir,
|
10
|
-
file_opener: File
|
11
|
-
|
11
|
+
file_opener: File,
|
12
|
+
options_parser: Options.new(default_punchlist_line_regexp))
|
12
13
|
@outputter = outputter
|
13
14
|
@globber = globber
|
14
15
|
@file_opener = file_opener
|
16
|
+
@options_parser = options_parser
|
15
17
|
end
|
16
18
|
|
17
19
|
def run
|
18
|
-
|
19
|
-
@source_files_glob = @args[1]
|
20
|
-
elsif @args[0]
|
21
|
-
@outputter.puts "USAGE: punchlist\n"
|
22
|
-
return 0 # XXX: need to vary return based on good or bad arguments
|
23
|
-
end
|
20
|
+
@options = @options_parser.parse_options
|
24
21
|
|
25
22
|
analyze_files
|
26
23
|
|
@@ -28,7 +25,7 @@ module Punchlist
|
|
28
25
|
end
|
29
26
|
|
30
27
|
def source_files_glob
|
31
|
-
@
|
28
|
+
@options[:glob] ||
|
32
29
|
'{app,lib,test,spec,feature}/**/*.{rb,swift,scala,js,cpp,c,java,py}'
|
33
30
|
end
|
34
31
|
|
@@ -44,10 +41,21 @@ module Punchlist
|
|
44
41
|
@globber.glob(source_files_glob)
|
45
42
|
end
|
46
43
|
|
47
|
-
def
|
44
|
+
def default_punchlist_line_regexp
|
48
45
|
/XXX|TODO/
|
49
46
|
end
|
50
47
|
|
48
|
+
def punchlist_line_regexp
|
49
|
+
return @regexp if @regexp
|
50
|
+
|
51
|
+
regexp_string = @options[:regexp]
|
52
|
+
if regexp_string
|
53
|
+
@regexp = Regexp.new(regexp_string)
|
54
|
+
else
|
55
|
+
default_punchlist_line_regexp
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
51
59
|
def look_for_punchlist_items(filename)
|
52
60
|
lines = []
|
53
61
|
line_num = 0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Punchlist
|
4
|
+
class Options
|
5
|
+
attr_reader :default_punchlist_line_regexp
|
6
|
+
|
7
|
+
def initialize(default_punchlist_line_regexp)
|
8
|
+
@default_punchlist_line_regexp = default_punchlist_line_regexp
|
9
|
+
end
|
10
|
+
|
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
|
17
|
+
opts.on('-r', '--regexp r',
|
18
|
+
'Regexp to trigger on - ' \
|
19
|
+
'default is XXX|TODO') do |v|
|
20
|
+
options[:regexp] = v
|
21
|
+
end
|
22
|
+
options
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_options
|
26
|
+
options = nil
|
27
|
+
OptionParser.new do |opts|
|
28
|
+
options = setup_options(opts)
|
29
|
+
end.parse!
|
30
|
+
options
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/punchlist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punchlist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.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-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- Rakefile
|
94
94
|
- bin/punchlist
|
95
95
|
- lib/punchlist.rb
|
96
|
+
- lib/punchlist/options.rb
|
96
97
|
- lib/punchlist/version.rb
|
97
98
|
- punchlist.gemspec
|
98
99
|
homepage: http://github.com/apiology/punchlist
|