capistrano_chef_solo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -46,6 +46,7 @@ a simple VM first.
46
46
  ## Todo
47
47
 
48
48
  * Support roles in both Capistrano and Chef.
49
+ * Support remote cookbooks
49
50
 
50
51
  ## Tips
51
52
 
@@ -256,6 +256,7 @@ Capistrano::Configuration.instance(:must_exist).load do
256
256
  if run_list.empty?
257
257
  abort "Please specify a run list, before('deploy') { chef.solo('recipe[foo]', 'recipe[bar]') }"
258
258
  end
259
+ ensure_cookbooks
259
260
  default
260
261
  deploy.setup
261
262
  run "mkdir -p /tmp/chef"
@@ -265,14 +266,18 @@ Capistrano::Configuration.instance(:must_exist).load do
265
266
  stream_or_run "#{sudo} chef-solo -c /tmp/chef/solo.rb -j /tmp/chef/solo.json"
266
267
  end
267
268
 
268
- def cookbooks
269
- fetch :cookbooks do
270
- [ "config/cookbooks", "vendor/cookbooks" ].select { |path| File.exist?(path) }
269
+ def ensure_cookbooks
270
+ if cookbooks.empty?
271
+ abort "Please put some cookbooks in `config/cookbooks` or `vendor/cookbooks` or set :cookbooks to a path where the cookbooks are located"
271
272
  end
272
273
  end
273
274
 
275
+ def cookbooks
276
+ Array(fetch(:cookbooks) { [ "config/cookbooks", "vendor/cookbooks" ].select { |path| File.exist?(path) } })
277
+ end
278
+
274
279
  def generate_config
275
- cookbook_paths = Array(cookbooks).map { |c| "File.join(root, #{c.to_s.inspect})" }.join(', ')
280
+ cookbook_paths = cookbooks.map { |c| "File.join(root, #{c.to_s.inspect})" }.join(', ')
276
281
  solo_rb = <<-RUBY
277
282
  root = File.absolute_path(File.dirname(__FILE__))
278
283
  file_cache_path File.join(root, "cache")
@@ -304,7 +309,7 @@ Capistrano::Configuration.instance(:must_exist).load do
304
309
  tar_file = Tempfile.new("cookbooks.tar")
305
310
  begin
306
311
  tar_file.close
307
- system "tar -cjf #{tar_file.path} #{Array(cookbooks).join(' ')}"
312
+ system "tar -cjf #{tar_file.path} #{cookbooks.join(' ')}"
308
313
  upload tar_file.path, "/tmp/chef/cookbooks.tar", :via => :scp
309
314
  run "cd /tmp/chef && tar -xjf cookbooks.tar"
310
315
  ensure
@@ -1,3 +1,3 @@
1
1
  module CapistranoChefSolo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2173516120 !ruby/object:Gem::Requirement
16
+ requirement: &2165615400 !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: *2173516120
24
+ version_requirements: *2165615400
25
25
  description: This gem provides Capistrano tasks to run chef-solo with Capistrano,
26
26
  with hardly any configuration needed.
27
27
  email: