Sha256: 39b55d5ab9273f9502c3eaca1f722bdad4d9cbaa2b22790a8b1b33d89b790081

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 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 && !args[2].empty?
        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

5 entries across 5 versions & 1 rubygems

Version Path
shelly-0.0.43 lib/thor/thor.rb
shelly-0.0.42 lib/thor/thor.rb
shelly-0.0.41 lib/thor/thor.rb
shelly-0.0.41.pre lib/thor/thor.rb
shelly-0.0.40 lib/thor/thor.rb