module Capistrano::TaskEnhancements
Public Instance Methods
after(task, post_task, *args, &block)
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 10 def after(task, post_task, *args, &block) Rake::Task.define_task(post_task, *args, &block) if block_given? task = Rake::Task[task] task.enhance do Rake.application.lookup(post_task, task.scope).invoke end end
before(task, prerequisite, *args, &block)
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 5 def before(task, prerequisite, *args, &block) prerequisite = Rake::Task.define_task(prerequisite, *args, &block) if block_given? Rake::Task[task].enhance [prerequisite] end
default_tasks()
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 50 def default_tasks %w{install} end
define_remote_file_task(task, target_roles)
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 23 def define_remote_file_task(task, target_roles) Capistrano::UploadTask.define_task(task) do |t| prerequisite_file = t.prerequisites.first file = shared_path.join(t.name) on roles(target_roles) do unless test "[ -f #{file.to_s.shellescape} ]" info "Uploading #{prerequisite_file} to #{file}" upload! File.open(prerequisite_file), file end end end end
deploying?()
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 60 def deploying? fetch(:deploying, false) end
ensure_stage()
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 37 def ensure_stage Rake::Task.define_task(:ensure_stage) do unless stage_set? puts t(:stage_not_set) exit 1 end end end
exit_deploy_because_of_exception(ex)
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 54 def exit_deploy_because_of_exception(ex) warn t(:deploy_failed, ex: ex.message) invoke "deploy:failed" exit(false) end
remote_file(task)
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 18 def remote_file(task) target_roles = task.delete(:roles) { :all } define_remote_file_task(task, target_roles) end
tasks_without_stage_dependency()
click to toggle source
# File lib/capistrano/dsl/task_enhancements.rb, line 46 def tasks_without_stage_dependency stages + default_tasks end