gry 0.5.2 → 0.6.0

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: 51dca108a879ab15814a5bfb9652896a2d756f54
4
- data.tar.gz: c7b6b4f41e85fe8e47c8809385b62648a7c3394b
3
+ metadata.gz: c3213ccb72d60bbf5223c9fd63e15ca683ccaec0
4
+ data.tar.gz: 8f40bd76b18081ac8b189dc68d175ea2f58fba33
5
5
  SHA512:
6
- metadata.gz: 15cb1282355c165843feebd74c3acfbb380b03a74d16974ca96984575379a1a2b121096cdb5fd43bb86e3163510d6e54167d4a446a09a2692039f73efe5578f3
7
- data.tar.gz: 84d836a98f0923a16247a4bc5699c64200201fde1732a58e8c48f45e9c3c75c7450a83c94afd79664419b2e33f581405522a16b07cedf64667acaa086282c60e
6
+ metadata.gz: b6607804a93edd5bf44b63465601036a7aa9bec0b1f04ad2274358b4e2ccd81f738de0148f0838899c8096e44cebcaf280c49e1609c47a8c46698d2cdbde01f8
7
+ data.tar.gz: 1889bd5270eaa078a266d60d55ae2e8f7936e7f133ee9b32b2813e0a4be3cb0b01a07d9f9230a2f67dd2533550c7aba5b3eecc46618a562704558e401fbce520
@@ -25,6 +25,10 @@ module Gry
25
25
  save_cache(b, cops)
26
26
  end
27
27
  end
28
+ if opt.raw
29
+ writer.puts JSON.generate(bills)
30
+ return
31
+ end
28
32
 
29
33
  congress = Congress.new(
30
34
  max_count: opt.max_count,
@@ -39,6 +43,8 @@ module Gry
39
43
  writer.puts fmt.format(laws)
40
44
  end
41
45
 
46
+ private
47
+
42
48
  def save_cache(bills, cops)
43
49
  Dir.mkdir(CACHE_DIR) unless CACHE_DIR.exist?
44
50
  cache = {
@@ -1,6 +1,6 @@
1
1
  module Gry
2
2
  class Option
3
- attr_reader :args, :process, :version, :fast, :max_count, :min_difference, :display_disabled_cops, :metrics_percentile, :cache
3
+ attr_reader :args, :process, :version, :fast, :max_count, :min_difference, :display_disabled_cops, :metrics_percentile, :cache, :raw
4
4
 
5
5
  def initialize(argv)
6
6
  opt = OptionParser.new
@@ -12,6 +12,7 @@ module Gry
12
12
  @display_disabled_cops = false
13
13
  @metrics_percentile = 95
14
14
  @cache = true
15
+ @raw = false
15
16
 
16
17
  opt.banner = 'Usage: gry [options] [Cop1, Cop2, ...]'
17
18
 
@@ -24,6 +25,7 @@ module Gry
24
25
  opt.on('--metrics-percentile=95', 'Percentile for allowed complex code') {|v| @metrics_percentile = v.to_i}
25
26
  opt.on('--display-disabled-cops', 'Display disabled cops') {|v| @display_disabled_cops = v}
26
27
  opt.on('--[no-]cache', 'Run gry with cache. Default: true') {|v| @cache = v}
28
+ opt.on('--raw', 'Display raw data(JSON). Default: false') {|v| @raw = v}
27
29
 
28
30
  @args = opt.parse(argv)
29
31
  end
@@ -1,3 +1,3 @@
1
1
  module Gry
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-08 00:00:00.000000000 Z
11
+ date: 2017-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler