rvm-capistrano 1.2.7 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -29,10 +29,14 @@ Example:
29
29
 
30
30
  set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
31
31
  set :rvm_install_ruby_params, '--1.9' # for jruby/rbx default to 1.9 mode
32
+ set :rvm_install_pkgs, %w[libyaml openssl] # package list from https://rvm.io/packages
33
+ set :rvm_install_ruby_params, '--with-opt-dir=/usr/local/rvm/usr' # package support
32
34
 
33
35
  before 'deploy:setup', 'rvm:install_rvm' # install RVM
36
+ before 'deploy:setup', 'rvm:install_pkgs' # install RVM packages before Ruby
34
37
  before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, or:
35
38
  before 'deploy:setup', 'rvm:create_gemset' # only create gemset
39
+ before 'deploy:setup', 'rvm:import_gemset' # import gemset from file
36
40
 
37
41
  require "rvm/capistrano"
38
42
 
@@ -46,8 +50,11 @@ Example:
46
50
  ```bash
47
51
  $ cap -T rvm
48
52
  cap rvm:create_gemset # Create gemset
53
+ cap rvm:export_gemset # Export the current RVM ruby gemset contents to a file.
54
+ cap rvm:import_gemset # Import file contents to the current RVM ruby gemset.
49
55
  cap rvm:install_ruby # Install RVM ruby to the server, create gemset ...
50
56
  cap rvm:install_rvm # Install RVM of the given choice to the server.
57
+ cap rvm:install_pkgs # Install RVM packages to the server.
51
58
  cap rvm:install_gem GEM=my_gem # Install gem {my_gem} on the server using selected ruby.
52
59
  cap rvm:uninstall_gem GEM=my_gem # Uninstall gem {my_gem} from the server selected ruby.
53
60
  ```
@@ -56,6 +56,9 @@ module Capistrano
56
56
  end
57
57
  end
58
58
 
59
+ # Let users configure a path to export/import gemsets
60
+ _cset(:rvm_gemset_path, "#{rvm_path}/gemsets")
61
+
59
62
  # Use the default ruby on the server, by default :)
60
63
  _cset(:rvm_ruby_string, "default")
61
64
 
@@ -73,7 +76,22 @@ module Capistrano
73
76
  # Pass no special params to the ruby build by default
74
77
  _cset(:rvm_install_ruby_params, '')
75
78
 
79
+ # Additional rvm packages to install.
80
+ _cset(:rvm_install_pkgs, '')
81
+
76
82
  namespace :rvm do
83
+
84
+ command_curl_start = <<-EOF.gsub(/^\s*/, '')
85
+ export CURL_HOME=${TMPDIR:-${HOME}}/.rvm-curl-config.$$;
86
+ mkdir ${CURL_HOME}/;
87
+ {
88
+ [[ -r ${HOME}/.curlrc ]] && cat ${HOME}/.curlrc;
89
+ echo "silent";
90
+ echo "show-error";
91
+ } > $CURL_HOME/.curlrc
92
+ EOF
93
+ command_curl_end = "rm -rf $CURL_HOME"
94
+
77
95
  desc <<-EOF
78
96
  Install RVM of the given choice to the server.
79
97
  By default RVM "stable" is installed, change with:
@@ -85,16 +103,6 @@ module Capistrano
85
103
  set :rvm_install_shell, :zsh
86
104
  EOF
87
105
  task :install_rvm do
88
- command_curl_start = <<-EOF.gsub(/^\s*/, '')
89
- export CURL_HOME=${TMPDIR:-${HOME}}/.rvm-curl-config;
90
- mkdir ${CURL_HOME}/;
91
- {
92
- [[ -r ${HOME}/.curlrc ]] && cat ${HOME}/.curlrc;
93
- echo "silent";
94
- echo "show-error";
95
- } > $CURL_HOME/.curlrc
96
- EOF
97
- command_curl_end = "rm -rf $CURL_HOME"
98
106
  command_fetch = "curl -L get.rvm.io"
99
107
  command_install = case rvm_type
100
108
  when :root, :system
@@ -134,10 +142,33 @@ module Capistrano
134
142
  if %w( release_path default ).include? "#{ruby}"
135
143
  raise "ruby can not be installed when using :rvm_ruby_string => :#{ruby}"
136
144
  else
137
- run "#{File.join(rvm_bin_path, "rvm")} #{rvm_install_ruby} #{ruby} -j #{rvm_install_ruby_threads} #{rvm_install_ruby_params}", :shell => "#{rvm_install_shell}"
145
+ command_install = "#{File.join(rvm_bin_path, "rvm")} #{rvm_install_ruby} #{ruby} -j #{rvm_install_ruby_threads} #{rvm_install_ruby_params}"
138
146
  if gemset
139
- run "#{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}", :shell => "#{rvm_install_shell}"
147
+ command_install << "; #{File.join(rvm_bin_path, "rvm")} #{ruby} do rvm gemset create #{gemset}"
140
148
  end
149
+ _command = <<-EOF
150
+ #{command_curl_start};
151
+ #{command_install};
152
+ #{command_curl_end}
153
+ EOF
154
+ run "#{_command}".gsub(/[\s\n]+/, ' '), :shell => "#{rvm_install_shell}"
155
+ end
156
+ end
157
+
158
+ desc <<-EOF
159
+ Install RVM packages to the server.
160
+
161
+ This must come before the 'rvm:install_ruby' task is called.
162
+
163
+ The package list is empty by default. Specifiy the packages to install with:
164
+
165
+ set :rvm_install_pkgs, %w[libyaml curl]
166
+
167
+ Full list of packages available at https://rvm.io/packages/ or by running 'rvm pkg'.
168
+ EOF
169
+ task :install_pkgs do
170
+ rvm_install_pkgs.each do |pkg|
171
+ run "#{File.join(rvm_bin_path, "rvm")} pkg install #{pkg}", :shell => "#{rvm_install_shell}"
141
172
  end
142
173
  end
143
174
 
@@ -153,6 +184,44 @@ module Capistrano
153
184
  end
154
185
  end
155
186
 
187
+ desc <<-EOF
188
+ Import file contents to the current RVM ruby gemset.
189
+
190
+ The gemset filename must match :rvm_ruby_string.gems and be located in :rvm_gemset_path.
191
+ :rvm_gemset_path defaults to :rvm_path/gemsets
192
+
193
+ The gemset can be created with 'cap rvm:gemset_export'.
194
+ EOF
195
+ task :import_gemset do
196
+ ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
197
+ if %w( release_path default ).include? "#{ruby}"
198
+ raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
199
+ else
200
+ if gemset
201
+ run "#{File.join(rvm_bin_path, "rvm-shell")} #{rvm_ruby_string} rvm gemset import #{File.join(rvm_gemset_path, "#{rvm_ruby_string}.gems")}", :shell => "#{rvm_install_shell}"
202
+ end
203
+ end
204
+ end
205
+
206
+ desc <<-EOF
207
+ Export the current RVM ruby gemset contents to a file.
208
+
209
+ The gemset filename will match :rvm_ruby_string.gems and be located in :rvm_gemset_path.
210
+ :rvm_gemset_path defaults to :rvm_path/gemsets
211
+
212
+ The gemset can be imported with 'cap rvm:gemset_import'.
213
+ EOF
214
+ task :export_gemset do
215
+ ruby, gemset = rvm_ruby_string.to_s.strip.split /@/
216
+ if %w( release_path default ).include? "#{ruby}"
217
+ raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
218
+ else
219
+ if gemset
220
+ run "#{File.join(rvm_bin_path, "rvm-shell")} #{rvm_ruby_string} rvm gemset export > #{File.join(rvm_gemset_path, "#{rvm_ruby_string}.gems")}", :shell => "#{rvm_install_shell}"
221
+ end
222
+ end
223
+ end
224
+
156
225
  desc "Install a gem, 'cap rvm:install_gem GEM=my_gem'."
157
226
  task :install_gem do
158
227
  run "#{File.join(rvm_bin_path, "rvm")} #{rvm_ruby_string} do gem install #{ENV['GEM']}", :shell => "#{rvm_install_shell}"
@@ -1,5 +1,5 @@
1
1
  module RVM
2
2
  class Capistrano
3
- VERSION="1.2.7"
3
+ VERSION="1.3.0.rc1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rvm-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
5
- prerelease:
4
+ version: 1.3.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wayne E. Seguin
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-09 00:00:00.000000000 Z
13
+ date: 2012-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -92,12 +92,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  none: false
94
94
  requirements:
95
- - - ! '>='
95
+ - - ! '>'
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: 1.3.1
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 1.8.19
100
+ rubygems_version: 1.8.24
101
101
  signing_key:
102
102
  specification_version: 3
103
103
  summary: RVM / Capistrano Integration Gem