From e5b9771aa104ee32bb1c2cfd9fffcbcb787bee48 Mon Sep 17 00:00:00 2001 From: Chris Heald Date: Thu, 23 Jan 2014 11:39:27 -0700 Subject: [PATCH] Allow for overriding of RVM roles Update README to reflect :rvm_roles Remove extraneous spaces --- README.md | 6 +++++- lib/capistrano/tasks/rvm.rake | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ed953ff..8256ef0 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,16 @@ or set :rvm_ruby_version, '2.0.0@mygemset' - ### Custom RVM path: `:rvm_custom_path` If you have a custom RVM setup with a different path then expected, you have to define a custom RVM path to tell capistrano where it is. +### Custom Roles: `:rvm_roles` + +If you want to restrict RVM usage to a subset of roles, you may set `:rvm_roles`: + + set :rvm_roles, [:app, :web] ## Restrictions diff --git a/lib/capistrano/tasks/rvm.rake b/lib/capistrano/tasks/rvm.rake index 2b633f6..899b6ad 100644 --- a/lib/capistrano/tasks/rvm.rake +++ b/lib/capistrano/tasks/rvm.rake @@ -4,7 +4,7 @@ RVM_USER_PATH = "~/.rvm" namespace :rvm do desc "Prints the RVM and Ruby version on the target host" task :check do - on roles(:all) do + on roles(fetch(:rvm_roles, :all)) do puts capture(:rvm, "version") puts capture(:rvm, "current") puts capture(:ruby, "--version") @@ -12,7 +12,7 @@ namespace :rvm do end task :hook do - on roles(:all) do + on roles(fetch(:rvm_roles, :all)) do rvm_path = fetch(:rvm_custom_path) rvm_path ||= case fetch(:rvm_type) when :auto