sloc 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sloc/cli.rb +24 -6
- data/lib/sloc/runner.rb +6 -3
- data/lib/sloc/version.rb +1 -1
- 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: 10ae77dd595d9633a9271d965b2f8191da9898cc
|
4
|
+
data.tar.gz: 02a36f184b42910363cdd1b57e695f149c881ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 273fd1551dd683e9adac30bc97065fddfaf5a7ce15331a423329442d37a9f9d14e8ac2f9c676744ed6464b1c1d99972abaaf67106e2684c63ec4489498773774
|
7
|
+
data.tar.gz: b17a2561393a606ac5a33d5353b48b4614eafbe5853d8e7b382614209a40ca3200c5cab27f2cd3ab195daecde77f737d5afa519f3df8de9d78f9c5dfd5791935
|
data/lib/sloc/cli.rb
CHANGED
@@ -8,13 +8,28 @@ module Sloc
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run(args = ARGV)
|
11
|
-
|
11
|
+
setup(args)
|
12
|
+
if help?
|
13
|
+
puts help
|
14
|
+
else
|
15
|
+
puts @runner.run(@paths)
|
16
|
+
end
|
17
|
+
end
|
12
18
|
|
13
|
-
|
19
|
+
def report(args = ARGV)
|
20
|
+
setup(args)
|
21
|
+
if help?
|
22
|
+
help
|
23
|
+
else
|
24
|
+
@runner.report(@paths)
|
25
|
+
end
|
26
|
+
end
|
14
27
|
|
15
|
-
|
28
|
+
def setup(args)
|
29
|
+
@options, @paths = parse_options(args)
|
30
|
+
@runner = Runner.new(@options)
|
16
31
|
|
17
|
-
|
32
|
+
nil
|
18
33
|
end
|
19
34
|
|
20
35
|
def parse_options(args)
|
@@ -28,8 +43,11 @@ module Sloc
|
|
28
43
|
[opts, args]
|
29
44
|
end
|
30
45
|
|
31
|
-
|
32
|
-
|
46
|
+
attr_reader :options
|
47
|
+
alias_method :help, :options
|
48
|
+
|
49
|
+
def help?
|
50
|
+
@paths.empty? || @options[:help]
|
33
51
|
end
|
34
52
|
end
|
35
53
|
end
|
data/lib/sloc/runner.rb
CHANGED
@@ -8,14 +8,17 @@ module Sloc
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run(paths)
|
11
|
-
|
12
|
-
require 'pp'
|
13
|
-
pp report(paths)
|
11
|
+
report(paths)
|
14
12
|
|
15
13
|
nil
|
16
14
|
end
|
17
15
|
|
18
16
|
def report(paths)
|
17
|
+
require 'pp'
|
18
|
+
PP.pp(raw_report(paths), '')
|
19
|
+
end
|
20
|
+
|
21
|
+
def raw_report(paths)
|
19
22
|
target_files = find_target_files(paths)
|
20
23
|
|
21
24
|
# TODO: count sloc
|
data/lib/sloc/version.rb
CHANGED