chef_cap 0.3.21 → 0.3.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ChefCap
2
- VERSION = "0.3.21"
2
+ VERSION = "0.3.22"
3
3
  end
data/recipes/chef_cap.rb CHANGED
@@ -172,10 +172,10 @@ namespace :chef do
172
172
  case ruby_version_switcher
173
173
  when 'rbenv'
174
174
  gem_check_for_chef_cmd = "gem specification --version '>=#{chef_version}' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
175
- install_chef_cmd = "gem install chef --no-ri --no-rdoc --version=#{chef_version}"
176
- run "#{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
175
+ install_chef_cmd = "`cat #{rbenv_bin_path}` exec gem install chef --no-ri --no-rdoc --version=#{chef_version}"
176
+ run "`cat #{rbenv_bin_path}` exec #{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
177
177
 
178
- run "rbenv rehash"
178
+ run "`cat #{rbenv_bin_path}` rehash"
179
179
  else
180
180
  gem_check_for_chef_cmd = "gem specification --version '>=#{chef_version}' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
181
181
  install_chef_cmd = "sudo `cat #{rvm_bin_path}` default exec gem install chef --no-ri --no-rdoc --version=#{chef_version}"
data/recipes/rbenv.rb CHANGED
@@ -36,8 +36,8 @@ namespace :bootstrap do
36
36
  fi;
37
37
 
38
38
  # Install Ruby #{ruby_version}
39
- HAVE_CORRECT_VERSION=`rbenv versions | grep '#{ruby_version}' | wc -l`
40
- if [ $HAVE_CORRECT_VERSION -eq 0 ]; then
39
+ HAVE_CORRECT_VERSION=`rbenv versions | grep '#{ruby_version}'`
40
+ if [ $? != 0 ]; then
41
41
  echo "Installing Ruby dependencies..."
42
42
  sudo yum install -y automake gcc make libtool curl zlib zlib-devel patch readline readline-devel libffi-devel openssl openssl-devel
43
43
  echo "Installing #{ruby_version}..."
@@ -47,6 +47,7 @@ namespace :bootstrap do
47
47
  rbenv rehash
48
48
  fi;
49
49
 
50
+ echo "env RBENV_ROOT=`rbenv root` `which rbenv`" > /tmp/.chef_cap_rbenv_path
50
51
  rbenv versions | grep '#{ruby_version}'
51
52
  SH
52
53
  put standup_script, "/tmp/chef-cap-#{rails_env}-rbenv-standup.sh", :mode => "0700"
data/recipes/ruby.rb CHANGED
@@ -6,22 +6,20 @@ namespace :bootstrap do
6
6
 
7
7
  case local_rvs
8
8
  when 'rbenv'
9
-
10
- set :default_environment, {
11
- 'PATH' => "$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH:/usr/sbin"
12
- }
13
9
  set :ruby_version_switcher, "rbenv"
14
- set :exec_chef_solo, "chef-solo -c /tmp/chef-cap-solo-#{local_env}.rb #{debug_flag}"
10
+ set :rbenv_bin_path, "/tmp/.chef_cap_rbenv_path"
11
+ set :exec_chef_solo, "`cat #{rbenv_bin_path}` exec chef-solo -c /tmp/chef-cap-solo-#{local_env}.rb #{debug_flag}"
15
12
  else
16
13
  ## rvm is the default
17
- set :default_environment, {
18
- 'PATH' => "$PATH:/usr/sbin"
19
- }
20
14
  set :ruby_version_switcher, "rvm"
21
15
  set :rvm_bin_path, "/tmp/.chef_cap_rvm_path"
22
16
  set :exec_chef_solo, "`cat #{rvm_bin_path}` default exec chef-solo -c /tmp/chef-cap-solo-#{local_env}.rb #{debug_flag}"
23
17
  end
24
18
 
19
+ set :default_environment, {
20
+ 'PATH' => "$PATH:/usr/sbin"
21
+ }
22
+
25
23
  depend :remote, :command, ruby_version_switcher
26
24
  depend :remote, :command, "chef-solo"
27
25
 
@@ -567,8 +567,8 @@ describe "chef_cap" do
567
567
  it "sets up chef gem" do
568
568
  chef_cap.cap_servers.should_not be_empty
569
569
  chef_cap.stub!(:put => "stubbed")
570
- chef_cap.should_receive(:run).ordered.with("gem specification --version '>=0.1982.1234' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || gem install chef --no-ri --no-rdoc --version=0.1982.1234 && echo 'Chef Solo already on this server.'").and_return("mocked")
571
- chef_cap.should_receive(:run).ordered.with("rbenv rehash").and_return("mocked")
570
+ chef_cap.should_receive(:run).ordered.with("`cat /tmp/.chef_cap_rbenv_path` exec gem specification --version '>=0.1982.1234' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || `cat /tmp/.chef_cap_rbenv_path` exec gem install chef --no-ri --no-rdoc --version=0.1982.1234 && echo 'Chef Solo already on this server.'").and_return("mocked")
571
+ chef_cap.should_receive(:run).ordered.with("`cat /tmp/.chef_cap_rbenv_path` rehash").and_return("mocked")
572
572
 
573
573
  chef_cap.cap_task["bootstrap:ruby"].call
574
574
  chef_cap.cap_task["chef:setup"].call
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef_cap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.21
4
+ version: 0.3.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-07 00:00:00.000000000 Z
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: -2284293794674895370
106
+ hash: -1470809278621786492
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  segments:
114
114
  - 0
115
- hash: -2284293794674895370
115
+ hash: -1470809278621786492
116
116
  requirements: []
117
117
  rubyforge_project:
118
118
  rubygems_version: 1.8.19