Sha256: 660c6631064364bbeaf70ab8500c49c14f874d479728aa8e8b251f99f347d080

Contents?: true

Size: 720 Bytes

Versions: 5

Compression:

Stored size: 720 Bytes

Contents

# encoding: UTF-8

require 'optparse'

module Anvil
  class Task
    module ClassMethods
      def afters
        @afters ||= []
      end

      def befores
        @befores ||= []
      end

      def assures
        @assures ||= []
      end

      def after(task_name, options = {})
        afters << Callback.new(task_name, options)
      end

      def assure(assure_name)
        assures << Assure.from_name(assure_name)
      end

      def before(task_name, options = {})
        befores << Callback.new(task_name, options)
      end

      def run(*args)
        new(*args).run
      end

      def descendants
        ObjectSpace.each_object(Class).select { |klass| klass < self }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anvil-core-0.6.0 lib/anvil/task/class_methods.rb
anvil-core-0.5.0 lib/anvil/task/class_methods.rb
anvil-core-0.4.2 lib/anvil/task/class_methods.rb
anvil-core-0.4.1 lib/anvil/task/class_methods.rb
anvil-core-0.4.0 lib/anvil/task/class_methods.rb