rvm-capistrano 1.3.0.rc8 → 1.3.0.rc9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rvm/capistrano/version.rb +1 -1
- data/lib/rvm/capistrano.rb +20 -12
- metadata +1 -1
data/lib/rvm/capistrano.rb
CHANGED
@@ -10,9 +10,9 @@ module Capistrano
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
_cset :rvm_shell do
|
14
14
|
shell = File.join(rvm_bin_path, "rvm-shell")
|
15
|
-
ruby =
|
15
|
+
ruby = fetch(:rvm_ruby_string_evaluated).strip
|
16
16
|
case ruby
|
17
17
|
when "release_path"
|
18
18
|
shell = "rvm_path=#{rvm_path} #{shell} --path '#{release_path}'"
|
@@ -26,7 +26,7 @@ module Capistrano
|
|
26
26
|
shell
|
27
27
|
end
|
28
28
|
if fetch(:rvm_require_role,nil).nil?
|
29
|
-
|
29
|
+
_cset :default_shell, fetch(:rvm_shell)
|
30
30
|
else
|
31
31
|
class << self
|
32
32
|
def run(cmd, options={}, &block)
|
@@ -83,11 +83,19 @@ module Capistrano
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
set :rvm_ruby_string_evaluated, do
|
87
|
+
value = fetch(:rvm_ruby_string, :default)
|
88
|
+
if value.to_sym == :local
|
89
|
+
value = ENV['GEM_HOME'].gsub(/.*\//,"")
|
90
|
+
end
|
91
|
+
value.to_s
|
92
|
+
end
|
93
|
+
|
86
94
|
# Let users configure a path to export/import gemsets
|
87
95
|
_cset(:rvm_gemset_path, "#{rvm_path}/gemsets")
|
88
96
|
|
89
97
|
# Use the default ruby on the server, by default :)
|
90
|
-
_cset(:rvm_ruby_string,
|
98
|
+
_cset(:rvm_ruby_string, :default)
|
91
99
|
|
92
100
|
# Default sudo state
|
93
101
|
_cset(:rvm_install_with_sudo, false)
|
@@ -189,7 +197,7 @@ module Capistrano
|
|
189
197
|
set :rvm_install_shell, :zsh
|
190
198
|
EOF
|
191
199
|
rvm_task :install_ruby do
|
192
|
-
ruby, gemset =
|
200
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split /@/
|
193
201
|
if %w( release_path default ).include? "#{ruby}"
|
194
202
|
raise "ruby can not be installed when using :rvm_ruby_string => :#{ruby}"
|
195
203
|
else
|
@@ -221,7 +229,7 @@ module Capistrano
|
|
221
229
|
|
222
230
|
desc "Create gemset"
|
223
231
|
rvm_task :create_gemset do
|
224
|
-
ruby, gemset =
|
232
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split /@/
|
225
233
|
if %w( release_path default ).include? "#{ruby}"
|
226
234
|
raise "gemset can not be created when using :rvm_ruby_string => :#{ruby}"
|
227
235
|
else
|
@@ -240,12 +248,12 @@ module Capistrano
|
|
240
248
|
The gemset can be created with 'cap rvm:gemset_export'.
|
241
249
|
EOF
|
242
250
|
rvm_task :import_gemset do
|
243
|
-
ruby, gemset =
|
251
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split /@/
|
244
252
|
if %w( release_path default ).include? "#{ruby}"
|
245
253
|
raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
|
246
254
|
else
|
247
255
|
if gemset
|
248
|
-
run "#{File.join(rvm_bin_path, "rvm-shell")} #{
|
256
|
+
run "#{File.join(rvm_bin_path, "rvm-shell")} #{fetch(:rvm_ruby_string_evaluated)} rvm gemset import #{File.join(rvm_gemset_path, "#{fetch(:rvm_ruby_string_evaluated)}.gems")}", :shell => "#{rvm_install_shell}"
|
249
257
|
end
|
250
258
|
end
|
251
259
|
end
|
@@ -259,24 +267,24 @@ module Capistrano
|
|
259
267
|
The gemset can be imported with 'cap rvm:gemset_import'.
|
260
268
|
EOF
|
261
269
|
rvm_task :export_gemset do
|
262
|
-
ruby, gemset =
|
270
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split /@/
|
263
271
|
if %w( release_path default ).include? "#{ruby}"
|
264
272
|
raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
|
265
273
|
else
|
266
274
|
if gemset
|
267
|
-
run "#{File.join(rvm_bin_path, "rvm-shell")} #{
|
275
|
+
run "#{File.join(rvm_bin_path, "rvm-shell")} #{fetch(:rvm_ruby_string_evaluated)} rvm gemset export > #{File.join(rvm_gemset_path, "#{fetch(:rvm_ruby_string_evaluated)}.gems")}", :shell => "#{rvm_install_shell}"
|
268
276
|
end
|
269
277
|
end
|
270
278
|
end
|
271
279
|
|
272
280
|
desc "Install a gem, 'cap rvm:install_gem GEM=my_gem'."
|
273
281
|
rvm_task :install_gem do
|
274
|
-
run "#{File.join(rvm_bin_path, "rvm")} #{
|
282
|
+
run "#{File.join(rvm_bin_path, "rvm")} #{fetch(:rvm_ruby_string_evaluated)} do gem install #{ENV['GEM']}", :shell => "#{rvm_install_shell}"
|
275
283
|
end
|
276
284
|
|
277
285
|
desc "Uninstall a gem, 'cap rvm:uninstall_gem GEM=my_gem'."
|
278
286
|
rvm_task :uninstall_gem do
|
279
|
-
run "#{File.join(rvm_bin_path, "rvm")} #{
|
287
|
+
run "#{File.join(rvm_bin_path, "rvm")} #{fetch(:rvm_ruby_string_evaluated)} do gem uninstall --no-executables #{ENV['GEM']}", :shell => "#{rvm_install_shell}"
|
280
288
|
end
|
281
289
|
|
282
290
|
end
|