Sha256: da9ad5606d24fe58e58d9bad689d2fb7e159599000ad70a3a39535ec83eacd89
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
module Capistrano module TaskEnhancements def before(task, prerequisite, *args, &block) prerequisite = Rake::Task.define_task(prerequisite, *args, &block) if block_given? Rake::Task[task].enhance [prerequisite] end def after(task, post_task, *args, &block) post_task = Rake::Task.define_task(post_task, *args, &block) if block_given? Rake::Task[task].enhance do invoke(post_task) end end def remote_file(task) target_roles = task.delete(:roles) { :all } define_remote_file_task(task, target_roles) end def define_remote_file_task(task, target_roles) Rake::Task.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} ]" info "Uploading #{prerequisite_file} to #{file}" upload! File.open(prerequisite_file), file end end end end def ensure_stage Rake::Task.define_task(:ensure_stage) do unless stage_set? puts t(:stage_not_set) exit 1 end end end def tasks_without_stage_dependency stages + default_tasks end def default_tasks %w{install} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano-3.0.1 | lib/capistrano/dsl/task_enhancements.rb |
capistrano-3.0.0 | lib/capistrano/dsl/task_enhancements.rb |