rvm-capistrano 1.3.0.rc4 → 1.3.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module RVM
2
2
  class Capistrano
3
- VERSION="1.3.0.rc4"
3
+ VERSION="1.3.0.rc5"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ module Capistrano
10
10
  end
11
11
  end
12
12
 
13
- set :default_shell do
13
+ set :rvm_shell do
14
14
  shell = File.join(rvm_bin_path, "rvm-shell")
15
15
  ruby = rvm_ruby_string.to_s.strip
16
16
  case ruby
@@ -25,6 +25,33 @@ module Capistrano
25
25
  end
26
26
  shell
27
27
  end
28
+ if fetch(:rvm_require_role,nil).nil?
29
+ set :default_shell, fetch(:rvm_shell)
30
+ else
31
+ class << self
32
+ def run(cmd, options={}, &block)
33
+ if options[:eof].nil? && !cmd.include?(sudo)
34
+ options = options.merge(:eof => !block_given?)
35
+ end
36
+ shell = options[:shell]
37
+ options[:shell] = false
38
+
39
+ parallel(options) do |session|
40
+ if shell.nil?
41
+ session.when "in?(:#{fetch(:rvm_require_role,nil)})", command_with_shell(cmd, fetch(:rvm_shell)), &block
42
+ end
43
+ session.else command_with_shell(cmd, shell), &block
44
+ end
45
+ end
46
+ def command_with_shell(cmd, shell=nil)
47
+ if shell == false
48
+ cmd
49
+ else
50
+ "#{shell || "sh"} -c '#{cmd.gsub(/'/) { |m| "'\\''" }}'"
51
+ end
52
+ end
53
+ end
54
+ end
28
55
 
29
56
  # Let users set the type of their rvm install.
30
57
  _cset(:rvm_type, :user)
@@ -111,9 +138,9 @@ module Capistrano
111
138
 
112
139
  def rvm_task(name,&block)
113
140
  if fetch(:rvm_require_role,nil).nil?
114
- task name, block
141
+ task name, &block
115
142
  else
116
- task name, :roles => fetch(:rvm_require_role), block
143
+ task name, :roles => fetch(:rvm_require_role), &block
117
144
  end
118
145
  end
119
146
 
@@ -127,7 +154,7 @@ module Capistrano
127
154
 
128
155
  set :rvm_install_shell, :zsh
129
156
  EOF
130
- rvm_task :install_rvm, :roles => :rvm do
157
+ rvm_task :install_rvm do
131
158
  command_fetch = "curl -L get.rvm.io"
132
159
  command_install = case rvm_type
133
160
  when :root, :system
@@ -161,7 +188,7 @@ module Capistrano
161
188
 
162
189
  set :rvm_install_shell, :zsh
163
190
  EOF
164
- rvm_task :install_ruby, :roles => :rvm do
191
+ rvm_task :install_ruby do
165
192
  ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
166
193
  if %w( release_path default ).include? "#{ruby}"
167
194
  raise "ruby can not be installed when using :rvm_ruby_string => :#{ruby}"
@@ -186,14 +213,14 @@ module Capistrano
186
213
 
187
214
  Full list of packages available at https://rvm.io/packages/ or by running 'rvm pkg'.
188
215
  EOF
189
- rvm_task :install_pkgs, :roles => :rvm do
216
+ rvm_task :install_pkgs do
190
217
  rvm_install_pkgs.each do |pkg|
191
218
  run "#{File.join(rvm_bin_path, "rvm")} pkg install #{pkg}", :shell => "#{rvm_install_shell}"
192
219
  end
193
220
  end
194
221
 
195
222
  desc "Create gemset"
196
- rvm_task :create_gemset, :roles => :rvm do
223
+ rvm_task :create_gemset do
197
224
  ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
198
225
  if %w( release_path default ).include? "#{ruby}"
199
226
  raise "gemset can not be created when using :rvm_ruby_string => :#{ruby}"
@@ -212,7 +239,7 @@ module Capistrano
212
239
 
213
240
  The gemset can be created with 'cap rvm:gemset_export'.
214
241
  EOF
215
- rvm_task :import_gemset, :roles => :rvm do
242
+ rvm_task :import_gemset do
216
243
  ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
217
244
  if %w( release_path default ).include? "#{ruby}"
218
245
  raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
@@ -231,7 +258,7 @@ module Capistrano
231
258
 
232
259
  The gemset can be imported with 'cap rvm:gemset_import'.
233
260
  EOF
234
- rvm_task :export_gemset, :roles => :rvm do
261
+ rvm_task :export_gemset do
235
262
  ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
236
263
  if %w( release_path default ).include? "#{ruby}"
237
264
  raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
@@ -243,12 +270,12 @@ module Capistrano
243
270
  end
244
271
 
245
272
  desc "Install a gem, 'cap rvm:install_gem GEM=my_gem'."
246
- rvm_task :install_gem, :roles => :rvm do
273
+ rvm_task :install_gem do
247
274
  run "#{File.join(rvm_bin_path, "rvm")} #{rvm_ruby_string} do gem install #{ENV['GEM']}", :shell => "#{rvm_install_shell}"
248
275
  end
249
276
 
250
277
  desc "Uninstall a gem, 'cap rvm:uninstall_gem GEM=my_gem'."
251
- rvm_task :uninstall_gem, :roles => :rvm do
278
+ rvm_task :uninstall_gem do
252
279
  run "#{File.join(rvm_bin_path, "rvm")} #{rvm_ruby_string} do gem uninstall --no-executables #{ENV['GEM']}", :shell => "#{rvm_install_shell}"
253
280
  end
254
281
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- hash: -765880092
4
+ hash: -711357732
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
9
  - 0
10
10
  - rc
11
- - 4
12
- version: 1.3.0.rc4
11
+ - 5
12
+ version: 1.3.0.rc5
13
13
  platform: ruby
14
14
  authors:
15
15
  - Wayne E. Seguin
@@ -18,8 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-12-16 00:00:00 +01:00
22
- default_executable:
21
+ date: 2013-02-11 00:00:00 Z
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
25
24
  name: capistrano
@@ -84,7 +83,6 @@ files:
84
83
  - lib/rvm/capistrano.rb
85
84
  - lib/rvm/capistrano/version.rb
86
85
  - spec/spec_helper.rb
87
- has_rdoc: true
88
86
  homepage: https://rvm.beginrescueend.com/integration/capistrano
89
87
  licenses:
90
88
  - MIT
@@ -116,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
114
  requirements: []
117
115
 
118
116
  rubyforge_project:
119
- rubygems_version: 1.4.2
117
+ rubygems_version: 1.8.24
120
118
  signing_key:
121
119
  specification_version: 3
122
120
  summary: RVM / Capistrano Integration Gem