Sha256: c2f2b2445a81f7e824416fb27161b97f751efd7ac3e7c3dd72773f56c66540ce
Contents?: true
Size: 975 Bytes
Versions: 13
Compression:
Stored size: 975 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
13 entries across 13 versions & 2 rubygems