kitchen-itamae 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/CHANGELOG.md +6 -0
- data/Guardfile +77 -0
- data/kitchen-itamae.gemspec +2 -0
- data/lib/kitchen-itamae/version.rb +1 -1
- data/lib/kitchen/provisioner/itamae.rb +28 -3
- data/spec/kitchen/provisioner/itamae_spec.rb +104 -0
- data/spec/spec_helper.rb +8 -0
- metadata +38 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669a8e5d3ca1d9f48b8e6a435ce6d1083ff490e8
|
4
|
+
data.tar.gz: f38e2e8ed3d1f5f0ec3b4691cf79d7d6e64f1cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d554f62fd74b75fcecee83823febec9f70ead48ae93b44fab1c26b6fc9fa3a721fda74ffde3b00c750ebb7df419427caeda9abe3791c70372b15a33288670511
|
7
|
+
data.tar.gz: 1127b6a9f46d6a345ced9bc16588ecdb86c8a23cb8c6970591c9822b65bb92a309309422438ef21e092b6a26e9824e6a1c659bd3f779d077ea62a9909c3632a7
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format documentation
|
data/CHANGELOG.md
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), then you will want to move
|
18
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
27
|
+
# rspec may be run, below are examples of the most common uses.
|
28
|
+
# * bundler: 'bundle exec rspec'
|
29
|
+
# * bundler binstubs: 'bin/rspec'
|
30
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
31
|
+
# installed the spring binstubs per the docs)
|
32
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
33
|
+
# * 'just' rspec: 'rspec'
|
34
|
+
|
35
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
36
|
+
require "guard/rspec/dsl"
|
37
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
38
|
+
|
39
|
+
# Feel free to open issues for suggestions and improvements
|
40
|
+
|
41
|
+
# RSpec files
|
42
|
+
rspec = dsl.rspec
|
43
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
44
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
45
|
+
watch(rspec.spec_files)
|
46
|
+
|
47
|
+
# Ruby files
|
48
|
+
ruby = dsl.ruby
|
49
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
50
|
+
|
51
|
+
# Rails files
|
52
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
53
|
+
dsl.watch_spec_files_for(rails.app_files)
|
54
|
+
dsl.watch_spec_files_for(rails.views)
|
55
|
+
|
56
|
+
watch(rails.controllers) do |m|
|
57
|
+
[
|
58
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
59
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
60
|
+
rspec.spec.("acceptance/#{m[1]}")
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
# Rails config changes
|
65
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
66
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
67
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
68
|
+
|
69
|
+
# Capybara features specs
|
70
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
71
|
+
|
72
|
+
# Turnip features and steps
|
73
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
74
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
75
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
76
|
+
end
|
77
|
+
end
|
data/kitchen-itamae.gemspec
CHANGED
@@ -97,9 +97,34 @@ module Kitchen
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def chef_helpers
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
# test-kitchen removes chef_helper at 1.4.0.
|
101
|
+
# It is tempolaly imprement.
|
102
|
+
<<-CHEF_HELPER
|
103
|
+
should_update_chef() {
|
104
|
+
if test ! -d "$1" ; then return 0
|
105
|
+
elif test "$2" = "true" ; then return 1
|
106
|
+
elif test "$2" = "latest" ; then return 0
|
107
|
+
fi
|
108
|
+
|
109
|
+
local version="`$1/bin/chef-solo -v | cut -d " " -f 2`"
|
110
|
+
|
111
|
+
echo "$version" | grep "^$2" 2>&1 >/dev/null
|
112
|
+
if test $? -eq 0 ; then
|
113
|
+
return 1
|
114
|
+
else
|
115
|
+
return 0
|
116
|
+
fi
|
117
|
+
}
|
118
|
+
|
119
|
+
should_update_chef "$chef_omnibus_root" "$version"
|
120
|
+
if test $? -eq 0 ; then
|
121
|
+
echo "-----> Installing Chef Omnibus ($pretty_version)"
|
122
|
+
do_download "$chef_omnibus_url" /tmp/install.sh
|
123
|
+
$sudo_sh /tmp/install.sh $install_flags
|
124
|
+
else
|
125
|
+
echo "-----> Chef Omnibus installation detected ($pretty_version)"
|
126
|
+
fi
|
127
|
+
CHEF_HELPER
|
103
128
|
end
|
104
129
|
|
105
130
|
def chef_install_function
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
require 'kitchen'
|
3
|
+
|
4
|
+
require 'kitchen/provisioner/itamae'
|
5
|
+
|
6
|
+
describe Kitchen::Provisioner::Itamae do
|
7
|
+
let(:logger) { Logger.new(nil) }
|
8
|
+
|
9
|
+
let(:provisioner) do
|
10
|
+
Kitchen::Provisioner::Itamae.new(config).finalize_config!(instance)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:suite) do
|
14
|
+
double(name: "test-default")
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:instance) do
|
18
|
+
double(name: "itamae_node", logger: logger, suite: suite)
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:config) do
|
22
|
+
{ test_base_path: "/basist", kitchen_root: "/rooty", itamae_root: 'kitchen' }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Kitchen::Provisioner::Itamae, "prepare_command" do
|
26
|
+
it "returns nil prepare_command with default configration" do
|
27
|
+
expect(provisioner.prepare_command).to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
context "with Gemfile" do
|
31
|
+
it "returns bundler prepare_command" do
|
32
|
+
allow(File).to receive(:exists?).with(
|
33
|
+
File.join(config[:kitchen_root], config[:itamae_root], 'Gemfile')
|
34
|
+
).and_return(true)
|
35
|
+
expect(provisioner.prepare_command).to match regexify("bundle config shebang", :partial_line)
|
36
|
+
expect(provisioner.prepare_command).to match regexify("bundle install --binstubs", :partial_line)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe Kitchen::Provisioner::Itamae, "run_command" do
|
42
|
+
it "returns run_command with recipe" do
|
43
|
+
config[:run_list] = %w[tamatama itaita]
|
44
|
+
expect(provisioner.run_command).to match regexify("tamatama.rb", :partial_line)
|
45
|
+
expect(provisioner.run_command).to match regexify("itaita.rb", :partial_line)
|
46
|
+
end
|
47
|
+
|
48
|
+
context "with Gemfile" do
|
49
|
+
it "returns bundler run_command" do
|
50
|
+
config[:run_list] = %w[tamatama itaita]
|
51
|
+
config[:use_bundler] = true
|
52
|
+
allow(File).to receive(:exists?).with(
|
53
|
+
File.join(config[:kitchen_root], config[:itamae_root], 'Gemfile')
|
54
|
+
).and_return(true)
|
55
|
+
expect(provisioner.run_command).to match regexify("export PATH=", :partial_line)
|
56
|
+
expect(provisioner.run_command).to match regexify("tamatama.rb", :partial_line)
|
57
|
+
expect(provisioner.run_command).to match regexify("itaita.rb", :partial_line)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe Kitchen::Provisioner::Itamae, "prepare_json" do
|
63
|
+
before do
|
64
|
+
@root = Dir.mktmpdir
|
65
|
+
config[:kitchen_root] = @root
|
66
|
+
end
|
67
|
+
|
68
|
+
after do
|
69
|
+
FileUtils.remove_entry(@root)
|
70
|
+
begin
|
71
|
+
provisioner.cleanup_sandbox
|
72
|
+
rescue # rubocop:disable Lint/HandleExceptions
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
let(:attrs) do
|
77
|
+
JSON.parse(File.read(File.join(provisioner.sandbox_path, 'dna.json')))
|
78
|
+
end
|
79
|
+
|
80
|
+
it "creates dna.json to sandbox_path" do
|
81
|
+
provisioner.create_sandbox
|
82
|
+
provisioner.send(:prepare_json)
|
83
|
+
expect(attrs).to be_empty
|
84
|
+
end
|
85
|
+
|
86
|
+
context "with Attributes" do
|
87
|
+
it "creates dna.json with attributes" do
|
88
|
+
config[:attributes] = {
|
89
|
+
key: "value"
|
90
|
+
}
|
91
|
+
provisioner.create_sandbox
|
92
|
+
provisioner.send(:prepare_json)
|
93
|
+
expect(attrs['key']).to eq "value"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# see spec/provisioner/shell_spec
|
99
|
+
def regexify(str, line = :whole_line)
|
100
|
+
r = Regexp.escape(str)
|
101
|
+
r = "^\s*#{r}$" if line == :whole_line
|
102
|
+
Regexp.new(r)
|
103
|
+
end
|
104
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-itamae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawanoboly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: itamae provisioner for test-kitchen
|
56
84
|
email:
|
57
85
|
- sawanoboriyu@higanworks.com
|
@@ -60,14 +88,18 @@ extensions: []
|
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
62
90
|
- ".gitignore"
|
91
|
+
- ".rspec"
|
63
92
|
- CHANGELOG.md
|
64
93
|
- Gemfile
|
94
|
+
- Guardfile
|
65
95
|
- LICENSE.txt
|
66
96
|
- README.md
|
67
97
|
- Rakefile
|
68
98
|
- kitchen-itamae.gemspec
|
69
99
|
- lib/kitchen-itamae/version.rb
|
70
100
|
- lib/kitchen/provisioner/itamae.rb
|
101
|
+
- spec/kitchen/provisioner/itamae_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
71
103
|
homepage: https://github.com/OpsRockin/kitchen-itamae
|
72
104
|
licenses:
|
73
105
|
- apache2
|
@@ -88,9 +120,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
120
|
version: '0'
|
89
121
|
requirements: []
|
90
122
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.4.
|
123
|
+
rubygems_version: 2.4.6
|
92
124
|
signing_key:
|
93
125
|
specification_version: 4
|
94
126
|
summary: itamae provisioner for test-kitchen
|
95
|
-
test_files:
|
96
|
-
|
127
|
+
test_files:
|
128
|
+
- spec/kitchen/provisioner/itamae_spec.rb
|
129
|
+
- spec/spec_helper.rb
|