Method: Thor::Actions#run

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

#run(command, config = {}) ⇒ Object

Executes a command returning the contents of the command.

Parameters

command<String>

the command to be executed.

config<Hash>

give :verbose => false to not log the status. Specify :with to append an executable to command executation.

Example

inside('vendor') do
  run('ln -s ~/edge rails')
end


222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/wip/vendor/thor/actions.rb', line 222

def run(command, config={})
  return unless behavior == :invoke

  destination = relative_to_original_destination_root(destination_root, false)
  desc = "#{command} from #{destination.inspect}"

  if config[:with]
    desc = "#{File.basename(config[:with].to_s)} #{desc}"
    command = "#{config[:with]} #{command}"
  end

  say_status :run, desc, config.fetch(:verbose, true)
  `#{command}` unless options[:pretend]
end