yyuu-capistrano-chef-solo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capistrano-chef-solo.rb +21 -4
- data/lib/capistrano-chef-solo/version.rb +1 -1
- metadata +2 -2
data/lib/capistrano-chef-solo.rb
CHANGED
@@ -57,6 +57,7 @@ module Capistrano
|
|
57
57
|
task(:update) {
|
58
58
|
update_cookbook
|
59
59
|
update_config
|
60
|
+
update_attributes
|
60
61
|
invoke
|
61
62
|
}
|
62
63
|
|
@@ -64,7 +65,8 @@ module Capistrano
|
|
64
65
|
abort("chef_solo_cookbook_repository not set")
|
65
66
|
}
|
66
67
|
_cset(:chef_solo_cookbook_revision, 'HEAD')
|
67
|
-
|
68
|
+
_cset(:chef_solo_cookbooks_exclude, [])
|
69
|
+
task(:update_cookbook) { # TODO: refactor
|
68
70
|
git = fetch(:chef_solo_git, 'git')
|
69
71
|
tar = fetch(:chef_solo_tar, 'tar')
|
70
72
|
copy_dir = Dir.mktmpdir()
|
@@ -73,10 +75,23 @@ module Capistrano
|
|
73
75
|
remote_destination = File.join(chef_solo_path, 'cookbooks')
|
74
76
|
remote_filename = File.join('/tmp', File.basename(filename))
|
75
77
|
|
78
|
+
repository_cache = File.join(copy_dir, 'cached-copy')
|
79
|
+
if fetch(:chef_solo_cookbook_subdir, nil)
|
80
|
+
repository_cache_subdir = File.join(repository_cache, chef_solo_cookbook_subdir)
|
81
|
+
else
|
82
|
+
repository_cache_subdir = repository_cache
|
83
|
+
end
|
84
|
+
|
76
85
|
begin
|
77
86
|
checkout = []
|
78
|
-
checkout << "#{git} clone -q #{chef_solo_cookbook_repository} #{
|
79
|
-
checkout << "cd #{
|
87
|
+
checkout << "#{git} clone -q #{chef_solo_cookbook_repository} #{repository_cache}"
|
88
|
+
checkout << "cd #{repository_cache} && #{git} checkout -q -b deploy #{chef_solo_cookbook_revision}"
|
89
|
+
if chef_solo_cookbooks_exclude.empty?
|
90
|
+
checkout << "cp -RPp #{repository_cache_subdir} #{destination}"
|
91
|
+
else
|
92
|
+
exclusions = chef_solo_cookbooks_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ')
|
93
|
+
checkout << "rsync -lrpt #{exclusions} #{repository_cache_subdir} #{destination}"
|
94
|
+
end
|
80
95
|
run_locally(checkout.join(' && '))
|
81
96
|
|
82
97
|
copy = []
|
@@ -96,10 +111,12 @@ module Capistrano
|
|
96
111
|
cookbook_path #{File.join(chef_solo_path, 'cookbooks').dump}
|
97
112
|
EOS
|
98
113
|
}
|
99
|
-
_cset(:chef_solo_attributes, {})
|
100
114
|
task(:update_config) {
|
101
115
|
put(chef_solo_config, File.join(chef_solo_path, 'config', 'solo.rb'))
|
116
|
+
}
|
102
117
|
|
118
|
+
_cset(:chef_solo_attributes, {})
|
119
|
+
task(:update_attributes) {
|
103
120
|
attributes = chef_solo_attributes.merge('run_list' => fetch(:chef_solo_run_list, []))
|
104
121
|
put(attributes.to_json, File.join(chef_solo_path, 'config', 'solo.json'))
|
105
122
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yyuu-capistrano-chef-solo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|