kumogata 0.2.7 → 0.2.8

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: db9de5e733c5ce3dbfb6cdcf818f7c6c8402f2e5
4
- data.tar.gz: f6b43da8e971a28382d02450dc0666d50dfb270a
3
+ metadata.gz: 6a084457b2108497cd7ad64a62d7372337ffda6b
4
+ data.tar.gz: faf9dcdc774b828986f2fe3278a62ac62ea20bf8
5
5
  SHA512:
6
- metadata.gz: 7a4f8c5b24c73f584b2bee4290fba1465bbef3db577728a3c43065422e6ffb491fd1e1ac11a8678b3627877fdb783d92ccc39429dbacfa4bb6a9af7daa996613
7
- data.tar.gz: 281264326c74826a608f8e63e520ee456d34ff02f00a16521b411aa1bd3934ee4523ac2a227f91d5977029f17e131db4331cac8104ca8732387a041a0a8d4bd3
6
+ metadata.gz: 412ad000dd6e7d865fe763994cccee083f1e223d23f6dd60c167728e77592d2afb946b7e1509831c6bca18bf30095927a4a971bd1377169add49200ba0657d14
7
+ data.tar.gz: 3b9c298c11a035087c551e63f5e82459fd6f16f4d5bb4a39e2ee6ca8c92690047ecc8aaefe4f67d9c3de2633a9c8f36bf285282f1a683222257bd26b466b96ad
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?201403061208)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403061208)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403061440)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403061440)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
@@ -78,11 +78,10 @@ class Kumogata::Client
78
78
  JSON.pretty_generate(template)
79
79
  end
80
80
 
81
- diff_opts = '-U 3'
81
+ diff_opts = @options.ignore_all_space? ? '-uw' : '-u'
82
82
  opts = {:include_diff_info => true, :diff => diff_opts}
83
- diff_opts << ' -w' if @options.ignore_all_space?
84
-
85
83
  diff = Diffy::Diff.new(*templates, opts).to_s
84
+
86
85
  diff.sub(/^(\e\[\d+m)?\-\-\-(\s+)(\S+)/m) { "#{$1}---#{$2}#{path_or_url1}"}
87
86
  .sub(/^(\e\[\d+m)?\+\+\+(\s+)(\S+)/m) { "#{$1}+++#{$2}#{path_or_url2}"}
88
87
  end
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  end
@@ -12,7 +12,7 @@ describe 'Kumogata::Client#diff' do
12
12
  it 'compare templates logically' do
13
13
  json_template = drupal_single_instance_template
14
14
  json_template.sub!('localhost', '127.0.0.1')
15
- json_template.sub!('"ToPort": "80"', '"ToPort": "8080"')
15
+ json_template.sub!('"ToPort" : "80"', '"ToPort" : "8080"')
16
16
 
17
17
  tempfile(json_template, '.templates') do |js|
18
18
  tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
@@ -29,8 +29,87 @@ describe 'Kumogata::Client#diff' do
29
29
  {
30
30
  "Ref": "DBPassword"
31
31
  },
32
+ @@ -437,7 +437,7 @@
33
+ {
34
+ "IpProtocol": "tcp",
35
+ "FromPort": "80",
36
+ - "ToPort": "8080",
37
+ + "ToPort": "80",
38
+ "CidrIp": "0.0.0.0/0"
39
+ },
40
+ {
32
41
  EOS
33
42
  end
34
43
  end
35
44
  end
45
+
46
+ it 'compare templates logically with "-w"' do
47
+ json_template = drupal_single_instance_template
48
+ json_template.sub!('localhost', '127.0.0.1')
49
+ json_template.sub!('"ToPort" : "80"', '"ToPort" : "8080"')
50
+
51
+ tempfile(json_template, '.templates') do |js|
52
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
53
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false, :ignore_all_space => true})
54
+ diff = diff.split(/\n/).slice(2..-1).join("\n")
55
+
56
+ expect(diff).to eq((<<-EOS).chomp)
57
+ @@ -257,7 +257,7 @@
58
+ {
59
+ "Ref": "DBUsername"
60
+ },
61
+ - "'@'127.0.0.1' IDENTIFIED BY '",
62
+ + "'@'localhost' IDENTIFIED BY '",
63
+ {
64
+ "Ref": "DBPassword"
65
+ },
66
+ @@ -437,7 +437,7 @@
67
+ {
68
+ "IpProtocol": "tcp",
69
+ "FromPort": "80",
70
+ - "ToPort": "8080",
71
+ + "ToPort": "80",
72
+ "CidrIp": "0.0.0.0/0"
73
+ },
74
+ {
75
+ EOS
76
+ end
77
+ end
78
+ end
79
+
80
+ it 'compare templates logically with whitespace' do
81
+ json_template = drupal_single_instance_template
82
+ json_template.sub!('localhost', 'local host')
83
+
84
+ tempfile(json_template, '.templates') do |js|
85
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
86
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false})
87
+ diff = diff.split(/\n/).slice(2..-1).join("\n")
88
+
89
+ expect(diff).to eq((<<-EOS).chomp)
90
+ @@ -257,7 +257,7 @@
91
+ {
92
+ "Ref": "DBUsername"
93
+ },
94
+ - "'@'local host' IDENTIFIED BY '",
95
+ + "'@'localhost' IDENTIFIED BY '",
96
+ {
97
+ "Ref": "DBPassword"
98
+ },
99
+ EOS
100
+ end
101
+ end
102
+ end
103
+
104
+ it 'compare templates logically with whitespace and "-w"' do
105
+ json_template = drupal_single_instance_template
106
+ json_template.sub!('localhost', 'local host')
107
+
108
+ tempfile(json_template, '.templates') do |js|
109
+ tempfile(drupal_single_instance_template_rb, '.rb') do |rb|
110
+ diff = ruby_template = run_client(:diff, :arguments => [js.path, rb.path], :options => {:color => false, :ignore_all_space => true})
111
+ expect(diff).to be_empty
112
+ end
113
+ end
114
+ end
36
115
  end
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.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara