kumogata 0.2.9 → 0.2.10

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: 9f3941d2e08255324b58a9db11ab3365d7fc4352
4
- data.tar.gz: a7de79d6681d01a8ff16176da2fcfae3aa75ccc0
3
+ metadata.gz: 7714e5c2958803eaaf35cc7abd7baf55966b77b5
4
+ data.tar.gz: d8527b89ff3c250ba7474b36c4ceb2cecf2f3380
5
5
  SHA512:
6
- metadata.gz: 754de61cabe8e01e4b9e2ba2a73859615fb43d8846d70a90ff19d04c25743e5494ca59dc92a662eb1380e1ec7b1bac868e41b0e9c7cf276e51410a164bf9c605
7
- data.tar.gz: 2d13045023a54b098dca9d11e94223066c6594947154b5f5b20be84f5c326d67d1762347db717e88c158f3467038dcb8e06ef2c52ed181478f9fcc840340c067
6
+ metadata.gz: 0f0bfed5c800a6151067419c9a680ef98b103c738c3e64444b29ca4e2401bd29faf53940320473ab332a98d6effde015d902e16481592cd1fa3e7b5b07b4b44d
7
+ data.tar.gz: 6a1b6488c40e320326668d87866a07303f6d104a7251aa84ba8caf5bb719e5ddfc86fed2178c7ee8ae186403b6c4feceeeb7c733cc9fee184af24d41ecf62724
data/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7
7
 
8
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403061551)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403061551)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403062015)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403062015)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
data/kumogata.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'hashie'
25
25
  spec.add_dependency 'highline'
26
26
  spec.add_dependency 'json'
27
+ spec.add_dependency 'json_color'
27
28
  spec.add_dependency 'term-ansicolor'
28
29
  spec.add_dependency 'uuidtools'
29
30
  spec.add_development_dependency 'bundler'
@@ -29,7 +29,7 @@ class Kumogata::Client
29
29
  template = open_template(path_or_url)
30
30
 
31
31
  if ruby_template?(path_or_url)
32
- JSON.pretty_generate(template)
32
+ colorize_json(JSON.pretty_generate(template))
33
33
  else
34
34
  devaluate_template(template).chomp
35
35
  end
@@ -54,7 +54,7 @@ class Kumogata::Client
54
54
 
55
55
  def list(stack_name = nil)
56
56
  stacks = describe_stacks(stack_name)
57
- JSON.pretty_generate(stacks)
57
+ colorize_json(JSON.pretty_generate(stacks))
58
58
  end
59
59
 
60
60
  def export(stack_name)
@@ -64,17 +64,17 @@ class Kumogata::Client
64
64
 
65
65
  def show_events(stack_name)
66
66
  events = describe_events(stack_name)
67
- JSON.pretty_generate(events)
67
+ colorize_json(JSON.pretty_generate(events))
68
68
  end
69
69
 
70
70
  def show_outputs(stack_name)
71
71
  outputs = describe_outputs(stack_name)
72
- JSON.pretty_generate(outputs)
72
+ colorize_json(JSON.pretty_generate(outputs))
73
73
  end
74
74
 
75
75
  def show_resources(stack_name)
76
76
  resources = describe_resources(stack_name)
77
- JSON.pretty_generate(resources)
77
+ colorize_json(JSON.pretty_generate(resources))
78
78
  end
79
79
 
80
80
  def diff(path_or_url1, path_or_url2)
@@ -409,10 +409,10 @@ class Kumogata::Client
409
409
  puts <<-EOS
410
410
 
411
411
  Outputs:
412
- #{JSON.pretty_generate(outputs)}
412
+ #{colorize_json(JSON.pretty_generate(outputs))}
413
413
 
414
414
  Stack Resource Summaries:
415
- #{JSON.pretty_generate(summaries)}
415
+ #{colorize_json(JSON.pretty_generate(summaries))}
416
416
 
417
417
  (Save to `#{@options.result_log}`)
418
418
  EOS
@@ -431,4 +431,15 @@ Stack Resource Summaries:
431
431
  i[0, 1].upcase + i[1..-1].downcase
432
432
  }.join
433
433
  end
434
+
435
+ def colorize_json(str)
436
+ if $stdout.tty? and @options.color?
437
+ begin
438
+ return JsonColor.colorize(str)
439
+ rescue Racc::ParseError
440
+ end
441
+ end
442
+
443
+ return str
444
+ end
434
445
  end
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
data/lib/kumogata.rb CHANGED
@@ -8,6 +8,7 @@ require 'dslh'
8
8
  require 'hashie'
9
9
  require 'highline/import'
10
10
  require 'json'
11
+ require 'json_color'
11
12
  require 'logger'
12
13
  require 'open-uri'
13
14
  require 'optparse'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json_color
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: term-ansicolor
99
113
  requirement: !ruby/object:Gem::Requirement