chef_cap 0.3.11 → 0.3.12
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 +3 -0
- data/recipes/rbenv.rb +7 -7
- data/recipes/rvm.rb +3 -0
- data/spec/chef_cap_spec.rb +2 -0
- metadata +8 -8
data/lib/chef_cap/version.rb
CHANGED
data/recipes/chef_cap.rb
CHANGED
@@ -159,16 +159,19 @@ set :debug_flag, ENV['DEBUG'] ? '-l debug' : ''
|
|
159
159
|
|
160
160
|
namespace :chef do
|
161
161
|
task :setup do
|
162
|
+
bundler_install_cmd = "gem install bundler --no-ri --no-rdoc"
|
162
163
|
case ruby_version_switcher
|
163
164
|
when 'rbenv'
|
164
165
|
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 }'"
|
165
166
|
install_chef_cmd = "gem install chef --no-ri --no-rdoc"
|
166
167
|
run "#{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
|
168
|
+
run bundler_install_cmd
|
167
169
|
run "rbenv rehash"
|
168
170
|
else
|
169
171
|
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 }'"
|
170
172
|
install_chef_cmd = "sudo `cat #{rvm_bin_path}` default exec gem install chef --no-ri --no-rdoc"
|
171
173
|
sudo "`cat #{rvm_bin_path}` default exec #{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
|
174
|
+
sudo "`cat #{rvm_bin_path}` default exec #{bundler_install_cmd}"
|
172
175
|
sudo "`cat #{rvm_bin_path}` default exec which chef-solo"
|
173
176
|
end
|
174
177
|
end
|
data/recipes/rbenv.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
namespace :bootstrap do
|
2
2
|
desc "Create a standalone rbenv installation with a default ruby to use with chef-solo"
|
3
3
|
task :rbenv do
|
4
|
-
set :ruby_version, (ChefDnaParser.parsed["environment"]["ruby_version"] rescue "
|
5
|
-
|
4
|
+
set :ruby_version, (ChefDnaParser.parsed["environment"]["ruby_version"] rescue "1.9.3-p0" || "1.9.3-p0")
|
5
|
+
ruby_version.gsub!(/^ruby\-/,'')
|
6
6
|
standup_script = <<-SH
|
7
7
|
#!/bin/bash
|
8
8
|
#
|
@@ -32,14 +32,14 @@ namespace :bootstrap do
|
|
32
32
|
cd $HOME
|
33
33
|
fi;
|
34
34
|
|
35
|
-
# Install Ruby #{
|
36
|
-
HAVE_CORRECT_VERSION=`rbenv versions | grep '#{
|
35
|
+
# Install Ruby #{ruby_version}
|
36
|
+
HAVE_CORRECT_VERSION=`rbenv versions | grep '#{ruby_version}' | wc -l`
|
37
37
|
if [ $HAVE_CORRECT_VERSION -eq 0 ]; then
|
38
38
|
echo "Installing Ruby dependencies..."
|
39
39
|
sudo yum install -y automake gcc make libtool curl zlib zlib-devel patch readline readline-devel libffi-devel openssl openssl-devel
|
40
|
-
echo "Installing #{
|
41
|
-
rbenv install #{
|
42
|
-
rbenv global #{
|
40
|
+
echo "Installing #{ruby_version}..."
|
41
|
+
rbenv install #{ruby_version}
|
42
|
+
rbenv global #{ruby_version}
|
43
43
|
# Rehash!
|
44
44
|
rbenv rehash
|
45
45
|
fi;
|
data/recipes/rvm.rb
CHANGED
@@ -2,6 +2,9 @@ namespace :bootstrap do
|
|
2
2
|
desc "Create a standalone rvm installation with a default ruby to use with chef-solo"
|
3
3
|
task :rvm do
|
4
4
|
set :ruby_version, (ChefDnaParser.parsed["environment"]["ruby_version"] rescue "ruby-1.9.3-p0" || "ruby-1.9.3-p0")
|
5
|
+
if ruby_version =~ /^[0-9]/
|
6
|
+
ruby_version = "ruby-#{ruby_version}"
|
7
|
+
end
|
5
8
|
rvm_standup_script = <<-SH
|
6
9
|
#!/bin/bash
|
7
10
|
#
|
data/spec/chef_cap_spec.rb
CHANGED
@@ -485,6 +485,7 @@ describe "chef_cap" do
|
|
485
485
|
it "sets up chef gem" do
|
486
486
|
chef_cap.cap_servers.should_not be_empty
|
487
487
|
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")
|
488
|
+
chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec gem install bundler --no-ri --no-rdoc").and_return("mocked")
|
488
489
|
chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec which chef-solo").and_return("mocked")
|
489
490
|
|
490
491
|
chef_cap.cap_task["bootstrap:ruby"].call
|
@@ -536,6 +537,7 @@ describe "chef_cap" do
|
|
536
537
|
chef_cap.cap_servers.should_not be_empty
|
537
538
|
chef_cap.stub!(:put => "stubbed")
|
538
539
|
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 && echo 'Chef Solo already on this server.'").and_return("mocked")
|
540
|
+
chef_cap.should_receive(:run).ordered.with("gem install bundler --no-ri --no-rdoc").and_return("mocked")
|
539
541
|
chef_cap.should_receive(:run).ordered.with("rbenv rehash").and_return("mocked")
|
540
542
|
|
541
543
|
chef_cap.cap_task["bootstrap:ruby"].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.
|
4
|
+
version: 0.3.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2240072540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.5.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2240072540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &2240072040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.1'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2240072040
|
36
36
|
description: chef_cap uses chef"s JSON config format to drive both capistrano and
|
37
37
|
chef-solo"
|
38
38
|
email:
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash:
|
96
|
+
hash: -3829800426709448034
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash:
|
105
|
+
hash: -3829800426709448034
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 1.8.15
|