rvm-capistrano 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +4 -0
- data/README.md +10 -1
- data/lib/rvm/capistrano.rb +112 -110
- data/lib/rvm/capistrano/version.rb +1 -1
- metadata +72 -59
data/History.md
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ RVM / Capistrano Integration Gem
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
RVM / Capistrano integration is
|
11
|
+
RVM / Capistrano integration is available as a separate gem
|
12
12
|
|
13
13
|
$ gem install rvm-capistrano
|
14
14
|
|
@@ -34,6 +34,15 @@ Example:
|
|
34
34
|
|
35
35
|
set :rvm_ruby_string, :local
|
36
36
|
|
37
|
+
## Tasks
|
38
|
+
|
39
|
+
```bash
|
40
|
+
$ cap -T rvm
|
41
|
+
cap rvm:create_gemset # Create gemset
|
42
|
+
cap rvm:install_ruby # Install RVM ruby to the server, create gemset ...
|
43
|
+
cap rvm:install_rvm # Install RVM of the given choice to the server.
|
44
|
+
```
|
45
|
+
|
37
46
|
## Development
|
38
47
|
|
39
48
|
$ rake spec
|
data/lib/rvm/capistrano.rb
CHANGED
@@ -1,144 +1,146 @@
|
|
1
1
|
# Recipes for using RVM on a server with capistrano.
|
2
2
|
|
3
|
-
Capistrano
|
3
|
+
module Capistrano
|
4
|
+
Configuration.instance(true).load do
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# Taken from the capistrano code.
|
7
|
+
def _cset(name, *args, &block)
|
8
|
+
unless exists?(name)
|
9
|
+
set(name, *args, &block)
|
10
|
+
end
|
9
11
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
|
13
|
+
set :default_shell do
|
14
|
+
shell = File.join(rvm_bin_path, "rvm-shell")
|
15
|
+
ruby = rvm_ruby_string.to_s.strip
|
16
|
+
case ruby
|
17
|
+
when "release_path"
|
18
|
+
shell = "rvm_path=#{rvm_path} #{shell} --path '#{release_path}'"
|
19
|
+
when "local"
|
20
|
+
ruby = (ENV['GEM_HOME'] || "").gsub(/.*\//, "")
|
21
|
+
raise "Failed to get ruby version from GEM_HOME. Please make sure rvm is loaded!" if ruby.empty?
|
22
|
+
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'"
|
23
|
+
else
|
24
|
+
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
|
25
|
+
end
|
26
|
+
shell
|
24
27
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
rvm_type.to_s.empty? ? "$HOME/.rvm" : rvm_type.to_s
|
28
|
+
|
29
|
+
# Let users set the type of their rvm install.
|
30
|
+
_cset(:rvm_type, :user)
|
31
|
+
|
32
|
+
# Define rvm_path
|
33
|
+
# This is used in the default_shell command to pass the required variable to rvm-shell, allowing
|
34
|
+
# rvm to boostrap using the proper path. This is being lost in Capistrano due to the lack of a
|
35
|
+
# full environment.
|
36
|
+
_cset(:rvm_path) do
|
37
|
+
case rvm_type
|
38
|
+
when :root, :system
|
39
|
+
"/usr/local/rvm"
|
40
|
+
when :local, :user, :default
|
41
|
+
"$HOME/.rvm/"
|
42
|
+
else
|
43
|
+
rvm_type.to_s.empty? ? "$HOME/.rvm" : rvm_type.to_s
|
44
|
+
end
|
43
45
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
|
47
|
+
# Let users override the rvm_bin_path
|
48
|
+
_cset(:rvm_bin_path) do
|
49
|
+
case rvm_type
|
50
|
+
when :root, :system
|
51
|
+
"/usr/local/rvm/bin"
|
52
|
+
when :local, :user, :default
|
53
|
+
"$HOME/.rvm/bin"
|
54
|
+
else
|
55
|
+
rvm_type.to_s.empty? ? "#{rvm_path}/bin" : rvm_type.to_s
|
56
|
+
end
|
55
57
|
end
|
56
|
-
end
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
# Use the default ruby on the server, by default :)
|
60
|
+
_cset(:rvm_ruby_string, "default")
|
60
61
|
|
61
|
-
|
62
|
-
|
62
|
+
# Default sudo state
|
63
|
+
_cset(:rvm_install_with_sudo, false)
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
# Let users set the install type and shell of their choice.
|
66
|
+
_cset(:rvm_install_type, :stable)
|
67
|
+
_cset(:rvm_install_shell, :bash)
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
# Let users set the (re)install for ruby.
|
70
|
+
_cset(:rvm_install_ruby, :install)
|
71
|
+
_cset(:rvm_install_ruby_threads, "$(cat /proc/cpuinfo | grep vendor_id | wc -l)")
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
# Pass no special params to the ruby build by default
|
74
|
+
_cset(:rvm_install_ruby_params, '')
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
namespace :rvm do
|
77
|
+
desc <<-EOF
|
78
|
+
Install RVM of the given choice to the server.
|
79
|
+
By default RVM "stable" is installed, change with:
|
79
80
|
|
80
|
-
|
81
|
+
set :rvm_install_type, :head
|
81
82
|
|
82
|
-
|
83
|
+
By default BASH is used for installer, change with:
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
set :rvm_install_shell, :zsh
|
86
|
+
EOF
|
87
|
+
task :install_rvm do
|
88
|
+
command_fetch="curl -L get.rvm.io | "
|
89
|
+
case rvm_type
|
90
|
+
when :root, :system
|
91
|
+
if use_sudo == false && rvm_install_with_sudo == false
|
92
|
+
raise ":use_sudo is set to 'false' but sudo is needed to install rvm_type: #{rvm_type}. You can enable use_sudo within rvm for use only by this install operation by adding to deploy.rb: set :rvm_install_with_sudo, true"
|
93
|
+
else
|
94
|
+
command_install = "#{sudo} "
|
95
|
+
end
|
92
96
|
else
|
93
|
-
command_install =
|
97
|
+
command_install = ''
|
94
98
|
end
|
95
|
-
|
96
|
-
command_install
|
99
|
+
command_install << "#{rvm_install_shell} -s #{rvm_install_type} --path #{rvm_path}"
|
100
|
+
run "#{command_fetch} #{command_install}", :shell => "#{rvm_install_shell}"
|
97
101
|
end
|
98
|
-
command_install << "#{rvm_install_shell} -s #{rvm_install_type} --path #{rvm_path}"
|
99
|
-
run "#{command_fetch} #{command_install}", :shell => "#{rvm_install_shell}"
|
100
|
-
end
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
desc <<-EOF
|
104
|
+
Install RVM ruby to the server, create gemset if needed.
|
105
|
+
By default ruby is installed, you can reinstall with:
|
105
106
|
|
106
|
-
|
107
|
+
set :rvm_install_ruby, :reinstall
|
107
108
|
|
108
|
-
|
109
|
+
By default ruby is compiled using all CPU cores, change with:
|
109
110
|
|
110
|
-
|
111
|
+
set :rvm_install_ruby_threads, :reinstall
|
111
112
|
|
112
|
-
|
113
|
+
By default BASH is used for installer, change with:
|
113
114
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
set :rvm_install_shell, :zsh
|
116
|
+
EOF
|
117
|
+
task :install_ruby do
|
118
|
+
ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
|
119
|
+
if %w( release_path default ).include? "#{ruby}"
|
120
|
+
raise "ruby can not be installed when using :rvm_ruby_string => :#{ruby}"
|
121
|
+
else
|
122
|
+
run "#{File.join(rvm_bin_path, "rvm")} #{rvm_install_ruby} #{ruby} -j #{rvm_install_ruby_threads} #{rvm_install_ruby_params}", :shell => "#{rvm_install_shell}"
|
123
|
+
if gemset
|
124
|
+
run "#{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}", :shell => "#{rvm_install_shell}"
|
125
|
+
end
|
124
126
|
end
|
125
127
|
end
|
126
|
-
end
|
127
128
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
129
|
+
desc "Create gemset"
|
130
|
+
task :create_gemset do
|
131
|
+
ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
|
132
|
+
if %w( release_path default ).include? "#{ruby}"
|
133
|
+
raise "gemset can not be created when using :rvm_ruby_string => :#{ruby}"
|
134
|
+
else
|
135
|
+
if gemset
|
136
|
+
run "#{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}", :shell => "#{rvm_install_shell}"
|
137
|
+
end
|
136
138
|
end
|
137
139
|
end
|
138
|
-
end
|
139
140
|
|
140
|
-
|
141
|
-
end if
|
141
|
+
end
|
142
|
+
end if const_defined? :Configuration
|
143
|
+
end
|
142
144
|
|
143
145
|
# E.g, to use ree and rails 3:
|
144
146
|
#
|
metadata
CHANGED
@@ -1,73 +1,78 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvm-capistrano
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 4
|
10
|
+
version: 1.2.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Wayne E. Seguin
|
9
14
|
- Michal Papis
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2012-07-17 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: capistrano
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.0.0
|
23
|
-
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
25
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
- 0
|
30
34
|
version: 2.0.0
|
31
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
32
38
|
name: rake
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '0'
|
39
|
-
type: :development
|
40
39
|
prerelease: false
|
41
|
-
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: minitest
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
50
41
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
55
49
|
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: minitest
|
56
53
|
prerelease: false
|
57
|
-
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
55
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
63
65
|
description: RVM / Capistrano Integration Gem
|
64
|
-
email:
|
66
|
+
email:
|
65
67
|
- wayneeseguin@gmail.com
|
66
68
|
- mpapis@gmail.com
|
67
69
|
executables: []
|
70
|
+
|
68
71
|
extensions: []
|
72
|
+
|
69
73
|
extra_rdoc_files: []
|
70
|
-
|
74
|
+
|
75
|
+
files:
|
71
76
|
- History.md
|
72
77
|
- Manifest.yml
|
73
78
|
- README.md
|
@@ -77,29 +82,37 @@ files:
|
|
77
82
|
- lib/rvm/capistrano/version.rb
|
78
83
|
- spec/spec_helper.rb
|
79
84
|
homepage: https://rvm.beginrescueend.com/integration/capistrano
|
80
|
-
licenses:
|
85
|
+
licenses:
|
81
86
|
- MIT
|
82
87
|
post_install_message:
|
83
88
|
rdoc_options: []
|
84
|
-
|
89
|
+
|
90
|
+
require_paths:
|
85
91
|
- lib
|
86
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
93
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
102
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
98
110
|
requirements: []
|
111
|
+
|
99
112
|
rubyforge_project:
|
100
113
|
rubygems_version: 1.8.24
|
101
114
|
signing_key:
|
102
115
|
specification_version: 3
|
103
116
|
summary: RVM / Capistrano Integration Gem
|
104
|
-
test_files:
|
117
|
+
test_files:
|
105
118
|
- spec/spec_helper.rb
|