Class: Nab::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/nab/client.rb

Instance Method Summary collapse

Instance Method Details

#run(args, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/nab/client.rb', line 5

def run(args,options)
  Log.level options.log_level

  Nab::Log.debug "Options received: #{options.inspect}"
  Nab::Log.debug "Arguments received: #{args.inspect}"

  if args.size < 1
    Nab::Log.fatal "No arguments specified"
    exit 1
  end

  manager = AdapterManager.new
  manager.write_adapter = options.write_adapter
  manager.strip_dirs = options.strip_dirs

  args.each do |a|
    uri = URI(a)
    adapter = manager.get uri.scheme.capitalize
    adapter.get uri,options.destination_dir
  end
end