chef_cap 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef_cap/version.rb +1 -1
- data/recipes/chef_cap.rb +6 -4
- data/recipes/rvm_bootstrap.rb +10 -4
- data/spec/chef_cap_spec.rb +2 -2
- metadata +5 -3
data/lib/chef_cap/version.rb
CHANGED
data/recipes/chef_cap.rb
CHANGED
@@ -146,13 +146,15 @@ else
|
|
146
146
|
set :chef_version, default_chef_version
|
147
147
|
end
|
148
148
|
|
149
|
+
set :rvm_bin_path, "/tmp/.chef_cap_rvm_path"
|
150
|
+
|
149
151
|
namespace :chef do
|
150
152
|
desc "Setup chef solo on the server(s)"
|
151
153
|
task :setup do
|
152
154
|
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 }'"
|
153
|
-
install_chef_cmd = "sudo
|
154
|
-
sudo "
|
155
|
-
sudo "
|
155
|
+
install_chef_cmd = "sudo `cat #{rvm_bin_path}` default exec gem install chef --no-ri --no-rdoc"
|
156
|
+
sudo "`cat #{rvm_bin_path}` default exec #{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
|
157
|
+
sudo "`cat #{rvm_bin_path}` default exec which chef-solo"
|
156
158
|
end
|
157
159
|
|
158
160
|
desc "Run chef-solo on the server(s)"
|
@@ -198,7 +200,7 @@ namespace :chef do
|
|
198
200
|
|
199
201
|
task :run_chef_solo do
|
200
202
|
debug_flag = ENV['QUIET'] ? '' : '-l debug'
|
201
|
-
run_chef_solo = "env PATH=$PATH:/usr/sbin
|
203
|
+
run_chef_solo = "env PATH=$PATH:/usr/sbin `cat #{rvm_bin_path}` default exec chef-solo -c /tmp/chef-cap-solo-#{rails_env}.rb -j /tmp/chef-cap-#{rails_env}-`hostname`.json #{debug_flag}"
|
202
204
|
|
203
205
|
unless role_order.empty?
|
204
206
|
role_order.each do |role, dependent_roles|
|
data/recipes/rvm_bootstrap.rb
CHANGED
@@ -9,20 +9,26 @@ namespace :rvm do
|
|
9
9
|
rvm_standup_script = <<-SH
|
10
10
|
#!/bin/bash
|
11
11
|
RVM_URL="https://rvm.beginrescueend.com/install/rvm"
|
12
|
-
export PATH=$PATH:/usr/local/rvm/bin
|
12
|
+
export PATH=$PATH:/usr/local/rvm/bin:~/.rvm/bin
|
13
13
|
HAVE_RVM_ALREADY=`which rvm 2>/dev/null`
|
14
|
-
if [
|
15
|
-
echo "
|
14
|
+
if [ $? -eq 0 ]; then
|
15
|
+
echo "Found RVM: " `which rvm`
|
16
|
+
echo "Looks like RVM is already on this machine. Recording to /tmp/.chef_cap_rvm_path"
|
17
|
+
which rvm > /tmp/.chef_cap_rvm_path
|
16
18
|
exit 0
|
19
|
+
else
|
20
|
+
echo "Could not find RVM, PATH IS: ${PATH}"
|
21
|
+
echo "Going to attempt to attempt to download and install RVM from ${RVM_URL}"
|
17
22
|
fi
|
18
23
|
|
19
24
|
HAVE_CURL=`which curl 2>/dev/null`
|
20
|
-
if [
|
25
|
+
if [ $? -eq 0 ]; then
|
21
26
|
RVM_TEMP_FILE=`mktemp /tmp/rvm_bootstrap.XXXXXX`
|
22
27
|
curl $RVM_URL > $RVM_TEMP_FILE
|
23
28
|
chmod u+rx $RVM_TEMP_FILE
|
24
29
|
sh $RVM_TEMP_FILE
|
25
30
|
rm -f $RVM_TEMP_FILE
|
31
|
+
which rvm > /tmp/.chef_cap_rvm_path
|
26
32
|
else
|
27
33
|
echo "FATAL ERROR: I have no idea how to download RVM without curl!"
|
28
34
|
exit 1
|
data/spec/chef_cap_spec.rb
CHANGED
@@ -473,8 +473,8 @@ describe "chef_cap" do
|
|
473
473
|
|
474
474
|
it "sets up chef gem" do
|
475
475
|
chef_cap.cap_servers.should_not be_empty
|
476
|
-
chef_cap.should_receive(:sudo).ordered.with("
|
477
|
-
chef_cap.should_receive(:sudo).ordered.with("
|
476
|
+
chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec gem specification --version '>=0.1982.1234' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || sudo `cat /tmp/.chef_cap_rvm_path` default exec gem install chef --no-ri --no-rdoc && echo 'Chef Solo already on this server.'").and_return("mocked")
|
477
|
+
chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec which chef-solo").and_return("mocked")
|
478
478
|
chef_cap.cap_task["chef:setup"].call
|
479
479
|
end
|
480
480
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: chef_cap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Case Commons, LLC
|
@@ -10,7 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-16 00:00:00
|
13
|
+
date: 2011-06-16 00:00:00 -04:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: capistrano
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- spec/chef_cap_spec.rb
|
80
81
|
- spec/chef_dna_parser_spec.rb
|
81
82
|
- spec/spec_helper.rb
|
83
|
+
has_rdoc: true
|
82
84
|
homepage: https://github.com/Casecommons/chef_cap
|
83
85
|
licenses:
|
84
86
|
- MIT
|
@@ -102,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
104
|
requirements: []
|
103
105
|
|
104
106
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.6.2
|
106
108
|
signing_key:
|
107
109
|
specification_version: 3
|
108
110
|
summary: capistrano + chef-solo == chef_cap"
|