remocon 0.4.2 → 0.4.3
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/Gemfile.lock +1 -1
- data/lib/remocon/command/pull_command.rb +18 -26
- data/lib/remocon/normalizer/boolean_normalizer.rb +3 -7
- data/lib/remocon/util/hash.rb +1 -1
- data/lib/remocon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb155fff5f26310779b98af6f8b97e1ef9d61875
|
4
|
+
data.tar.gz: 41316049cc8a0e64ce00c4326842b5e8d2071aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58f9ad9ffc5d724499b8fd3e1820011012b562b3443970b5ffd04f9c81b3a8a5166b4366ce4289b2b472db8fde956d42d9b18eca0745ff62631ce26ba6a38dc5
|
7
|
+
data.tar.gz: 4bd5ad66b49fcf9a5534c0c62147896ec5ed61dabca8ac0d57abf3051dd344897b45799facdbe8967dbce909efd98e46b2ace6710bafd2ee979aadce60b9f4bc
|
data/Gemfile.lock
CHANGED
@@ -6,10 +6,11 @@ module Remocon
|
|
6
6
|
class RemoteConfig
|
7
7
|
include Remocon::InterpreterHelper
|
8
8
|
|
9
|
-
attr_reader :config
|
9
|
+
attr_reader :config, :cmd_opts
|
10
10
|
|
11
11
|
def initialize(opts)
|
12
12
|
@config = Remocon::Config.new(opts)
|
13
|
+
@cmd_opts = { validate_only: false }
|
13
14
|
end
|
14
15
|
|
15
16
|
def require_parameters_file_path
|
@@ -20,16 +21,15 @@ module Remocon
|
|
20
21
|
config.conditions_file_path
|
21
22
|
end
|
22
23
|
|
23
|
-
def
|
24
|
-
|
24
|
+
def conditions_to_be_compared
|
25
|
+
JSON.parse(JSON.pretty_generate(condition_array.map { |c| c.skip_nil_values.stringify_values })).map(&:with_indifferent_access)
|
25
26
|
end
|
26
27
|
|
27
|
-
def
|
28
|
-
|
28
|
+
def parameters_to_be_compared
|
29
|
+
JSON.parse(JSON.pretty_generate(parameter_hash.skip_nil_values.stringify_values)).with_indifferent_access
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
include Remocon::InterpreterHelper
|
33
33
|
include Remocon::ConditionSorter
|
34
34
|
include Remocon::ParameterSorter
|
35
35
|
|
@@ -41,14 +41,6 @@ module Remocon
|
|
41
41
|
@left = RemoteConfig.new(opts)
|
42
42
|
end
|
43
43
|
|
44
|
-
def require_parameters_file_path
|
45
|
-
config.parameters_file_path
|
46
|
-
end
|
47
|
-
|
48
|
-
def require_conditions_file_path
|
49
|
-
config.conditions_file_path
|
50
|
-
end
|
51
|
-
|
52
44
|
def run
|
53
45
|
raw_json, etag = Remocon::Request.pull(config)
|
54
46
|
|
@@ -60,8 +52,8 @@ module Remocon
|
|
60
52
|
parameters = raw_hash[:parameters] || {}
|
61
53
|
|
62
54
|
if config.merge? && File.exist?(config.parameters_file_path) && File.exist?(config.parameters_file_path)
|
63
|
-
unchanged_conditions, added_conditions, changed_conditions, = conditions_diff(left.
|
64
|
-
unchanged_parameters, added_parameters, changed_parameters, = parameters_diff(left.
|
55
|
+
unchanged_conditions, added_conditions, changed_conditions, = conditions_diff(left.conditions_to_be_compared, conditions)
|
56
|
+
unchanged_parameters, added_parameters, changed_parameters, = parameters_diff(left.parameters_to_be_compared, parameters)
|
65
57
|
|
66
58
|
conditions_yaml = JSON.parse(sort_conditions(unchanged_conditions + added_conditions + changed_conditions).to_json).to_yaml
|
67
59
|
parameters_yaml = JSON.parse(sort_parameters(unchanged_parameters.merge(added_parameters).merge(changed_parameters)).to_json).to_yaml
|
@@ -89,12 +81,12 @@ module Remocon
|
|
89
81
|
|
90
82
|
(right_names & left_names).each do |k|
|
91
83
|
old = left.find { |c| c[:name] == k }
|
92
|
-
new =
|
84
|
+
new = right.find { |c| c[:name] == k }
|
93
85
|
|
94
86
|
if old == new
|
95
87
|
unchanged.push(old)
|
96
88
|
else
|
97
|
-
changed.push(new)
|
89
|
+
changed.push(Remocon::ConditionFileDumper.new(new).dump)
|
98
90
|
end
|
99
91
|
end
|
100
92
|
|
@@ -119,20 +111,20 @@ module Remocon
|
|
119
111
|
unchanged = {}
|
120
112
|
|
121
113
|
(right.keys & left.keys).each do |k|
|
122
|
-
|
123
|
-
|
114
|
+
# both of left and right is config json's format
|
115
|
+
# comparison should be done based on the format but dumped format should be returned
|
116
|
+
old = left[k]
|
117
|
+
new = right[k]
|
124
118
|
|
125
119
|
if old == new
|
126
|
-
unchanged.merge!(old)
|
120
|
+
unchanged.merge!(Remocon::ParameterFileDumper.new({ k => old }).dump)
|
127
121
|
else
|
128
|
-
changed.merge!(new)
|
122
|
+
changed.merge!(Remocon::ParameterFileDumper.new({ k => new }).dump)
|
129
123
|
end
|
130
124
|
end
|
131
125
|
|
132
|
-
removed = {}
|
133
|
-
|
134
|
-
removed_keys.each do |k|
|
135
|
-
removed[k] = left[k]
|
126
|
+
removed = removed_keys.each_with_object({}) do |k, acc|
|
127
|
+
acc.merge!(Remocon::ParameterFileDumper.new({ k => left[k] }).dump)
|
136
128
|
end
|
137
129
|
|
138
130
|
[unchanged, added, changed, removed]
|
@@ -7,13 +7,9 @@ module Remocon
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def validate
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
@bool_val = @content.to_s.to_boolean
|
14
|
-
rescue ArgumentError => e
|
15
|
-
raise ValidationError, e.message
|
16
|
-
end
|
10
|
+
@bool_val = @content.to_s.to_boolean
|
11
|
+
rescue ArgumentError => e
|
12
|
+
raise ValidationError, e.message
|
17
13
|
end
|
18
14
|
|
19
15
|
def normalize
|
data/lib/remocon/util/hash.rb
CHANGED
data/lib/remocon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remocon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jumpei Matsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: cmd
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|