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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e259712548f8143e04fdc705826079d117c2bca8
4
- data.tar.gz: 04a88b96d2cee31d9e4e3973efbd97c759f35f40
3
+ metadata.gz: 10ae77dd595d9633a9271d965b2f8191da9898cc
4
+ data.tar.gz: 02a36f184b42910363cdd1b57e695f149c881ad0
5
5
  SHA512:
6
- metadata.gz: 1ca49dea0ba4c645f0760cb1f2955825bb5fc1e03228346bc9a5fe8b8d7a11f5bc7ec5d29f64f2d62e9d5629bfa62c65491da5c967a6a67782f5e40f4192926c
7
- data.tar.gz: 98f377612932aab8f82fd8b0bbefa781bf42efbe990ac20bfdf4a30c5b324928f63b9c433e0457832a42827c8013611ecb4b9dda6d12365be0c1cd420f355459
6
+ metadata.gz: 273fd1551dd683e9adac30bc97065fddfaf5a7ce15331a423329442d37a9f9d14e8ac2f9c676744ed6464b1c1d99972abaaf67106e2684c63ec4489498773774
7
+ data.tar.gz: b17a2561393a606ac5a33d5353b48b4614eafbe5853d8e7b382614209a40ca3200c5cab27f2cd3ab195daecde77f737d5afa519f3df8de9d78f9c5dfd5791935
@@ -8,13 +8,28 @@ module Sloc
8
8
  end
9
9
 
10
10
  def run(args = ARGV)
11
- @options, paths = parse_options(args)
11
+ setup(args)
12
+ if help?
13
+ puts help
14
+ else
15
+ puts @runner.run(@paths)
16
+ end
17
+ end
12
18
 
13
- return help if paths.empty? || @options[:help]
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
- runner = Runner.new(@options)
28
+ def setup(args)
29
+ @options, @paths = parse_options(args)
30
+ @runner = Runner.new(@options)
16
31
 
17
- runner.run(paths)
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
- def help
32
- puts @options
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
@@ -8,14 +8,17 @@ module Sloc
8
8
  end
9
9
 
10
10
  def run(paths)
11
- # TODO: formatted output
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
@@ -1,3 +1,3 @@
1
1
  module Sloc
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sloc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - meganemura