rvm-capistrano 1.3.3 → 1.3.4.rc1
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/README.md +6 -6
- data/lib/rvm/capistrano.rb +100 -82
- data/lib/rvm/capistrano/version.rb +1 -1
- metadata +14 -12
data/README.md
CHANGED
@@ -33,14 +33,14 @@ The following code will:
|
|
33
33
|
Example:
|
34
34
|
|
35
35
|
```ruby
|
36
|
+
require "rvm/capistrano"
|
37
|
+
|
36
38
|
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
|
37
39
|
set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
|
38
40
|
|
39
41
|
before 'deploy:setup', 'rvm:install_rvm' # install RVM
|
40
42
|
before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
|
41
43
|
# before 'deploy:setup', 'rvm:create_gemset' # only create gemset
|
42
|
-
|
43
|
-
require "rvm/capistrano"
|
44
44
|
```
|
45
45
|
|
46
46
|
### Disabling `bundle --deployment` when using gemsets
|
@@ -57,12 +57,12 @@ set :bundle_flags, '--system --quiet'
|
|
57
57
|
Update RVM and make sure Ruby is installed on every deploy:
|
58
58
|
|
59
59
|
```ruby
|
60
|
+
require "rvm/capistrano"
|
61
|
+
|
60
62
|
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
|
61
63
|
|
62
64
|
before 'deploy', 'rvm:install_rvm' # update RVM
|
63
65
|
before 'deploy', 'rvm:install_ruby' # install Ruby and create gemset (both if missing)
|
64
|
-
|
65
|
-
require "rvm/capistrano"
|
66
66
|
```
|
67
67
|
|
68
68
|
### To use the ruby version currently active locally
|
@@ -80,7 +80,7 @@ set :rvm_require_role, :app
|
|
80
80
|
require "rvm/capistrano"
|
81
81
|
```
|
82
82
|
|
83
|
-
|
83
|
+
It is important to `set :rvm_require_role` before `require "rvm/capistrano"`.
|
84
84
|
|
85
85
|
### To restrict rvm to only some servers
|
86
86
|
|
@@ -139,7 +139,7 @@ end
|
|
139
139
|
|
140
140
|
- `:rvm_install_shell` - shell to be used for `rvm` operations, by default `bash`, most likely you do not need to change it
|
141
141
|
- `:rvm_install_ruby` - a command used to install ruby, by default `install`, most likely you do not need to change it
|
142
|
-
- `:rvm_install_ruby_threads` - number of threads to use for ruby compilation, by default
|
142
|
+
- `:rvm_install_ruby_threads` - number of threads to use for ruby compilation, rvm by default uses all CPU cores
|
143
143
|
- `:rvm_install_ruby_params` - parameters for ruby, example `--patch railsexpress`
|
144
144
|
- `:rvm_install_pkgs` - array of packages to install with `cap rvm:install_pkgs`
|
145
145
|
- `:rvm_add_to_group` - user name to add to `rvm` group when RVM is installed with `:rvm_type` `:system`, by default it's the user name that runs deploy
|
data/lib/rvm/capistrano.rb
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
module Capistrano
|
4
4
|
Configuration.instance(true).load do
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
unless methods.map(&:to_sym).include?(:_cset)
|
7
|
+
# Taken from the capistrano code.
|
8
|
+
def _cset(name, *args, &block)
|
9
|
+
unless exists?(name)
|
10
|
+
set(name, *args, &block)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -16,26 +18,9 @@ module Capistrano
|
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
case ruby
|
23
|
-
when "release_path"
|
24
|
-
shell = "rvm_path=#{rvm_path} #{shell} --path '#{release_path}'"
|
25
|
-
when "local"
|
26
|
-
ruby = (ENV['GEM_HOME'] || "").gsub(/.*\//, "")
|
27
|
-
raise "Failed to get ruby version from GEM_HOME. Please make sure rvm is loaded!" if ruby.empty?
|
28
|
-
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'"
|
29
|
-
else
|
30
|
-
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
|
31
|
-
end
|
32
|
-
shell
|
33
|
-
end
|
34
|
-
if fetch(:rvm_require_role,nil).nil?
|
35
|
-
_cset :default_shell do
|
36
|
-
fetch(:rvm_shell)
|
37
|
-
end
|
38
|
-
else
|
21
|
+
# this is part of check, search for :rvm_require_role
|
22
|
+
unless fetch(:rvm_require_role,nil).nil?
|
23
|
+
set :rvm_require_role_was_set_before_require, true
|
39
24
|
class << self
|
40
25
|
def run(cmd, options={}, &block)
|
41
26
|
if options[:eof].nil? && !cmd.include?(sudo)
|
@@ -61,74 +46,105 @@ module Capistrano
|
|
61
46
|
end
|
62
47
|
end
|
63
48
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
49
|
+
on :load do
|
50
|
+
_cset :rvm_shell do
|
51
|
+
shell = File.join(rvm_bin_path, "rvm-shell")
|
52
|
+
ruby = fetch(:rvm_ruby_string_evaluated).strip
|
53
|
+
case ruby
|
54
|
+
when "release_path"
|
55
|
+
shell = "rvm_path=#{rvm_path} #{shell} --path '#{release_path}'"
|
56
|
+
when "local"
|
57
|
+
ruby = (ENV['GEM_HOME'] || "").gsub(/.*\//, "")
|
58
|
+
raise "Failed to get ruby version from GEM_HOME. Please make sure rvm is loaded!" if ruby.empty?
|
59
|
+
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'"
|
60
|
+
else
|
61
|
+
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
|
62
|
+
end
|
63
|
+
shell
|
79
64
|
end
|
80
|
-
end
|
81
65
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
"
|
89
|
-
|
90
|
-
|
66
|
+
# this is part of check, search for :rvm_require_role
|
67
|
+
if fetch(:rvm_require_role,nil).nil?
|
68
|
+
set :default_shell do
|
69
|
+
fetch(:rvm_shell)
|
70
|
+
end
|
71
|
+
elsif fetch(:rvm_require_role_was_set_before_require, nil).nil?
|
72
|
+
raise "
|
73
|
+
|
74
|
+
ERROR: detected 'set :rvm_require_role, \"#{fetch(:rvm_require_role,nil)}\"' after 'require \"rvm/capistrano\"', please move it above for proper functioning.
|
75
|
+
|
76
|
+
"
|
77
|
+
end
|
78
|
+
|
79
|
+
# Let users set the type of their rvm install.
|
80
|
+
_cset(:rvm_type, :user)
|
81
|
+
|
82
|
+
# Define rvm_path
|
83
|
+
# This is used in the default_shell command to pass the required variable to rvm-shell, allowing
|
84
|
+
# rvm to boostrap using the proper path. This is being lost in Capistrano due to the lack of a
|
85
|
+
# full environment.
|
86
|
+
_cset(:rvm_path) do
|
87
|
+
case rvm_type
|
88
|
+
when :root, :system
|
89
|
+
"/usr/local/rvm"
|
90
|
+
when :local, :user, :default
|
91
|
+
"$HOME/.rvm/"
|
92
|
+
else
|
93
|
+
rvm_type.to_s.empty? ? "$HOME/.rvm" : rvm_type.to_s
|
94
|
+
end
|
91
95
|
end
|
92
|
-
end
|
93
96
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
97
|
+
# Let users override the rvm_bin_path
|
98
|
+
_cset(:rvm_bin_path) do
|
99
|
+
case rvm_type
|
100
|
+
when :root, :system
|
101
|
+
"/usr/local/rvm/bin"
|
102
|
+
when :local, :user, :default
|
103
|
+
"$HOME/.rvm/bin"
|
104
|
+
else
|
105
|
+
rvm_type.to_s.empty? ? "#{rvm_path}/bin" : rvm_type.to_s
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
set :rvm_ruby_string_evaluated do
|
110
|
+
value = fetch(:rvm_ruby_string, :default)
|
111
|
+
if value.to_sym == :local
|
112
|
+
value = ENV['GEM_HOME'].gsub(/.*\//,"")
|
113
|
+
end
|
114
|
+
value.to_s
|
98
115
|
end
|
99
|
-
value.to_s
|
100
|
-
end
|
101
116
|
|
102
|
-
|
103
|
-
|
117
|
+
# Let users configure a path to export/import gemsets
|
118
|
+
_cset(:rvm_gemset_path, "#{rvm_path}/gemsets")
|
104
119
|
|
105
|
-
|
106
|
-
|
120
|
+
# Use the default ruby on the server, by default :)
|
121
|
+
_cset(:rvm_ruby_string, :default)
|
107
122
|
|
108
|
-
|
109
|
-
|
123
|
+
# Default sudo state
|
124
|
+
_cset(:rvm_install_with_sudo, false)
|
110
125
|
|
111
|
-
|
112
|
-
|
113
|
-
|
126
|
+
# Let users set the install type and shell of their choice.
|
127
|
+
_cset(:rvm_install_type, :stable)
|
128
|
+
_cset(:rvm_install_shell, :bash)
|
114
129
|
|
115
|
-
|
116
|
-
|
117
|
-
_cset(:rvm_install_ruby_threads, "$(cat /proc/cpuinfo 2>/dev/null | (grep vendor_id || echo 'vendor_id : Other';) | wc -l)")
|
130
|
+
# Let users set the (re)install for ruby.
|
131
|
+
_cset(:rvm_install_ruby, :install)
|
118
132
|
|
119
|
-
|
120
|
-
|
133
|
+
# Pass no special params to the ruby build by default
|
134
|
+
_cset(:rvm_install_ruby_params, '')
|
121
135
|
|
122
|
-
|
123
|
-
|
136
|
+
# Additional rvm packages to install.
|
137
|
+
_cset(:rvm_install_pkgs, [])
|
124
138
|
|
125
|
-
|
126
|
-
|
139
|
+
# By default system installations add deploying user to rvm group. also try :all
|
140
|
+
_cset(:rvm_add_to_group, fetch(:user,"$USER"))
|
141
|
+
|
142
|
+
end
|
127
143
|
|
128
144
|
namespace :rvm do
|
129
145
|
|
130
146
|
def run_silent_curl(command)
|
131
|
-
run
|
147
|
+
run(<<-EOF.gsub(/[\s]+/, ' '), :shell => "#{rvm_install_shell}")
|
132
148
|
__LAST_STATUS=0;
|
133
149
|
export CURL_HOME="${TMPDIR:-${HOME}}/.rvm-curl-config.$$";
|
134
150
|
mkdir ${CURL_HOME}/;
|
@@ -227,14 +243,14 @@ fi
|
|
227
243
|
|
228
244
|
By default ruby is compiled using all CPU cores, change with:
|
229
245
|
|
230
|
-
set :rvm_install_ruby_threads,
|
246
|
+
set :rvm_install_ruby_threads, 5
|
231
247
|
|
232
248
|
By default BASH is used for installer, change with:
|
233
249
|
|
234
250
|
set :rvm_install_shell, :zsh
|
235
251
|
EOF
|
236
252
|
rvm_task :install_ruby do
|
237
|
-
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split
|
253
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
|
238
254
|
if %w( release_path default ).include? "#{ruby}"
|
239
255
|
raise "
|
240
256
|
|
@@ -251,12 +267,14 @@ ruby can not be installed when using :rvm_ruby_string => :#{ruby}
|
|
251
267
|
2 fail read-fail
|
252
268
|
).include?( autolibs_flag )
|
253
269
|
|
270
|
+
install_ruby_threads = fetch(:rvm_install_ruby_threads,nil).nil? ? '' : "-j #{rvm_install_ruby_threads}"
|
271
|
+
|
254
272
|
if autolibs_flag_no_requirements
|
255
|
-
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} #{rvm_install_ruby} #{ruby}
|
273
|
+
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} #{rvm_install_ruby} #{ruby} #{install_ruby_threads} #{rvm_install_ruby_params}")
|
256
274
|
else
|
257
275
|
command_install << "#{rvm_if_sudo} #{File.join(rvm_bin_path, "rvm")} --autolibs=#{autolibs_flag} requirements #{ruby}"
|
258
276
|
command_install << "; "
|
259
|
-
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=1 #{rvm_install_ruby} #{ruby}
|
277
|
+
command_install << with_rvm_group("#{File.join(rvm_bin_path, "rvm")} --autolibs=1 #{rvm_install_ruby} #{ruby} #{install_ruby_threads} #{rvm_install_ruby_params}")
|
260
278
|
end
|
261
279
|
|
262
280
|
if gemset
|
@@ -287,7 +305,7 @@ ruby can not be installed when using :rvm_ruby_string => :#{ruby}
|
|
287
305
|
|
288
306
|
desc "Create gemset"
|
289
307
|
rvm_task :create_gemset do
|
290
|
-
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split
|
308
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
|
291
309
|
if %w( release_path default ).include? "#{ruby}"
|
292
310
|
raise "
|
293
311
|
|
@@ -310,7 +328,7 @@ gemset can not be created when using :rvm_ruby_string => :#{ruby}
|
|
310
328
|
The gemset can be created with 'cap rvm:gemset_export'.
|
311
329
|
EOF
|
312
330
|
rvm_task :import_gemset do
|
313
|
-
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split
|
331
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
|
314
332
|
if %w( release_path default ).include? "#{ruby}"
|
315
333
|
raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
|
316
334
|
else
|
@@ -329,7 +347,7 @@ gemset can not be created when using :rvm_ruby_string => :#{ruby}
|
|
329
347
|
The gemset can be imported with 'cap rvm:gemset_import'.
|
330
348
|
EOF
|
331
349
|
rvm_task :export_gemset do
|
332
|
-
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split
|
350
|
+
ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
|
333
351
|
if %w( release_path default ).include? "#{ruby}"
|
334
352
|
raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
|
335
353
|
else
|
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: -845565846
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
|
9
|
+
- 4
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.3.4.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Wayne E. Seguin
|
@@ -16,8 +18,7 @@ autorequire:
|
|
16
18
|
bindir: bin
|
17
19
|
cert_chain: []
|
18
20
|
|
19
|
-
date: 2013-06-
|
20
|
-
default_executable:
|
21
|
+
date: 2013-06-27 00:00:00 Z
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
24
|
name: capistrano
|
@@ -82,7 +83,6 @@ files:
|
|
82
83
|
- lib/rvm/capistrano.rb
|
83
84
|
- lib/rvm/capistrano/version.rb
|
84
85
|
- spec/spec_helper.rb
|
85
|
-
has_rdoc: true
|
86
86
|
homepage: https://github.com/wayneeseguin/rvm-capistrano
|
87
87
|
licenses:
|
88
88
|
- MIT
|
@@ -103,16 +103,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|
106
|
-
- - "
|
106
|
+
- - ">"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
108
|
+
hash: 25
|
109
109
|
segments:
|
110
|
-
-
|
111
|
-
|
110
|
+
- 1
|
111
|
+
- 3
|
112
|
+
- 1
|
113
|
+
version: 1.3.1
|
112
114
|
requirements: []
|
113
115
|
|
114
116
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.8.24
|
116
118
|
signing_key:
|
117
119
|
specification_version: 3
|
118
120
|
summary: RVM / Capistrano Integration Gem
|