rvm-capistrano 1.3.2 → 1.3.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rvm/capistrano.rb +32 -6
- data/lib/rvm/capistrano/version.rb +1 -1
- metadata +13 -9
data/lib/rvm/capistrano.rb
CHANGED
@@ -10,6 +10,12 @@ module Capistrano
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
class << self
|
14
|
+
def quote_and_escape(text, quote = "'")
|
15
|
+
"#{quote}#{text.gsub(/#{quote}/) { |m| "#{quote}\\#{quote}#{quote}" }}#{quote}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
13
19
|
_cset :rvm_shell do
|
14
20
|
shell = File.join(rvm_bin_path, "rvm-shell")
|
15
21
|
ruby = fetch(:rvm_ruby_string_evaluated).strip
|
@@ -49,7 +55,7 @@ module Capistrano
|
|
49
55
|
if shell == false
|
50
56
|
cmd
|
51
57
|
else
|
52
|
-
"#{shell || "sh"} -c
|
58
|
+
"#{shell || "sh"} -c #{quote_and_escape(cmd)}"
|
53
59
|
end
|
54
60
|
end
|
55
61
|
end
|
@@ -137,16 +143,31 @@ module Capistrano
|
|
137
143
|
EOF
|
138
144
|
end
|
139
145
|
|
140
|
-
def rvm_if_sudo
|
146
|
+
def rvm_if_sudo(options = {})
|
141
147
|
case rvm_type
|
142
148
|
when :root, :system
|
143
149
|
if fetch(:use_sudo, true) == false && rvm_install_with_sudo == false
|
144
|
-
|
150
|
+
explanation = <<-EXPLANATION
|
151
|
+
You can enable use_sudo within rvm for use only by this install operation by adding to deploy.rb:
|
152
|
+
|
153
|
+
set :rvm_install_with_sudo, true
|
154
|
+
|
155
|
+
EXPLANATION
|
156
|
+
if options[:deferred]
|
157
|
+
<<-DEFERRED_ERROR.gsub(/\n/, " ; ")
|
158
|
+
echo "
|
159
|
+
Neither :use_sudo or :rvm_install_with_sudo was set and installation would ended up in using 'sudo'
|
160
|
+
#{explanation}
|
161
|
+
" >&2
|
162
|
+
exit 1
|
163
|
+
DEFERRED_ERROR
|
164
|
+
else
|
165
|
+
raise "
|
145
166
|
|
146
167
|
:use_sudo is set to 'false' but sudo is needed to install rvm_type: #{rvm_type}.
|
147
|
-
|
148
|
-
|
168
|
+
#{explanation}
|
149
169
|
"
|
170
|
+
end
|
150
171
|
else
|
151
172
|
"#{sudo} "
|
152
173
|
end
|
@@ -158,7 +179,12 @@ You can enable use_sudo within rvm for use only by this install operation by add
|
|
158
179
|
def with_rvm_group(command)
|
159
180
|
case rvm_type
|
160
181
|
when :root, :system
|
161
|
-
"
|
182
|
+
<<-CODE.gsub(/\n/, " ; ")
|
183
|
+
if id | grep ' groups=.*(rvm)' >/dev/null
|
184
|
+
then #{command}
|
185
|
+
else #{rvm_if_sudo(:deferred=>true)} sg rvm -c #{quote_and_escape(command)}
|
186
|
+
fi
|
187
|
+
CODE
|
162
188
|
else
|
163
189
|
command
|
164
190
|
end
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvm-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3235495021
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
|
9
|
+
- 3
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.3.3.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Wayne E. Seguin
|
@@ -16,7 +18,7 @@ autorequire:
|
|
16
18
|
bindir: bin
|
17
19
|
cert_chain: []
|
18
20
|
|
19
|
-
date: 2013-06-
|
21
|
+
date: 2013-06-26 00:00:00 +02:00
|
20
22
|
default_executable:
|
21
23
|
dependencies:
|
22
24
|
- !ruby/object:Gem::Dependency
|
@@ -103,12 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
106
|
none: false
|
105
107
|
requirements:
|
106
|
-
- - "
|
108
|
+
- - ">"
|
107
109
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
110
|
+
hash: 25
|
109
111
|
segments:
|
110
|
-
-
|
111
|
-
|
112
|
+
- 1
|
113
|
+
- 3
|
114
|
+
- 1
|
115
|
+
version: 1.3.1
|
112
116
|
requirements: []
|
113
117
|
|
114
118
|
rubyforge_project:
|