Method: CoinSync::RunCommandTask#run

Defined in:
lib/coinsync/run_command_task.rb

#run(source_name, command, args = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/coinsync/run_command_task.rb', line 9

def run(source_name, command, args = [])
  source = @config.sources[source_name] or raise "Source not found in the config file: '#{source_name}'"
  importer = source.importer

  if importer.class.registered_commands.include?(command.to_sym)
    importer.send(command.to_sym, *args)
  else
    raise "#{source_name}: no such command: #{command}"
  end
end