Class: Waw::Commands::CrawlCommand
- Defined in:
- lib/waw/commands/crawl_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#__run(requester_file, arguments) ⇒ Object
Runs the sub-class defined command.
-
#add_options(options) ⇒ Object
Adds the options.
- #banner ⇒ Object
-
#check_command_policy ⇒ Object
Start command is always safe.
Methods inherited from Command
#exit, #info, #initialize, #options, #run, #shell_exec, #verbose
Constructor Details
This class inherits a constructor from Waw::Commands::Command
Instance Method Details
#__run(requester_file, arguments) ⇒ Object
Runs the sub-class defined command
35 36 37 38 39 40 41 42 |
# File 'lib/waw/commands/crawl_command.rb', line 35 def __run(requester_file, arguments) exit(nil, true) unless (arguments.size == 1) @crawler.root_uri = arguments[0] @crawler.listener.verbosity = @verbosity @crawler.crawl rescue Interrupt => ex info "waw-crawl stopping now... ciao!" if verbose end |
#add_options(options) ⇒ Object
Adds the options
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/waw/commands/crawl_command.rb', line 18 def () @crawler = Waw::Crawler.new(nil) .on("--[no-]check-externals", "[Don't] ping any external link") do |value| @crawler.check_externals = value end .on("--[no-]check-img", "[Don't] check image <img src='...'>") do |value| @crawler.ping_on('img/@src', value) end .on("--[no-]check-link", "[Don't] check <link href='...'>") do |value| @crawler.ping_on('link/@href', value) end .on("--[no-]check-script", "[Don't] check <script src='...'>") do |value| @crawler.ping_on('script/@src', value) end end |
#banner ⇒ Object
6 7 8 9 10 |
# File 'lib/waw/commands/crawl_command.rb', line 6 def <<-EOF Usage: waw-crawl [options] WEB_SITE_URI EOF end |
#check_command_policy ⇒ Object
Start command is always safe
13 14 15 |
# File 'lib/waw/commands/crawl_command.rb', line 13 def check_command_policy true end |