itamae 1.12.5 → 1.13.1

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: e47ead5c51f39486dc78c265eb1d7ac31ccb1d3597597c73043513c50f755fc7
4
- data.tar.gz: fb29caac7b950f41e0d24f034a8aec9bac1205263ce1556dbcf6df139f555f6c
3
+ metadata.gz: fe0f84c4cba9521d5565bbb6a4dd6d665a74db6b18d69fb31d2b4486af07b1de
4
+ data.tar.gz: b4a8e95a18c6c3bb45011de13d46eed4a369aae7c2ce14d873504a5f681336e4
5
5
  SHA512:
6
- metadata.gz: d0fc18bd902d82bd812fd0a6f65f2e3788c538c22f2141a07201c01e58c0c0c943aa449fc20e5cc3d4f203514595d5f0573ad84bf89c06fe60e6eab7c2f6dcd1
7
- data.tar.gz: b0f179fcaa5de472f01afcc716d9407e332ace2e11d897318205e2630440b866f1802e3dc52800e106110668aa64b2954e39be0f997404bf03ad73aa9d1a4671
6
+ metadata.gz: 344b69e231945022ff4339df1934e4e79c31375957e9c370eafffcdbbeb4347d4593731fb0b71dd56f6b178a325a695a403bd5368429004c1f0f0cd321198220
7
+ data.tar.gz: db79a8ae7ea735a2a7dd8e1988a521500853d5e36ee4348bda70ce6c123ad5ce1dda0ef792db199448e77950ccdeaee9ae6d865149c0276741a458f5fb2239e9
@@ -31,6 +31,7 @@ jobs:
31
31
  rubyopt:
32
32
  - ""
33
33
  - "--jit"
34
+ - "--yjit"
34
35
  exclude:
35
36
  # --jit is available since MRI 2.6
36
37
  - ruby: "2.3"
@@ -39,7 +40,19 @@ jobs:
39
40
  rubyopt: "--jit"
40
41
  - ruby: "2.5"
41
42
  rubyopt: "--jit"
42
-
43
+ # --yjit is available since MRI 3.1
44
+ - ruby: "2.3"
45
+ rubyopt: "--yjit"
46
+ - ruby: "2.4"
47
+ rubyopt: "--yjit"
48
+ - ruby: "2.5"
49
+ rubyopt: "--yjit"
50
+ - ruby: "2.6"
51
+ rubyopt: "--yjit"
52
+ - ruby: "2.7"
53
+ rubyopt: "--yjit"
54
+ - ruby: "3.0"
55
+ rubyopt: "--yjit"
43
56
  env:
44
57
  RUBYOPT: ${{ matrix.rubyopt }}
45
58
 
@@ -80,9 +93,11 @@ jobs:
80
93
  - "2.6"
81
94
  - "2.7"
82
95
  - "3.0"
96
+ - "3.1"
83
97
  rubyopt:
84
98
  - ""
85
99
  - "--jit"
100
+ - "--yjit"
86
101
  image:
87
102
  - ubuntu:trusty
88
103
  exclude:
@@ -93,6 +108,19 @@ jobs:
93
108
  rubyopt: "--jit"
94
109
  - ruby: "2.5"
95
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"
96
124
 
97
125
  env:
98
126
  RUBYOPT: ${{ matrix.rubyopt }}
@@ -143,9 +171,11 @@ jobs:
143
171
  - "2.6"
144
172
  - "2.7"
145
173
  - "3.0"
174
+ - "3.1"
146
175
  rubyopt:
147
176
  - ""
148
177
  - "--jit"
178
+ - "--yjit"
149
179
  exclude:
150
180
  # --jit is available since MRI 2.6
151
181
  - ruby: "2.3"
@@ -154,6 +184,19 @@ jobs:
154
184
  rubyopt: "--jit"
155
185
  - ruby: "2.5"
156
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"
157
200
 
158
201
  env:
159
202
  RUBYOPT: ${{ matrix.rubyopt }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.5...master)
2
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.13.1...master)
3
+
4
+ ## v1.13.1
5
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.13.0...v1.13.1)
6
+
7
+ Improvements
8
+
9
+ - [Made MFA mandatory for gem releases](https://github.com/itamae-kitchen/itamae/pull/354)
10
+
11
+ ## v1.13.0
12
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.6...v1.13.0)
13
+
14
+ Improvements
15
+
16
+ - [Support repeatable "node_json" and "node_yaml" options](https://github.com/itamae-kitchen/itamae/pull/351)
17
+
18
+ ## v1.12.6
19
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.5...v1.12.6)
20
+
21
+ Bugfixes
22
+
23
+ - [Support Psych4.x](https://github.com/itamae-kitchen/itamae/pull/347)
3
24
 
4
25
  ## v1.12.5
5
26
  [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.4...v1.12.5)
data/README.md CHANGED
@@ -33,7 +33,7 @@ service 'nginx' do
33
33
  end
34
34
  ```
35
35
 
36
- And then excute `itamae` command to apply a recipe to a local machine.
36
+ And then execute `itamae` command to apply a recipe to a local machine.
37
37
 
38
38
  ```
39
39
  $ itamae local recipe.rb
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
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = "https://github.com/itamae-kitchen/itamae"
18
18
  spec.metadata["changelog_uri"] = "https://github.com/itamae-kitchen/itamae/blob/master/CHANGELOG.md"
19
+ spec.metadata["rubygems_mfa_required"] = "true"
19
20
  else
20
21
  raise "RubyGems 2.0 or newer is required to protect against " \
21
22
  "public gem pushes."
@@ -26,7 +27,7 @@ Gem::Specification.new do |spec|
26
27
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
28
  spec.require_paths = ["lib"]
28
29
 
29
- spec.add_runtime_dependency "thor"
30
+ spec.add_runtime_dependency "thor", ">= 1.0.0"
30
31
  spec.add_runtime_dependency "specinfra", [">= 2.64.0", "< 3.0.0"]
31
32
  spec.add_runtime_dependency "hashie"
32
33
  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
@@ -31,7 +31,7 @@ module Itamae
31
31
  def self.options
32
32
  @itamae_options ||= super.dup.tap do |options|
33
33
  if config = options[:config]
34
- options.merge!(YAML.load_file(config))
34
+ options.merge!(YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(config) : YAML.load(config))
35
35
  end
36
36
  end
37
37
  end
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,19 +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
- hash.merge!(YAML.load(open(path)) || {})
120
+
121
+ yaml = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(File.read(path)) : YAML.load(File.read(path))
122
+ hash.deep_merge!(yaml || {})
118
123
  end
119
124
 
120
- Node.new(hash, @backend)
125
+ # 'hash.dup' ensures that we pass a pristine Hash object without Hashie extensions
126
+ Node.new(hash.dup, @backend)
121
127
  end
122
128
 
123
129
  def prepare_handler
@@ -1,3 +1,3 @@
1
1
  module Itamae
2
- VERSION = "1.12.5"
2
+ VERSION = "1.13.1"
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.5
4
+ version: 1.13.1
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: 2021-12-31 00:00:00.000000000 Z
13
+ date: 2022-06-21 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,8 @@ 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
+ rubygems_mfa_required: 'true'
320
+ post_install_message:
320
321
  rdoc_options: []
321
322
  require_paths:
322
323
  - lib
@@ -331,8 +332,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
332
  - !ruby/object:Gem::Version
332
333
  version: '0'
333
334
  requirements: []
334
- rubygems_version: 3.2.3
335
- signing_key:
335
+ rubygems_version: 3.3.7
336
+ signing_key:
336
337
  specification_version: 4
337
338
  summary: Simple Configuration Management Tool
338
339
  test_files: