capistrano_chef_solo 0.0.4 → 0.0.5

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.
@@ -138,16 +138,29 @@ Capistrano::Configuration.instance(:must_exist).load do
138
138
 
139
139
  desc "Performs a dist-upgrade on your system"
140
140
  task :dist_upgrade, :except => { :no_release => true } do
141
- stream_or_run "#{sudo} aptitude update"
142
- stream_or_run "#{sudo} apt-get -o Dpkg::Options::=\"--force-confnew\" --force-yes -fuy dist-upgrade"
141
+ case os
142
+ when "ubuntu"
143
+ stream_or_run "#{sudo} aptitude update"
144
+ stream_or_run "#{sudo} apt-get -o Dpkg::Options::=\"--force-confnew\" --force-yes -fuy dist-upgrade"
145
+ when "centos"
146
+ stream_or_run "#{sudo} yum update -y"
147
+ end
143
148
  end
144
149
 
145
150
  desc "Installs the dependencies to compile Ruby"
146
151
  task :dependencies, :except => { :no_release => true } do
147
- stream_or_run "#{sudo} aptitude install -y git-core curl build-essential bison openssl \
148
- libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev \
149
- libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev \
150
- vim wget tree" # this line not really dependencies, but who can live without them?
152
+ case os
153
+ when "ubuntu"
154
+ stream_or_run "#{sudo} aptitude install -y git-core curl build-essential bison openssl \
155
+ libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev \
156
+ libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev \
157
+ vim wget tree" # this line not really dependencies, but who can live without them?
158
+ when "centos"
159
+ stream_or_run "#{sudo} yum install -y git-core curl patch bison openssl \
160
+ readline readline-devel zlib zlib-devel openssl-devel \
161
+ libyaml-devel libxml2-devel libxslt-devel autoconf glibc-devel ncurses-devel \
162
+ vim wget tree" # this line not really dependencies, but who can live without them?
163
+ end
151
164
  end
152
165
 
153
166
  desc <<-DESC
@@ -247,7 +260,9 @@ Capistrano::Configuration.instance(:must_exist).load do
247
260
 
248
261
  desc "Install the gems needed for chef-solo"
249
262
  task :chef, :except => { :no_release => true } do
250
- run "#{sudo} gem install chef ruby-shadow --no-ri --no-rdoc"
263
+ chef_version = fetch :chef_version, ">= 0"
264
+ run "#{sudo} #{sudo_opts} gem install chef --version '#{chef_version}' --no-ri --no-rdoc"
265
+ run "#{sudo} #{sudo_opts} gem install ruby-shadow --no-ri --no-rdoc"
251
266
  end
252
267
 
253
268
  end
@@ -258,11 +273,22 @@ Capistrano::Configuration.instance(:must_exist).load do
258
273
  end
259
274
  ensure_cookbooks
260
275
  default
261
- run "mkdir -p /tmp/chef"
276
+ run "mkdir -p /tmp/chef/cache"
262
277
  generate_config
263
278
  generate_attributes(run_list)
264
279
  copy_cookbooks
265
- stream_or_run "#{sudo} chef-solo -c /tmp/chef/solo.rb -j /tmp/chef/solo.json"
280
+ stream_or_run "#{sudo} #{sudo_opts} chef-solo -c /tmp/chef/solo.rb -j /tmp/chef/solo.json"
281
+ end
282
+
283
+ def sudo_opts
284
+ case os
285
+ when "centos"
286
+ "env PATH=$PATH" # to fix missing paths when using sudo
287
+ end
288
+ end
289
+
290
+ def os
291
+ fetch(:os, "ubuntu")
266
292
  end
267
293
 
268
294
  def ensure_cookbooks
@@ -278,7 +304,7 @@ Capistrano::Configuration.instance(:must_exist).load do
278
304
  def generate_config
279
305
  cookbook_paths = cookbooks.map { |c| "File.join(root, #{c.to_s.inspect})" }.join(', ')
280
306
  solo_rb = <<-RUBY
281
- root = File.absolute_path(File.dirname(__FILE__))
307
+ root = File.expand_path(File.dirname(__FILE__))
282
308
  file_cache_path File.join(root, "cache")
283
309
  cookbook_path [ #{cookbook_paths} ]
284
310
  RUBY
@@ -308,7 +334,8 @@ Capistrano::Configuration.instance(:must_exist).load do
308
334
  tar_file = Tempfile.new("cookbooks.tar")
309
335
  begin
310
336
  tar_file.close
311
- system "tar -cjf #{tar_file.path} #{cookbooks.join(' ')}"
337
+ env_vars = fetch(:copyfile_disable, false) && RUBY_PLATFORM.downcase.include?('darwin') ? "COPYFILE_DISABLE=true" : ""
338
+ system "#{env_vars} tar -cjf #{tar_file.path} #{cookbooks.join(' ')}"
312
339
  upload tar_file.path, "/tmp/chef/cookbooks.tar", :via => :scp
313
340
  run "cd /tmp/chef && tar -xjf cookbooks.tar"
314
341
  ensure
@@ -1,3 +1,3 @@
1
1
  module CapistranoChefSolo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_chef_solo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2011-09-12 00:00:00.000000000Z
12
+ date: 2011-11-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2165623580 !ruby/object:Gem::Requirement
16
+ requirement: &2173526080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2165623580
24
+ version_requirements: *2173526080
25
25
  description: This gem provides Capistrano tasks to run chef-solo with Capistrano,
26
26
  with hardly any configuration needed.
27
27
  email:
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project: capistrano_chef_solo
61
- rubygems_version: 1.8.6
61
+ rubygems_version: 1.8.10
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: Combining the awesome powers of Capistrano and chef-solo