Sha256: d65436d7165f5932eb003f4126754055dbeb21632ea5f07a261796a2f4563b2d

Contents?: true

Size: 767 Bytes

Versions: 37

Compression:

Stored size: 767 Bytes

Contents

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

    def hooks
      @hook
    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

37 entries across 37 versions & 1 rubygems

Version Path
shelly-0.1.3 lib/thor/thor.rb
shelly-0.1.2 lib/thor/thor.rb
shelly-0.1.1 lib/thor/thor.rb
shelly-0.1.0 lib/thor/thor.rb
shelly-0.0.62 lib/thor/thor.rb
shelly-0.0.61 lib/thor/thor.rb
shelly-0.0.60 lib/thor/thor.rb
shelly-0.0.59 lib/thor/thor.rb
shelly-0.0.58 lib/thor/thor.rb
shelly-0.0.57 lib/thor/thor.rb
shelly-0.0.56 lib/thor/thor.rb
shelly-0.0.55 lib/thor/thor.rb
shelly-0.0.55.pre lib/thor/thor.rb
shelly-0.0.54 lib/thor/thor.rb
shelly-0.0.53 lib/thor/thor.rb
shelly-0.0.52 lib/thor/thor.rb
shelly-0.0.51.pre lib/thor/thor.rb
shelly-0.0.51 lib/thor/thor.rb
shelly-0.0.50.pre2 lib/thor/thor.rb
shelly-0.0.50.pre lib/thor/thor.rb