capstrap 0.2.1 → 0.2.2
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.
- data/CHANGELOG.markdown +7 -0
- data/README.markdown +4 -0
- data/lib/capistrano/ext/capstrap/chef.rb +8 -10
- data/lib/capistrano/ext/capstrap/core.rb +8 -0
- data/lib/capstrap/cli.rb +87 -34
- data/lib/capstrap/version.rb +1 -1
- data/lib/capstrap.rb +1 -0
- metadata +4 -4
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.2.2
|
2
|
+
|
3
|
+
* Add task method options for overriding git init/update behavior
|
4
|
+
* Add version task
|
5
|
+
* Update method_option from :banner to :desc (oops)
|
6
|
+
* Handle git submodule init/update or rake update strategies
|
7
|
+
|
1
8
|
# 0.2.1
|
2
9
|
|
3
10
|
* Add `update` task to pull new cookbook and configuration updates and re-run chef
|
data/README.markdown
CHANGED
@@ -54,6 +54,10 @@ To set some other crazy configuration (the full monty with cheese):
|
|
54
54
|
--config-repo=git://github.com/fnichol/chef-dna-spike.git \
|
55
55
|
--config-path=/opt/chef/config
|
56
56
|
|
57
|
+
To pull new cookbook/configuration updates and run chef-solo:
|
58
|
+
|
59
|
+
capstrap update root@zland
|
60
|
+
|
57
61
|
To get more help:
|
58
62
|
|
59
63
|
capstrap help
|
@@ -22,12 +22,12 @@ module Capstrap
|
|
22
22
|
task :cookbooks do
|
23
23
|
unless cookbooks_repo_installed?
|
24
24
|
cmd = [
|
25
|
+
%{use #{ruby}},
|
25
26
|
%{git clone #{cookbooks_repo} #{cookbooks_path}},
|
26
27
|
%{cd #{cookbooks_path}},
|
27
|
-
|
28
|
-
%{git submodule update}
|
28
|
+
update_cmd
|
29
29
|
]
|
30
|
-
|
30
|
+
rvm_run cmd.join(" && ")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,12 +35,12 @@ module Capstrap
|
|
35
35
|
task :config do
|
36
36
|
unless config_repo_installed?
|
37
37
|
cmd = [
|
38
|
+
%{use #{ruby}},
|
38
39
|
%{git clone #{config_repo} #{config_path}},
|
39
40
|
%{cd #{config_path}},
|
40
|
-
|
41
|
-
%{git submodule update}
|
41
|
+
update_cmd
|
42
42
|
]
|
43
|
-
|
43
|
+
rvm_run cmd.join(" && ")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -62,11 +62,9 @@ module Capstrap
|
|
62
62
|
%{use #{ruby}},
|
63
63
|
%{cd #{cookbooks_path}},
|
64
64
|
%{git pull},
|
65
|
-
|
66
|
-
%{git submodule update},
|
65
|
+
update_cmd,
|
67
66
|
%{cd #{config_path}},
|
68
|
-
|
69
|
-
%{git submodule update},
|
67
|
+
update_cmd,
|
70
68
|
%{cd},
|
71
69
|
%{chef-solo}
|
72
70
|
]
|
@@ -95,6 +95,14 @@ def config_repo_installed?
|
|
95
95
|
cmd_test %{-d "#{config_path}"}
|
96
96
|
end
|
97
97
|
|
98
|
+
def update_cmd
|
99
|
+
if cookbooks_rake_update
|
100
|
+
%{rake update}
|
101
|
+
else
|
102
|
+
%{git submodule init && git submodule update}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
98
106
|
##
|
99
107
|
# Prints an information message.
|
100
108
|
#
|
data/lib/capstrap/cli.rb
CHANGED
@@ -6,11 +6,16 @@ module Capstrap
|
|
6
6
|
end
|
7
7
|
|
8
8
|
default_task :help
|
9
|
+
|
10
|
+
desc "version", "Version of capstrap"
|
11
|
+
def version
|
12
|
+
puts "capstrap v#{Capstrap::VERSION}"
|
13
|
+
end
|
9
14
|
|
10
15
|
desc "ruby HOST", "Install an RVM ruby on remote SSH host HOST"
|
11
|
-
method_option "ruby", :type => :string, :
|
16
|
+
method_option "ruby", :type => :string, :desc =>
|
12
17
|
"Version of ruby to install.", :default => "ree-1.8.7"
|
13
|
-
method_option "default", :type => :boolean, :
|
18
|
+
method_option "default", :type => :boolean, :desc =>
|
14
19
|
"Set this ruby to be RVM default."
|
15
20
|
def ruby(ssh_host)
|
16
21
|
@ssh_host = ssh_host
|
@@ -25,7 +30,7 @@ module Capstrap
|
|
25
30
|
end
|
26
31
|
|
27
32
|
desc "chef HOST", "Install chef gem on remote SSH host HOST"
|
28
|
-
method_option "ruby", :type => :string, :
|
33
|
+
method_option "ruby", :type => :string, :desc =>
|
29
34
|
"Version of ruby to install.", :default => "ree-1.8.7"
|
30
35
|
def chef(ssh_host)
|
31
36
|
@ssh_host = ssh_host
|
@@ -38,18 +43,32 @@ module Capstrap
|
|
38
43
|
end
|
39
44
|
|
40
45
|
desc "solo HOST", "Install chef cookbooks & config on remote SSH host HOST"
|
41
|
-
method_option "ruby", :type => :string,
|
42
|
-
"Version of ruby to install.",
|
43
|
-
|
44
|
-
|
46
|
+
method_option "ruby", :type => :string,
|
47
|
+
:desc => "Version of ruby to install.",
|
48
|
+
:default => "ree-1.8.7",
|
49
|
+
:aliases => "-r"
|
50
|
+
method_option "cookbooks-repo", :type => :string,
|
51
|
+
:desc => "Chef cookbooks git repository URL.",
|
52
|
+
:aliases => "-c"
|
45
53
|
method_option "cookbooks-path", :type => :string,
|
46
|
-
:
|
47
|
-
:default => "/var/chef-solo"
|
48
|
-
|
49
|
-
|
54
|
+
:desc => "Install path to chef cookbooks git repository.",
|
55
|
+
:default => "/var/chef-solo",
|
56
|
+
:aliases => "-p"
|
57
|
+
method_option "cookbooks-rake-update", :type => :boolean, :desc =>
|
58
|
+
"Run rake update vs. git submodule init/update when updating cookbooks repo",
|
59
|
+
:default => false,
|
60
|
+
:aliases => "-u"
|
61
|
+
method_option "config-repo", :type => :string,
|
62
|
+
:desc => "Chef configuration git repository URL.",
|
63
|
+
:aliases => "-C"
|
50
64
|
method_option "config-path", :type => :string,
|
51
|
-
:
|
52
|
-
:default => "/etc/chef"
|
65
|
+
:desc => "Install path to chef configuration git repository.",
|
66
|
+
:default => "/etc/chef",
|
67
|
+
:aliases => "-P"
|
68
|
+
method_option "config-rake-update", :type => :boolean, :desc =>
|
69
|
+
"Run rake update vs. git submodule init/update when updating config repo",
|
70
|
+
:default => false,
|
71
|
+
:aliases => "-U"
|
53
72
|
def solo(ssh_host)
|
54
73
|
@ssh_host = ssh_host
|
55
74
|
abort ">> HOST must be set" unless @ssh_host
|
@@ -69,18 +88,32 @@ module Capstrap
|
|
69
88
|
end
|
70
89
|
|
71
90
|
desc "execute HOST", "Executes chef solo config on remote SSH host HOST"
|
72
|
-
method_option "ruby", :type => :string,
|
73
|
-
"Version of ruby to install.",
|
74
|
-
|
75
|
-
|
91
|
+
method_option "ruby", :type => :string,
|
92
|
+
:desc => "Version of ruby to install.",
|
93
|
+
:default => "ree-1.8.7",
|
94
|
+
:aliases => "-r"
|
95
|
+
method_option "cookbooks-repo", :type => :string,
|
96
|
+
:desc => "Chef cookbooks git repository URL.",
|
97
|
+
:aliases => "-c"
|
76
98
|
method_option "cookbooks-path", :type => :string,
|
77
|
-
:
|
78
|
-
:default => "/var/chef-solo"
|
79
|
-
|
80
|
-
|
99
|
+
:desc => "Install path to chef cookbooks git repository.",
|
100
|
+
:default => "/var/chef-solo",
|
101
|
+
:aliases => "-p"
|
102
|
+
method_option "cookbooks-rake-update", :type => :boolean, :desc =>
|
103
|
+
"Run rake update vs. git submodule init/update when updating cookbooks repo",
|
104
|
+
:default => false,
|
105
|
+
:aliases => "-u"
|
106
|
+
method_option "config-repo", :type => :string,
|
107
|
+
:desc => "Chef configuration git repository URL.",
|
108
|
+
:aliases => "-C"
|
81
109
|
method_option "config-path", :type => :string,
|
82
|
-
:
|
83
|
-
:default => "/etc/chef"
|
110
|
+
:desc => "Install path to chef configuration git repository.",
|
111
|
+
:default => "/etc/chef",
|
112
|
+
:aliases => "-P"
|
113
|
+
method_option "config-rake-update", :type => :boolean, :desc =>
|
114
|
+
"Run rake update vs. git submodule init/update when updating config repo",
|
115
|
+
:default => false,
|
116
|
+
:aliases => "-U"
|
84
117
|
def execute(ssh_host)
|
85
118
|
@ssh_host = ssh_host
|
86
119
|
abort ">> HOST must be set" unless @ssh_host
|
@@ -103,14 +136,26 @@ module Capstrap
|
|
103
136
|
end
|
104
137
|
|
105
138
|
desc "update HOST", "Updates and executes chef solo on remote SSH host HOST"
|
106
|
-
method_option "ruby", :type => :string,
|
107
|
-
"Version of ruby to install.",
|
139
|
+
method_option "ruby", :type => :string,
|
140
|
+
:desc => "Version of ruby to install.",
|
141
|
+
:default => "ree-1.8.7",
|
142
|
+
:aliases => "-r"
|
108
143
|
method_option "cookbooks-path", :type => :string,
|
109
|
-
:
|
110
|
-
:default => "/var/chef-solo"
|
144
|
+
:desc => "Install path to chef cookbooks git repository.",
|
145
|
+
:default => "/var/chef-solo",
|
146
|
+
:aliases => "-p"
|
147
|
+
method_option "cookbooks-rake-update", :type => :boolean, :desc =>
|
148
|
+
"Run rake update vs. git submodule init/update when updating cookbooks repo",
|
149
|
+
:default => false,
|
150
|
+
:aliases => "-u"
|
111
151
|
method_option "config-path", :type => :string,
|
112
|
-
:
|
113
|
-
:default => "/etc/chef"
|
152
|
+
:desc => "Install path to chef configuration git repository.",
|
153
|
+
:default => "/etc/chef",
|
154
|
+
:aliases => "-P"
|
155
|
+
method_option "config-rake-update", :type => :boolean, :desc =>
|
156
|
+
"Run rake update vs. git submodule init/update when updating config repo",
|
157
|
+
:default => false,
|
158
|
+
:aliases => "-U"
|
114
159
|
def update(ssh_host)
|
115
160
|
@ssh_host = ssh_host
|
116
161
|
abort ">> HOST must be set" unless @ssh_host
|
@@ -141,14 +186,22 @@ module Capstrap
|
|
141
186
|
|
142
187
|
def setup_config(options)
|
143
188
|
[
|
144
|
-
{:sym => :ruby,
|
145
|
-
{:sym => :cookbooks_repo,
|
146
|
-
{:sym => :cookbooks_path,
|
147
|
-
{:sym => :config_repo,
|
148
|
-
{:sym => :config_path,
|
189
|
+
{:sym => :ruby, :opt => "ruby"},
|
190
|
+
{:sym => :cookbooks_repo, :opt => "cookbooks-repo"},
|
191
|
+
{:sym => :cookbooks_path, :opt => "cookbooks-path"},
|
192
|
+
{:sym => :config_repo, :opt => "config-repo"},
|
193
|
+
{:sym => :config_path, :opt => "config-path"}
|
149
194
|
].each do |var|
|
150
195
|
config.set(var[:sym], options[var[:opt]]) if options[var[:opt]]
|
151
196
|
end
|
197
|
+
|
198
|
+
# booleans
|
199
|
+
[
|
200
|
+
{:sym => :cookbooks_rake_update, :opt => "cookbooks-rake-update"},
|
201
|
+
{:sym => :config_rake_update, :opt => "config-rake-update"}
|
202
|
+
].each do |var|
|
203
|
+
config.set(var[:sym], options[var[:opt]])
|
204
|
+
end
|
152
205
|
end
|
153
206
|
end
|
154
207
|
end
|
data/lib/capstrap/version.rb
CHANGED
data/lib/capstrap.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Fletcher Nichol
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-20 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|