itamae 1.10.10 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +200 -0
- data/CHANGELOG.md +37 -1
- data/README.md +1 -2
- data/Rakefile +39 -43
- data/itamae.gemspec +1 -1
- data/lib/itamae/cli.rb +9 -8
- data/lib/itamae/node.rb +1 -0
- data/lib/itamae/recipe.rb +20 -1
- data/lib/itamae/resource/file.rb +7 -1
- data/lib/itamae/runner.rb +1 -1
- data/lib/itamae/version.rb +1 -1
- data/spec/integration/default_spec.rb +18 -0
- data/spec/integration/recipes/default.rb +6 -0
- data/spec/integration/recipes/toplevel_module.rb +6 -0
- data/spec/integration/recipes/variables.rb +14 -0
- metadata +14 -10
- data/.travis.yml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a87b38ab15d48a077ad91bb8b3ff7fe8a07df9068a19ec5fbec2b29f4294869f
|
4
|
+
data.tar.gz: 6ad7b7f90b63f5d4d44cba8a7335259b55c539f04775812ca1ee9906c91d677c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4bfdb3a108826702395d81176b8b75282809868a6c6562e6e1301c7bdef7633c72358f658b62dee07795aa49d2867d706f4ee499cc2ab5c1d0a9f5ebf8edf6
|
7
|
+
data.tar.gz: cc6ec5583ad859f9c09f81aafb1e5a909f9ebbe26c0874a28ae177d5840e1c62cbbcd4f8e176d49fd892cdf166473f7f58243bd5abcfe17164040d743615f1a0
|
@@ -0,0 +1,200 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
unit:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
strategy:
|
18
|
+
fail-fast: false
|
19
|
+
|
20
|
+
matrix:
|
21
|
+
ruby:
|
22
|
+
- "2.3"
|
23
|
+
- "2.4"
|
24
|
+
- "2.5"
|
25
|
+
- "2.6"
|
26
|
+
- "2.7"
|
27
|
+
- "3.0"
|
28
|
+
rubyopt:
|
29
|
+
- ""
|
30
|
+
- "--jit"
|
31
|
+
exclude:
|
32
|
+
# --jit is available since MRI 2.6
|
33
|
+
- ruby: "2.3"
|
34
|
+
rubyopt: "--jit"
|
35
|
+
- ruby: "2.4"
|
36
|
+
rubyopt: "--jit"
|
37
|
+
- ruby: "2.5"
|
38
|
+
rubyopt: "--jit"
|
39
|
+
|
40
|
+
env:
|
41
|
+
RUBYOPT: ${{ matrix.rubyopt }}
|
42
|
+
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v2
|
45
|
+
|
46
|
+
- uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
bundler-cache: true
|
50
|
+
|
51
|
+
- run: bundle update
|
52
|
+
|
53
|
+
- run: bundle exec rake spec:unit
|
54
|
+
|
55
|
+
- name: Slack Notification (not success)
|
56
|
+
uses: lazy-actions/slatify@master
|
57
|
+
if: "! success()"
|
58
|
+
continue-on-error: true
|
59
|
+
with:
|
60
|
+
job_name: ${{ format('*unit* ({0},{1})', matrix.ruby, matrix.rubyopt) }}
|
61
|
+
type: ${{ job.status }}
|
62
|
+
icon_emoji: ":octocat:"
|
63
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
64
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
65
|
+
|
66
|
+
integration-docker:
|
67
|
+
runs-on: ubuntu-latest
|
68
|
+
|
69
|
+
strategy:
|
70
|
+
fail-fast: false
|
71
|
+
|
72
|
+
matrix:
|
73
|
+
ruby:
|
74
|
+
- "2.3"
|
75
|
+
- "2.4"
|
76
|
+
- "2.5"
|
77
|
+
- "2.6"
|
78
|
+
- "2.7"
|
79
|
+
- "3.0"
|
80
|
+
rubyopt:
|
81
|
+
- ""
|
82
|
+
- "--jit"
|
83
|
+
image:
|
84
|
+
- ubuntu:trusty
|
85
|
+
exclude:
|
86
|
+
# --jit is available since MRI 2.6
|
87
|
+
- ruby: "2.3"
|
88
|
+
rubyopt: "--jit"
|
89
|
+
- ruby: "2.4"
|
90
|
+
rubyopt: "--jit"
|
91
|
+
- ruby: "2.5"
|
92
|
+
rubyopt: "--jit"
|
93
|
+
|
94
|
+
env:
|
95
|
+
RUBYOPT: ${{ matrix.rubyopt }}
|
96
|
+
TEST_IMAGE: ${{ matrix.image }}
|
97
|
+
|
98
|
+
steps:
|
99
|
+
- uses: actions/checkout@v2
|
100
|
+
|
101
|
+
- uses: ruby/setup-ruby@v1
|
102
|
+
with:
|
103
|
+
ruby-version: ${{ matrix.ruby }}
|
104
|
+
bundler-cache: true
|
105
|
+
|
106
|
+
- run: bundle update
|
107
|
+
|
108
|
+
- run: bundle exec rake spec:integration:docker:boot
|
109
|
+
|
110
|
+
- run: bundle exec rake spec:integration:docker:provision
|
111
|
+
env:
|
112
|
+
# FIXME: avoid error for "Command `chmod 777 /tmp/itamae_tmp` failed. (exit status: 1)"
|
113
|
+
ITAMAE_TMP_DIR: /var/tmp/itamae_tmp
|
114
|
+
|
115
|
+
- run: bundle exec rake spec:integration:docker:serverspec
|
116
|
+
- run: bundle exec rake spec:integration:docker:clean_docker_container
|
117
|
+
|
118
|
+
- name: Slack Notification (not success)
|
119
|
+
uses: lazy-actions/slatify@master
|
120
|
+
if: "! success()"
|
121
|
+
continue-on-error: true
|
122
|
+
with:
|
123
|
+
job_name: ${{ format('*integration-docker* ({0},{1},{2})', matrix.ruby, matrix.rubyopt, matrix.image) }}
|
124
|
+
type: ${{ job.status }}
|
125
|
+
icon_emoji: ":octocat:"
|
126
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
127
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
128
|
+
|
129
|
+
integration-local:
|
130
|
+
runs-on: ubuntu-latest
|
131
|
+
|
132
|
+
strategy:
|
133
|
+
fail-fast: false
|
134
|
+
|
135
|
+
matrix:
|
136
|
+
ruby:
|
137
|
+
- "2.3"
|
138
|
+
- "2.4"
|
139
|
+
- "2.5"
|
140
|
+
- "2.6"
|
141
|
+
- "2.7"
|
142
|
+
- "3.0"
|
143
|
+
rubyopt:
|
144
|
+
- ""
|
145
|
+
- "--jit"
|
146
|
+
exclude:
|
147
|
+
# --jit is available since MRI 2.6
|
148
|
+
- ruby: "2.3"
|
149
|
+
rubyopt: "--jit"
|
150
|
+
- ruby: "2.4"
|
151
|
+
rubyopt: "--jit"
|
152
|
+
- ruby: "2.5"
|
153
|
+
rubyopt: "--jit"
|
154
|
+
|
155
|
+
env:
|
156
|
+
RUBYOPT: ${{ matrix.rubyopt }}
|
157
|
+
|
158
|
+
steps:
|
159
|
+
- uses: actions/checkout@v2
|
160
|
+
|
161
|
+
- uses: ruby/setup-ruby@v1
|
162
|
+
with:
|
163
|
+
ruby-version: ${{ matrix.ruby }}
|
164
|
+
bundler-cache: true
|
165
|
+
|
166
|
+
- run: bundle update
|
167
|
+
|
168
|
+
- run: bundle exec rake spec:integration:local:main
|
169
|
+
- run: bundle exec rake spec:integration:local:ordinary_user
|
170
|
+
|
171
|
+
- name: Slack Notification (not success)
|
172
|
+
uses: lazy-actions/slatify@master
|
173
|
+
if: "! success()"
|
174
|
+
continue-on-error: true
|
175
|
+
with:
|
176
|
+
job_name: ${{ format('*integration-local* ({0},{1})', matrix.ruby, matrix.rubyopt) }}
|
177
|
+
type: ${{ job.status }}
|
178
|
+
icon_emoji: ":octocat:"
|
179
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
180
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
181
|
+
|
182
|
+
notify:
|
183
|
+
needs:
|
184
|
+
- unit
|
185
|
+
- integration-docker
|
186
|
+
- integration-local
|
187
|
+
|
188
|
+
runs-on: ubuntu-latest
|
189
|
+
|
190
|
+
steps:
|
191
|
+
- name: Slack Notification (success)
|
192
|
+
uses: lazy-actions/slatify@master
|
193
|
+
if: always()
|
194
|
+
continue-on-error: true
|
195
|
+
with:
|
196
|
+
job_name: '*notify*'
|
197
|
+
type: ${{ job.status }}
|
198
|
+
icon_emoji: ":octocat:"
|
199
|
+
url: ${{ secrets.SLACK_WEBHOOK }}
|
200
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,41 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.
|
2
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.1...master)
|
3
|
+
|
4
|
+
## v1.12.1
|
5
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.12.0...v1.12.1)
|
6
|
+
|
7
|
+
Improvements
|
8
|
+
|
9
|
+
- [Allow defining top-level modules without `::`](https://github.com/itamae-kitchen/itamae/pull/332)
|
10
|
+
|
11
|
+
## v1.12.0
|
12
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.11.2...v1.12.0)
|
13
|
+
|
14
|
+
Improvements
|
15
|
+
|
16
|
+
- [Add `--tmp-dir` to cli options](https://github.com/itamae-kitchen/itamae/pull/331)
|
17
|
+
|
18
|
+
## v1.11.2
|
19
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.11.1...v1.11.2)
|
20
|
+
|
21
|
+
Bugfixes
|
22
|
+
|
23
|
+
- [Support thor-1.1.0 (by @chaaaaarlotte)](https://github.com/itamae-kitchen/itamae/pull/329)
|
24
|
+
|
25
|
+
## v1.11.1
|
26
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.11.0...v1.11.1)
|
27
|
+
|
28
|
+
Improvements
|
29
|
+
|
30
|
+
- [Support Ruby 3.0.0](https://github.com/itamae-kitchen/itamae/pull/326)
|
31
|
+
- [file: improve diff output (by @terceiro)](https://github.com/itamae-kitchen/itamae/pull/327)
|
32
|
+
|
33
|
+
## v1.11.0
|
34
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.10...v1.11.0)
|
35
|
+
|
36
|
+
Improvements
|
37
|
+
|
38
|
+
- [file: add support for sensitive files (by @terceiro)](https://github.com/itamae-kitchen/itamae/pull/325)
|
3
39
|
|
4
40
|
## v1.10.10
|
5
41
|
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.9...v1.10.10)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [![](https://raw.githubusercontent.com/itamae-kitchen/itamae-logos/master/small/FA-Itamae-horizontal-01-180x72.png)](https://github.com/itamae-kitchen/itamae)
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae) [![Code Climate](https://codeclimate.com/github/ryotarai/itamae/badges/gpa.svg)](https://codeclimate.com/github/ryotarai/itamae) [![Build Status](https://
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/itamae.svg)](http://badge.fury.io/rb/itamae) [![Code Climate](https://codeclimate.com/github/ryotarai/itamae/badges/gpa.svg)](https://codeclimate.com/github/ryotarai/itamae) [![Build Status](https://github.com/itamae-kitchen/itamae/workflows/test/badge.svg?branch=master)](https://github.com/itamae-kitchen/itamae/actions?query=workflow%3Atest) [![Slack](https://img.shields.io/badge/slack-join-blue.svg)](https://join.slack.com/t/itamae/shared_invite/enQtNTExNTI3ODM1NTY5LTM5MWJlZTgwODE0YTUwMThiNzZjN2I1MGNlZjE2NjlmNzg5NTNlOTliMDhkNDNmNTQ2ZTgwMzZjNjI5NDJiZGI)
|
4
4
|
|
5
5
|
Simple and lightweight configuration management tool inspired by Chef.
|
6
6
|
|
@@ -97,4 +97,3 @@ If you have a problem, please [create an issue](https://github.com/itamae-kitche
|
|
97
97
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
98
98
|
4. Push to the branch (`git push origin my-new-feature`)
|
99
99
|
5. Create new Pull Request
|
100
|
-
|
data/Rakefile
CHANGED
@@ -10,6 +10,8 @@ end
|
|
10
10
|
desc 'Run unit and integration specs.'
|
11
11
|
task :spec => ['spec:unit', 'spec:integration:all']
|
12
12
|
|
13
|
+
TEST_IMAGE = ENV["TEST_IMAGE"] || "ubuntu:trusty"
|
14
|
+
|
13
15
|
namespace :spec do
|
14
16
|
RSpec::Core::RakeTask.new("unit") do |task|
|
15
17
|
task.ruby_opts = '-I ./spec/unit'
|
@@ -17,60 +19,54 @@ namespace :spec do
|
|
17
19
|
end
|
18
20
|
|
19
21
|
namespace :integration do
|
20
|
-
targets = ["ubuntu:trusty"]
|
21
22
|
container_name = 'itamae'
|
22
23
|
|
23
|
-
task :all
|
24
|
+
task :all => ['spec:integration:docker' 'spec:integration:local']
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
task target => ["docker:#{target}", "provision:#{target}", "serverspec:#{target}", 'clean_docker_container']
|
26
|
+
desc "Run provision and specs"
|
27
|
+
task :docker => ["docker:boot", "docker:provision", "docker:serverspec", 'docker:clean_docker_container']
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
29
|
+
namespace :docker do
|
30
|
+
desc "Run docker"
|
31
|
+
task :boot do
|
32
|
+
sh "docker run --privileged -d --name #{container_name} #{TEST_IMAGE} /sbin/init"
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
35
|
+
desc "Run itamae"
|
36
|
+
task :provision do
|
37
|
+
suites = [
|
38
|
+
[
|
39
|
+
"spec/integration/recipes/default.rb",
|
40
|
+
"spec/integration/recipes/default2.rb",
|
41
|
+
"spec/integration/recipes/redefine.rb",
|
42
|
+
"spec/integration/recipes/docker.rb",
|
43
|
+
],
|
44
|
+
[
|
45
|
+
"--dry-run",
|
46
|
+
"spec/integration/recipes/dry_run.rb",
|
47
|
+
],
|
48
|
+
]
|
49
|
+
suites.each do |suite|
|
50
|
+
cmd = %w!bundle exec ruby -w bin/itamae docker!
|
51
|
+
cmd << "-l" << (ENV['LOG_LEVEL'] || 'debug')
|
52
|
+
cmd << "-j" << "spec/integration/recipes/node.json"
|
53
|
+
cmd << "--container" << container_name
|
54
|
+
cmd << "--tag" << "itamae:latest"
|
55
|
+
cmd << "--tmp-dir" << (ENV['ITAMAE_TMP_DIR'] || '/tmp/itamae_tmp')
|
56
|
+
cmd += suite
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
58
|
+
p cmd
|
59
|
+
unless system(*cmd)
|
60
|
+
raise "#{cmd} failed"
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
t.pattern = "spec/integration/{default,docker}_spec.rb"
|
73
|
-
end
|
65
|
+
desc "Run serverspec tests"
|
66
|
+
RSpec::Core::RakeTask.new(:serverspec) do |t|
|
67
|
+
ENV['DOCKER_CONTAINER'] = container_name
|
68
|
+
t.ruby_opts = '-I ./spec/integration'
|
69
|
+
t.pattern = "spec/integration/{default,docker}_spec.rb"
|
74
70
|
end
|
75
71
|
|
76
72
|
desc 'Clean a docker container for test'
|
data/itamae.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency "rspec", "~> 3.0"
|
38
38
|
spec.add_development_dependency "serverspec", "~> 2.1"
|
39
39
|
spec.add_development_dependency "pry-byebug"
|
40
|
-
spec.add_development_dependency "docker-api", "~>
|
40
|
+
spec.add_development_dependency "docker-api", "~> 2"
|
41
41
|
spec.add_development_dependency "fakefs"
|
42
42
|
spec.add_development_dependency "fluent-logger"
|
43
43
|
end
|
data/lib/itamae/cli.rb
CHANGED
@@ -25,6 +25,15 @@ module Itamae
|
|
25
25
|
option :log_level, type: :string, aliases: ['-l'], default: 'info'
|
26
26
|
option :color, type: :boolean, default: true
|
27
27
|
option :config, type: :string, aliases: ['-c']
|
28
|
+
option :tmp_dir, type: :string, aliases: ['-t'], default: "/tmp/itamae_tmp"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.options
|
32
|
+
@itamae_options ||= super.dup.tap do |options|
|
33
|
+
if config = options[:config]
|
34
|
+
options.merge!(YAML.load_file(config))
|
35
|
+
end
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
desc "local RECIPE [RECIPE...]", "Run Itamae locally"
|
@@ -117,14 +126,6 @@ module Itamae
|
|
117
126
|
end
|
118
127
|
|
119
128
|
private
|
120
|
-
def options
|
121
|
-
@itamae_options ||= super.dup.tap do |options|
|
122
|
-
if config = options[:config]
|
123
|
-
options.merge!(YAML.load_file(config))
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
129
|
def validate_generate_target!(command, target)
|
129
130
|
unless GENERATE_TARGETS.include?(target)
|
130
131
|
msg = %Q!ERROR: "itamae #{command}" was called with "#{target}" !
|
data/lib/itamae/node.rb
CHANGED
data/lib/itamae/recipe.rb
CHANGED
@@ -53,7 +53,7 @@ module Itamae
|
|
53
53
|
|
54
54
|
def load(vars = {})
|
55
55
|
context = EvalContext.new(self, vars)
|
56
|
-
|
56
|
+
InstanceEval.new(File.read(path), path, 1, context: context).call
|
57
57
|
end
|
58
58
|
|
59
59
|
def run
|
@@ -151,6 +151,25 @@ module Itamae
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
+
class InstanceEval
|
155
|
+
def initialize(src, path, lineno, context:)
|
156
|
+
# Using instance_eval + eval to allow top-level class/module definition without `::`.
|
157
|
+
# To pass args without introducing any local/instance variables, this code is also eval-ed.
|
158
|
+
@code = <<-RUBY
|
159
|
+
@context.instance_eval do
|
160
|
+
eval(#{src.dump}, nil, #{path.dump}, #{lineno})
|
161
|
+
end
|
162
|
+
RUBY
|
163
|
+
@context = context
|
164
|
+
end
|
165
|
+
|
166
|
+
# This method has no local variables to avoid spilling them to recipes.
|
167
|
+
def call
|
168
|
+
eval(@code)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
private_constant :InstanceEval
|
172
|
+
|
154
173
|
class RecipeFromDefinition < Recipe
|
155
174
|
attr_accessor :definition
|
156
175
|
|
data/lib/itamae/resource/file.rb
CHANGED
@@ -4,6 +4,7 @@ module Itamae
|
|
4
4
|
define_attribute :action, default: :create
|
5
5
|
define_attribute :path, type: String, default_name: true
|
6
6
|
define_attribute :content, type: String, default: nil
|
7
|
+
define_attribute :sensitive, default: false
|
7
8
|
define_attribute :mode, type: String
|
8
9
|
define_attribute :owner, type: String
|
9
10
|
define_attribute :group, type: String
|
@@ -156,9 +157,14 @@ module Itamae
|
|
156
157
|
end
|
157
158
|
|
158
159
|
def show_content_diff
|
160
|
+
if attributes.sensitive
|
161
|
+
Itamae.logger.info("diff exists, but not displaying sensitive content")
|
162
|
+
return
|
163
|
+
end
|
164
|
+
|
159
165
|
if attributes.modified
|
160
166
|
Itamae.logger.info "diff:"
|
161
|
-
diff = run_command(["diff", "-u", compare_to, @temppath], error: false)
|
167
|
+
diff = run_command(["diff", "-u", "--label=#{attributes.path} (BEFORE)", compare_to, "--label=#{attributes.path} (AFTER)", @temppath], error: false)
|
162
168
|
diff.stdout.each_line do |line|
|
163
169
|
color = if line.start_with?('+')
|
164
170
|
:green
|
data/lib/itamae/runner.rb
CHANGED
data/lib/itamae/version.rb
CHANGED
@@ -333,3 +333,21 @@ describe file('/tmp/empty_file3') do
|
|
333
333
|
it { should be_file }
|
334
334
|
its(:content) { should eq "" }
|
335
335
|
end
|
336
|
+
|
337
|
+
describe file('/tmp/toplevel_module') do
|
338
|
+
it { should exist }
|
339
|
+
it { should be_file }
|
340
|
+
its(:content) { should eq "helper" }
|
341
|
+
end
|
342
|
+
|
343
|
+
describe file('/tmp/local_variables') do
|
344
|
+
it { should exist }
|
345
|
+
it { should be_file }
|
346
|
+
its(:content) { should eq "[]" }
|
347
|
+
end
|
348
|
+
|
349
|
+
describe file('/tmp/instance_variables') do
|
350
|
+
it { should exist }
|
351
|
+
it { should be_file }
|
352
|
+
its(:content) { should eq "[:@recipe]" } # backward compatibility
|
353
|
+
end
|
@@ -556,3 +556,9 @@ unless v1 == v2 && v2 == v3 && v1 =~ /\A\d+kB\z/
|
|
556
556
|
raise "failed to fetch host inventory value (#{v1}, #{v2}, #{v3})"
|
557
557
|
end
|
558
558
|
|
559
|
+
include_recipe "toplevel_module"
|
560
|
+
file "/tmp/toplevel_module" do
|
561
|
+
content ToplevelModule.helper
|
562
|
+
end
|
563
|
+
|
564
|
+
include_recipe "variables"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
node.reverse_merge!(
|
2
|
+
variables: {
|
3
|
+
lvars: binding.local_variables,
|
4
|
+
ivars: instance_variables,
|
5
|
+
}
|
6
|
+
)
|
7
|
+
|
8
|
+
file "/tmp/local_variables" do
|
9
|
+
content node[:variables][:lvars].to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
file "/tmp/instance_variables" do
|
13
|
+
content node[:variables][:ivars].to_s
|
14
|
+
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.
|
4
|
+
version: 1.12.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:
|
13
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -164,14 +164,14 @@ dependencies:
|
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
167
|
+
version: '2'
|
168
168
|
type: :development
|
169
169
|
prerelease: false
|
170
170
|
version_requirements: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version: '
|
174
|
+
version: '2'
|
175
175
|
- !ruby/object:Gem::Dependency
|
176
176
|
name: fakefs
|
177
177
|
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
|
@@ -210,9 +210,9 @@ executables:
|
|
210
210
|
extensions: []
|
211
211
|
extra_rdoc_files: []
|
212
212
|
files:
|
213
|
+
- ".github/workflows/test.yml"
|
213
214
|
- ".gitignore"
|
214
215
|
- ".rspec"
|
215
|
-
- ".travis.yml"
|
216
216
|
- CHANGELOG.md
|
217
217
|
- Gemfile
|
218
218
|
- LICENSE.txt
|
@@ -293,6 +293,8 @@ files:
|
|
293
293
|
- spec/integration/recipes/redefine.rb
|
294
294
|
- spec/integration/recipes/templates/empty_file.erb
|
295
295
|
- spec/integration/recipes/templates/template_auto.erb
|
296
|
+
- spec/integration/recipes/toplevel_module.rb
|
297
|
+
- spec/integration/recipes/variables.rb
|
296
298
|
- spec/integration/spec_helper.rb
|
297
299
|
- spec/unit/lib/itamae/backend_spec.rb
|
298
300
|
- spec/unit/lib/itamae/handler/base_spec.rb
|
@@ -314,7 +316,7 @@ metadata:
|
|
314
316
|
homepage_uri: https://itamae.kitchen/
|
315
317
|
source_code_uri: https://github.com/itamae-kitchen/itamae
|
316
318
|
changelog_uri: https://github.com/itamae-kitchen/itamae/blob/master/CHANGELOG.md
|
317
|
-
post_install_message:
|
319
|
+
post_install_message:
|
318
320
|
rdoc_options: []
|
319
321
|
require_paths:
|
320
322
|
- lib
|
@@ -329,8 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
331
|
- !ruby/object:Gem::Version
|
330
332
|
version: '0'
|
331
333
|
requirements: []
|
332
|
-
rubygems_version: 3.
|
333
|
-
signing_key:
|
334
|
+
rubygems_version: 3.2.3
|
335
|
+
signing_key:
|
334
336
|
specification_version: 4
|
335
337
|
summary: Simple Configuration Management Tool
|
336
338
|
test_files:
|
@@ -357,6 +359,8 @@ test_files:
|
|
357
359
|
- spec/integration/recipes/redefine.rb
|
358
360
|
- spec/integration/recipes/templates/empty_file.erb
|
359
361
|
- spec/integration/recipes/templates/template_auto.erb
|
362
|
+
- spec/integration/recipes/toplevel_module.rb
|
363
|
+
- spec/integration/recipes/variables.rb
|
360
364
|
- spec/integration/spec_helper.rb
|
361
365
|
- spec/unit/lib/itamae/backend_spec.rb
|
362
366
|
- spec/unit/lib/itamae/handler/base_spec.rb
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: required
|
3
|
-
dist: xenial
|
4
|
-
services:
|
5
|
-
- docker
|
6
|
-
rvm:
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
9
|
-
- 2.5
|
10
|
-
- 2.6
|
11
|
-
- 2.7
|
12
|
-
- ruby-head
|
13
|
-
bundler_args: "--jobs=4 --retry=3"
|
14
|
-
cache:
|
15
|
-
bundler: true
|
16
|
-
|
17
|
-
before_install:
|
18
|
-
- travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
|
19
|
-
|
20
|
-
script:
|
21
|
-
- RUBYOPT=$SPEC_RUBYOPT bundle exec rake spec
|
22
|
-
notifications:
|
23
|
-
email: false
|
24
|
-
slack:
|
25
|
-
secure: PcecHsVS6lw89K5PllW8xFlzu0d04p6lYfxlUZL0/yp9flAczElJME4RshSMSkbnu5e2Iw8KUA2xB1jkAzDo9qYoXveaKyjkFUOb1ZxYIVxzzfoDDwUNTMmSoyjZjvbeBUcpxxmxy6nXa3zS+gA2ohqWhS9WTTlTqyM5RriDjZ8=
|
26
|
-
matrix:
|
27
|
-
allow_failures:
|
28
|
-
- rvm: ruby-head
|
29
|
-
include:
|
30
|
-
- rvm: 2.6
|
31
|
-
env: SPEC_RUBYOPT="--jit"
|
32
|
-
- rvm: 2.7
|
33
|
-
env: SPEC_RUBYOPT="--jit"
|
34
|
-
- rvm: ruby-head
|
35
|
-
env: SPEC_RUBYOPT="--jit"
|
36
|
-
branches:
|
37
|
-
only:
|
38
|
-
- master
|