itamae 1.12.6 → 1.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e18a63f707a8c5e6553adf7548c3467e704f59a845a81292385a34c14ae4462b
4
- data.tar.gz: 8d159da6ad0674a343f521a0cbc721ccd5016e6e394489724f18381c4c04edfa
3
+ metadata.gz: adefcb08fb8611f035cf3f70d3d76ab4c2b1d012aef3f4489f33c4fb445a88fd
4
+ data.tar.gz: d4e7126f52fb0da4906a289025d9c73a2143b90a1297c570b81e3490985cd83e
5
5
  SHA512:
6
- metadata.gz: 236c31793aef48956d4d04b92ac7dd09076d7f3a33a9f7eefc943fe74beebc8914f4aa05630c104dc35f11b2b70e6504409b4469a8b436d5d2d476482439dc90
7
- data.tar.gz: fcb7322c39beba8614cdc88383a9b1ece9626f5318a717f323c9420ecc57e29f9e6dd28285df42588fe9a8abdb6899b1121eba6a2ba53269e2ba615a4affaf1b
6
+ metadata.gz: 2a5206774cb5c387b79030ed32e9d12c096189a78725294d9516a1abf18199d9ca5d0339b75ae5815d0778f6372b29fef38c3c65b992deea7412729873995578
7
+ data.tar.gz: a8c13d073d29418c523a95501bc42c2864c1250def6a13936f744981eba9ddc4eb9b7ae59a7d66ba367c7799331ea0577fb81815ae7fb0fdc7d1b9825f530a05
@@ -93,9 +93,11 @@ jobs:
93
93
  - "2.6"
94
94
  - "2.7"
95
95
  - "3.0"
96
+ - "3.1"
96
97
  rubyopt:
97
98
  - ""
98
99
  - "--jit"
100
+ - "--yjit"
99
101
  image:
100
102
  - ubuntu:trusty
101
103
  exclude:
@@ -106,6 +108,19 @@ jobs:
106
108
  rubyopt: "--jit"
107
109
  - ruby: "2.5"
108
110
  rubyopt: "--jit"
111
+ # --yjit is available since MRI 3.1
112
+ - ruby: "2.3"
113
+ rubyopt: "--yjit"
114
+ - ruby: "2.4"
115
+ rubyopt: "--yjit"
116
+ - ruby: "2.5"
117
+ rubyopt: "--yjit"
118
+ - ruby: "2.6"
119
+ rubyopt: "--yjit"
120
+ - ruby: "2.7"
121
+ rubyopt: "--yjit"
122
+ - ruby: "3.0"
123
+ rubyopt: "--yjit"
109
124
 
110
125
  env:
111
126
  RUBYOPT: ${{ matrix.rubyopt }}
@@ -156,9 +171,11 @@ jobs:
156
171
  - "2.6"
157
172
  - "2.7"
158
173
  - "3.0"
174
+ - "3.1"
159
175
  rubyopt:
160
176
  - ""
161
177
  - "--jit"
178
+ - "--yjit"
162
179
  exclude:
163
180
  # --jit is available since MRI 2.6
164
181
  - ruby: "2.3"
@@ -167,6 +184,19 @@ jobs:
167
184
  rubyopt: "--jit"
168
185
  - ruby: "2.5"
169
186
  rubyopt: "--jit"
187
+ # --yjit is available since MRI 3.1
188
+ - ruby: "2.3"
189
+ rubyopt: "--yjit"
190
+ - ruby: "2.4"
191
+ rubyopt: "--yjit"
192
+ - ruby: "2.5"
193
+ rubyopt: "--yjit"
194
+ - ruby: "2.6"
195
+ rubyopt: "--yjit"
196
+ - ruby: "2.7"
197
+ rubyopt: "--yjit"
198
+ - ruby: "3.0"
199
+ rubyopt: "--yjit"
170
200
 
171
201
  env:
172
202
  RUBYOPT: ${{ matrix.rubyopt }}
data/CHANGELOG.md CHANGED
@@ -1,12 +1,19 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.6...master)
2
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.13.0...master)
3
+
4
+ ## v1.13.0
5
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.6...v1.13.0)
6
+
7
+ Improvements
8
+
9
+ - [Support repeatable "node_json" and "node_yaml" options](https://github.com/itamae-kitchen/itamae/pull/351)
3
10
 
4
11
  ## v1.12.6
5
12
  [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.5...v1.12.6)
6
13
 
7
14
  Bugfixes
8
15
 
9
- - [Support Psych4.x](https://github.com/itamae-kitchen/itamae/pull/348)
16
+ - [Support Psych4.x](https://github.com/itamae-kitchen/itamae/pull/347)
10
17
 
11
18
  ## v1.12.5
12
19
  [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.4...v1.12.5)
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ namespace :spec do
21
21
  namespace :integration do
22
22
  container_name = 'itamae'
23
23
 
24
- task :all => ['spec:integration:docker' 'spec:integration:local']
24
+ task :all => ['spec:integration:docker', 'spec:integration:local']
25
25
 
26
26
  desc "Run provision and specs"
27
27
  task :docker => ["docker:boot", "docker:provision", "docker:serverspec", 'docker:clean_docker_container']
data/itamae.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
27
  spec.require_paths = ["lib"]
28
28
 
29
- spec.add_runtime_dependency "thor"
29
+ spec.add_runtime_dependency "thor", ">= 1.0.0"
30
30
  spec.add_runtime_dependency "specinfra", [">= 2.64.0", "< 3.0.0"]
31
31
  spec.add_runtime_dependency "hashie"
32
32
  spec.add_runtime_dependency "ansi"
data/lib/itamae/cli.rb CHANGED
@@ -14,8 +14,8 @@ module Itamae
14
14
 
15
15
  def self.define_exec_options
16
16
  option :recipe_graph, type: :string, desc: "[EXPERIMENTAL] Write recipe dependency graph in DOT", banner: "PATH"
17
- option :node_json, type: :string, aliases: ['-j']
18
- option :node_yaml, type: :string, aliases: ['-y']
17
+ option :node_json, type: :string, aliases: ['-j'], repeatable: true
18
+ option :node_yaml, type: :string, aliases: ['-y'], repeatable: true
19
19
  option :dry_run, type: :boolean, aliases: ['-n']
20
20
  option :shell, type: :string, default: "/bin/sh"
21
21
  option :login_shell, type: :boolean, default: false
data/lib/itamae/runner.rb CHANGED
@@ -91,8 +91,10 @@ module Itamae
91
91
  end
92
92
 
93
93
  private
94
+
94
95
  def create_node
95
96
  hash = {}
97
+ hash.extend(Hashie::Extensions::DeepMerge)
96
98
 
97
99
  if @options[:ohai]
98
100
  unless @backend.run_command("which ohai", error: false).exit_status == 0
@@ -105,20 +107,23 @@ module Itamae
105
107
  hash.merge!(JSON.parse(@backend.run_command("ohai 2>/dev/null").stdout))
106
108
  end
107
109
 
108
- if @options[:node_json]
109
- path = File.expand_path(@options[:node_json])
110
+ @options.fetch(:node_json, []).each do |name|
111
+ path = File.expand_path(name)
110
112
  Itamae.logger.info "Loading node data from #{path}..."
111
- hash.merge!(JSON.load(open(path)))
113
+
114
+ hash.deep_merge!(JSON.parse(File.read(path)))
112
115
  end
113
116
 
114
- if @options[:node_yaml]
115
- path = File.expand_path(@options[:node_yaml])
117
+ @options.fetch(:node_yaml, []).each do |name|
118
+ path = File.expand_path(name)
116
119
  Itamae.logger.info "Loading node data from #{path}..."
117
- yaml = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(open(path)) : YAML.load(open(path))
118
- hash.merge!(yaml || {})
120
+
121
+ yaml = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(File.read(path)) : YAML.load(File.read(path))
122
+ hash.deep_merge!(yaml || {})
119
123
  end
120
124
 
121
- Node.new(hash, @backend)
125
+ # 'hash.dup' ensures that we pass a pristine Hash object without Hashie extensions
126
+ Node.new(hash.dup, @backend)
122
127
  end
123
128
 
124
129
  def prepare_handler
@@ -1,3 +1,3 @@
1
1
  module Itamae
2
- VERSION = "1.12.6"
2
+ VERSION = "1.13.0"
3
3
  end
@@ -28,5 +28,49 @@ module Itamae
28
28
  described_class.run(recipes, :local, {})
29
29
  end
30
30
  end
31
+
32
+ describe "#initialize" do
33
+ context "with multiple node_json and node_yaml files" do
34
+ def build_temp_file(data)
35
+ file = Tempfile.new
36
+ file.write data
37
+ file.close
38
+ file
39
+ end
40
+
41
+ it "merges hashes and overwrites arrays" do
42
+ json_one = build_temp_file %({ "vars_from_json": { "one": 1 }, "shared": { "foo": true } })
43
+ json_two = build_temp_file %({ "vars_from_json": { "two": 2 } })
44
+ yaml_one = build_temp_file %(
45
+ vars_from_yaml:
46
+ three: 3
47
+ array:
48
+ - 123
49
+ shared:
50
+ bar: false
51
+ )
52
+ yaml_two = build_temp_file %(
53
+ vars_from_yaml:
54
+ four: 4
55
+ array:
56
+ - 456
57
+ )
58
+
59
+ runner = described_class.new(
60
+ spy,
61
+ node_json: [json_one.path, json_two.path],
62
+ node_yaml: [yaml_one.path, yaml_two.path]
63
+ )
64
+
65
+ expect(runner.node[:vars_from_json][:one]).to eq 1
66
+ expect(runner.node[:vars_from_json][:two]).to eq 2
67
+ expect(runner.node[:vars_from_yaml][:three]).to eq 3
68
+ expect(runner.node[:vars_from_yaml][:four]).to eq 4
69
+ expect(runner.node[:array]).to eq [456]
70
+ expect(runner.node[:shared][:foo]).to eq true
71
+ expect(runner.node[:shared][:bar]).to eq false
72
+ end
73
+ end
74
+ end
31
75
  end
32
76
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.6
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  - Yusuke Nakamura
9
9
  - sue445
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-04-18 00:00:00.000000000 Z
13
+ date: 2022-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '0'
28
+ version: 1.0.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: specinfra
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -200,7 +200,7 @@ dependencies:
200
200
  - - ">="
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
- description:
203
+ description:
204
204
  email:
205
205
  - ryota.arai@gmail.com
206
206
  - yusuke1994525@gmail.com
@@ -316,7 +316,7 @@ metadata:
316
316
  homepage_uri: https://itamae.kitchen/
317
317
  source_code_uri: https://github.com/itamae-kitchen/itamae
318
318
  changelog_uri: https://github.com/itamae-kitchen/itamae/blob/master/CHANGELOG.md
319
- post_install_message:
319
+ post_install_message:
320
320
  rdoc_options: []
321
321
  require_paths:
322
322
  - lib
@@ -331,8 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  - !ruby/object:Gem::Version
332
332
  version: '0'
333
333
  requirements: []
334
- rubygems_version: 3.2.3
335
- signing_key:
334
+ rubygems_version: 3.2.22
335
+ signing_key:
336
336
  specification_version: 4
337
337
  summary: Simple Configuration Management Tool
338
338
  test_files: