kitchen-itamae 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 46c279608ea63243b1bb1d83d737e3852e8457a2
4
- data.tar.gz: 76ef0e7c3d65219028ce778fedcbcc83636949d9
3
+ metadata.gz: c7e3e1aa4c7ba1ee5928e94eede7f4c370adf0e6
4
+ data.tar.gz: 399f22d96967edf51efdd81f4d589481dd202421
5
5
  SHA512:
6
- metadata.gz: 8939cc3fc63f01d209182d433269f94be518f2f99d8a69c3271d3b641e461990c06943cd6f149d48ddda693060a7f63093775235a6f0345b09bbd952c238facd
7
- data.tar.gz: 8c391542a73ff0cad8aee3b947ca4606383f7f86d74d7938dc69042c72b5e1f6f975eade9813f12728bedc68caa256a9b50b9b1450e0eecf4a77f14d3cb3b061
6
+ metadata.gz: 4740ab9c5802e1de67fee3c9019fd58868a5d41ab4483833c386eedf19893bc94e21b0f3ed51b8ad184c9ad91d8e0285ee188af06e99bdd6102fcc4dc24f0935
7
+ data.tar.gz: b4f0bf64645253e3205ebe6ff44eda9751a58d449a4f1947aa4c510c500b5e98dcf3d2789807328930bcd87569981f81695777f6890f442b4f599c675acf6341
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  CHANGELOG of Itamae::Kitchen
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Plugin shoud work under bundler.
6
+ - if exist Gemfile in Kitchen/, itamae run under bundler.
7
+
3
8
  ## 0.1.0
4
9
 
5
10
  - Use run_list instead of recipe_list.
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Itamae
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -21,7 +21,10 @@ module Kitchen
21
21
  default_config :node_json, nil
22
22
  default_config :with_ohai, false
23
23
  default_config :itamae_option, nil
24
- default_config :itamae_plugins, []
24
+ default_config :use_bundler do |provisioner|
25
+ config = provisioner.instance_variable_get(:@config)
26
+ File.exists?(File.join(config[:itamae_root], 'Gemfile'))
27
+ end
25
28
 
26
29
  # (see Base#create_sandbox)
27
30
  def create_sandbox
@@ -34,17 +37,31 @@ module Kitchen
34
37
  cmd = []
35
38
  cmd << "#{sudo("rm")} -rf #{config[:root_path]} ; mkdir -p #{config[:root_path]}"
36
39
  debug("Cleanup Kitchen Root")
37
- config[:itamae_plugins].map do |plugin|
38
- cmd << %Q{#{sudo('chef-apply')} -e "chef_gem %Q{itamae-plugin-recipe-#{plugin}} do action :upgrade end"}
39
- end
40
+ Util.wrap_command(cmd.join("\n"))
41
+ end
42
+
43
+ # (see Base#init_command)
44
+ def prepare_command
45
+ return nil unless config[:use_bundler]
46
+ debug("Prepare Bundler")
47
+ cmd = ["cd #{config[:root_path]};"]
48
+ cmd << "if [ -f Gemfile ] ;then"
49
+ cmd << "#{sudo("/opt/chef/embedded/bin/bundle")} install --binstubs"
50
+ cmd << "fi"
40
51
  Util.wrap_command(cmd.join("\n"))
41
52
  end
42
53
 
43
54
  # (see Base#run_command)
44
55
  def run_command
45
56
  debug(JSON.pretty_generate(config))
46
- runlist = config[:run_list].map do |recipe|
47
- cmd = ["cd #{config[:root_path]};", sudo('/opt/chef/bin/itamae')]
57
+ lines = config[:run_list].map do |recipe|
58
+ cmd = ["cd #{config[:root_path]} ;"]
59
+ if config[:use_bundler]
60
+ cmd << sudo(File.join(config[:chef_omnibus_bin_dir], 'ruby'))
61
+ cmd << './bin/itamae'
62
+ else
63
+ cmd << sudo('/opt/chef/bin/itamae')
64
+ end
48
65
  cmd << 'local'
49
66
  cmd << '--ohai' if config[:with_ohai]
50
67
  cmd << config[:itamae_option]
@@ -52,8 +69,8 @@ module Kitchen
52
69
  cmd << recipe
53
70
  cmd.join(" ")
54
71
  end
55
- debug(runlist.join("\n"))
56
- Util.wrap_command(runlist.join("\n"))
72
+ debug(lines.join("\n"))
73
+ Util.wrap_command(lines.join("\n"))
57
74
  end
58
75
 
59
76
 
@@ -104,10 +121,10 @@ module Kitchen
104
121
  def itamae_install_function
105
122
  <<-INSTALL_ITAMAE
106
123
  cat <<EOL > /tmp/install_itamae.sh
107
- %Q{#{sudo('chef-apply')} -e "chef_gem %Q{itamae} do action :upgrade end"}
108
- ln -sf /opt/chef/embedded/bin/itamae /opt/chef/bin/itamae
124
+ #{sudo('chef-apply')} -e "chef_gem %Q{itamae} do action :upgrade end"
125
+ ln -sf /opt/chef/embedded/bin/itamae /opt/chef/bin/itamae
109
126
  EOL
110
- #{sudo("sh")} /tmp/install_itamae.sh
127
+ #{sudo("sh")} /tmp/install_itamae.sh
111
128
  INSTALL_ITAMAE
112
129
  end
113
130
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly