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.0.50 lib/thor/thor.rb
shelly-0.0.49.pre lib/thor/thor.rb
shelly-0.0.49 lib/thor/thor.rb
shelly-0.0.48 lib/thor/thor.rb
shelly-0.0.48.pre4 lib/thor/thor.rb
shelly-0.0.48.pre3 lib/thor/thor.rb
shelly-0.0.48.pre2 lib/thor/thor.rb
shelly-0.0.48.pre lib/thor/thor.rb
shelly-0.0.47 lib/thor/thor.rb
shelly-0.0.46.pre4 lib/thor/thor.rb
shelly-0.0.46.pre3 lib/thor/thor.rb
shelly-0.0.46.pre2 lib/thor/thor.rb
shelly-0.0.46.pre lib/thor/thor.rb
shelly-0.0.45 lib/thor/thor.rb
shelly-0.0.44.pre3 lib/thor/thor.rb
shelly-0.0.44.pre2 lib/thor/thor.rb
shelly-0.0.44.pre lib/thor/thor.rb