Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/capistrano/tasks/rvm.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ RVM_USER_PATH = "~/.rvm"
namespace :rvm do
desc "Prints the RVM and Ruby version on the target host"
task :check do
next if should_skip
on roles(fetch(:rvm_roles, :all)) do
if fetch(:log_level) == :debug
puts capture(:rvm, "version")
Expand All @@ -14,6 +15,7 @@ namespace :rvm do
end

task :hook do
next if should_skip
on roles(fetch(:rvm_roles, :all)) do
rvm_path = fetch(:rvm_custom_path)
rvm_path ||= case fetch(:rvm_type)
Expand Down Expand Up @@ -43,6 +45,18 @@ namespace :rvm do
end
end

def should_skip
skip_rvm_for_tasks = fetch(:skip_rvm_for_tasks, [])
invoked_with_task = Rake.application.top_level_tasks.last
skip_rvm_for_tasks.any? do |t|
if t.is_a?(Regexp)
t.match(invoked_with_task)
else
t == invoked_with_task
end
end
end

Capistrano::DSL.stages.each do |stage|
after stage, 'rvm:hook'
after stage, 'rvm:check'
Expand Down