An automated version of the integration requiring minimal configuration. Includes task to install RVM and Ruby.
Add this line to your application's Gemfile:
gem 'rvm1-capistrano3', require: false
You need to run bundle install
to install the gem.
Or install it yourself as:
$ gem install rvm1-capistrano3
In Capfile
add
require 'rvm1/capistrano3'
It will automatically:
Please note that for now no automatic installation of PGP keys is done, based on this instruction http://rvm.io/rvm/security a minimalistic task can be added to handle the keys installation:
namespace :app do
task :update_rvm_key do
execute :gpg, "--keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
end
end
before "rvm1:install:rvm", "app:update_rvm_key"
replace :gpg
with :gpg2
depending on the output from RVM.
This task will install stable version of rvm in $HOME/.rvm
:
cap rvm1:install:rvm
Or add an before hook:
before 'deploy', 'rvm1:install:rvm' # install/update RVM
This task will install ruby from the project (other the specified one):
cap rvm1:install:ruby
Or add an before hook:
before 'deploy', 'rvm1:install:ruby' # install/update Ruby
This task requires NOPASSWD
for the user in /etc/sudoers
,
or at least all ruby requirements installed already.
Please note that NOPASSWD
can bring security vulnerabilities to your system and
it's not recommended to involve this option unless you really understand implications of it.
Creates alias with the application name for the app ruby:
before 'deploy', 'rvm1:alias:create'
To change the alias name use:
set :rvm1_alias_name, 'my-alias-name'
This task replaces capistrano-bundler
gem use only one at time
This will install gems from the project Gemfile
:
cap rvm1:install:gems
Or add an before hook:
before 'deploy', 'rvm1:install:gems' # install/update gems from Gemfile into gemset
Right now all gems in Gemfile will be installed into gemset.
Support for Gemfile
installation in Rubygems is still young,
we will improve it with new RG releases.
Gemfile
Gemfile.lock
- work still in progress,
test with rvm rubygems head
Well if you really need to there are available ways:
set :rvm1_ruby_version, "2.0.0"
- to avoid autodetection and use specific versionfetch(:default_env).merge!( rvm_path: "/opt/rvm" )
- to force specific path to rvm installationThis gem adds a new task rvm1:hook
before deploy:starting
.
It uses the script/rvm-auto.sh for capistrano when it wants to run
rake
, gem
, bundle
, or ruby
.
If you want to check your configuration you can use the rvm1:check
task to
get information about the RVM version and ruby which would be used for
deployment.
$ cap production rvm1:check
When building custom tasks which need the current ruby version and gemset, all you
have to do is run the rvm1:hook
task before your own task. This will handle
the execution of the ruby-related commands.
This is only necessary if your task is not after the deploy:starting
task.
before :my_custom_task, 'rvm1:hook'
If you want to restrict RVM usage to a subset of roles, you may set :rvm_roles
:
set :rvm1_roles, [:rvm]
This can be used to restrict RVM use to only one stage which uses given roles.
By default the rvm-auto.sh
script will be saved under /tmp/<application>-<ssh-user>
. To override it, use:
set :rvm1_auto_script_path, '/tmp/another/dir'
git checkout -b my-new-feature
)tf --text test/*.sh
)git commit -am 'Add some feature'
)git push origin my-new-feature
)