Sha256: 3a8b4de952c9d0f1ff6ec99e7edf44a4c0629905be2ebccb3346757ccce05703
Contents?: true
Size: 974 Bytes
Versions: 85
Compression:
Stored size: 974 Bytes
Contents
module Capistrano class Callback attr_reader :source, :options, :only, :except def initialize(source, options={}) @source = source @options = options @only = Array(options[:only]).map { |v| v.to_s } @except = Array(options[:except]).map { |v| v.to_s } end def applies_to?(task) if task && only.any? return only.include?(task.fully_qualified_name) elsif task && except.any? return !except.include?(task.fully_qualified_name) else return true end end end class ProcCallback < Callback def call source.call end end class TaskCallback < Callback attr_reader :config def initialize(config, source, options={}) super(source, options) @config = config end def call config.find_and_execute_task(source) end def applies_to?(task) super && (task.nil? || task.fully_qualified_name != source.to_s) end end end
Version data entries
85 entries across 85 versions & 10 rubygems