Sha256: bfa3e20eef97913bc17561c17af3bc93383e6db51f8e1b28bcc365a79632cff1

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 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 << [from_name(task_name), options]
      end

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

      def before(task_name, options = {})
        befores << [from_name(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.3.2 lib/anvil/task/class_methods.rb
anvil-core-0.3.1 lib/anvil/task/class_methods.rb
anvil-core-0.3.0 lib/anvil/task/class_methods.rb
anvil-core-0.2.0 lib/anvil/task/class_methods.rb
anvil-core-0.1.0 lib/anvil/task/class_methods.rb