Method: Thor::Actions#thor

Defined in:
lib/wip/vendor/thor/actions.rb

#thor(task, *args) ⇒ Object

Run a thor command. A hash of options can be given and it’s converted to switches.

Parameters

task<String>

the task to be invoked

args<Array>

arguments to the task

config<Hash>

give :verbose => false to not log the status. Other options are given as parameter to Thor.

Examples

thor :install, "http://gist.github.com/103208"
#=> thor install http://gist.github.com/103208

thor :list, :all => true, :substring => 'rails'
#=> thor list --all --substring=rails


265
266
267
268
269
270
271
272
273
274
275
# File 'lib/wip/vendor/thor/actions.rb', line 265

def thor(task, *args)
  config  = args.last.is_a?(Hash) ? args.pop : {}
  verbose = config.key?(:verbose) ? config.delete(:verbose) : true
  pretend = config.key?(:pretend) ? config.delete(:pretend) : false

  args.unshift task
  args.push Thor::Options.to_switches(config)
  command = args.join(' ').strip

  run command, :with => :thor, :verbose => verbose, :pretend => pretend
end