Class: Retriever::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/retriever/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, options) ⇒ CLI

Returns a new instance of CLI.



4
5
6
7
8
9
10
11
# File 'lib/retriever/cli.rb', line 4

def initialize(url, options)
  # kick off the fetch mode of choice
  @fetch = choose_fetch_mode(url, options)
  @fetch.dump
  @fetch.write if options['filename']
  @fetch.autodownload if options['autodown'] && options['fileharvest']
  @fetch.gen_xml if /XML/i =~ options['sitemap'].to_s
end

Instance Method Details

#choose_fetch_mode(url, options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/retriever/cli.rb', line 13

def choose_fetch_mode(url, options)
  if options['fileharvest']
    Retriever::FetchFiles.new(url, options)
  elsif options['sitemap']
    Retriever::FetchSitemap.new(url, options)
  elsif options['seo']
    Retriever::FetchSEO.new(url, options)
  else
    fail '### Error: No Mode Selected'
  end
end