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 +1 -0
- data/lib/capistrano_chef_solo.rb +10 -5
- data/lib/capistrano_chef_solo/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
data/lib/capistrano_chef_solo.rb
CHANGED
@@ -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
|
269
|
-
|
270
|
-
|
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 =
|
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} #{
|
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
|
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
|
+
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: &
|
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: *
|
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:
|