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.



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

def initialize(url,options)
	
	#kick off the fetch mode of choice
	if options[:fileharvest]
		@fetch = Retriever::FetchFiles.new(url, options)
	elsif options[:sitemap]
		@fetch = Retriever::FetchSitemap.new(url, options)
	elsif options[:seo]
		@fetch = Retriever::FetchSEO.new(url, options)
	else
		fail "### Error: No Mode Selected"
	end

	#all fetch modes
	@fetch.dump
	@fetch.write if options[:filename]

	#fileharvest only
	@fetch.autodownload if options[:autodown] && options[:fileharvest]

	#sitemap only
	@fetch.gen_xml if /XML/i =~ options[:sitemap].to_s
end