kumogata 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/kumogata/client.rb +2 -3
- data/lib/kumogata/version.rb +1 -1
- data/spec/kumogata_diff_spec.rb +80 -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: 6a084457b2108497cd7ad64a62d7372337ffda6b
|
4
|
+
data.tar.gz: faf9dcdc774b828986f2fe3278a62ac62ea20bf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
[](http://badge.fury.io/rb/kumogata)
|
9
|
+
[](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/lib/kumogata/client.rb
CHANGED
@@ -78,11 +78,10 @@ class Kumogata::Client
|
|
78
78
|
JSON.pretty_generate(template)
|
79
79
|
end
|
80
80
|
|
81
|
-
diff_opts = '-
|
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
|
data/lib/kumogata/version.rb
CHANGED
data/spec/kumogata_diff_spec.rb
CHANGED
@@ -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
|