Sha256: bffa5def40f7f635f8f6492cb3f72f9a2b27b53c97148b73382177f6283a7428

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

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

3 entries across 3 versions & 1 rubygems

Version Path
anvil-core-0.0.1.pre.alpha.3 lib/anvil/task/class_methods.rb
anvil-core-0.0.1.pre.alpha.2 lib/anvil/task/class_methods.rb
anvil-core-0.0.1.alpha.1 lib/anvil/task/class_methods.rb