Sha256: b47a093a23b314564b89296796ab06c905a341d18cade51f0b88edd28a5abda0

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

class Thor
  class << self
    def before_hook(method, options = {})
      @hook = {} unless @hook
      @hook[method] = options
    end

    def send(*args)
      if args.first == :dispatch
        running_task = args[2].first
        @hook.each do |method, options|
          if options[:only].include?(running_task.to_sym)
            new.send(method)
          end
        end
      end
      super
    end

    def start(given_args=ARGV, config={})
      config[:shell] ||= Thor::Base.shell.new
      send(:dispatch, nil, given_args.dup, nil, config)
    rescue Thor::Error => e
      ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message)
      exit(1) if exit_on_failure?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shelly-0.0.39 lib/thor/thor.rb
shelly-0.0.38 lib/thor/thor.rb