Class: Magellan::Rake::BaseMagellanTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Magellan::Rake::BaseMagellanTask
- Defined in:
- lib/magellan/rake/base_magellan_task.rb
Overview
The base magellan rake task, defines most attributes associated with running a magellan task TODO: this is not a good place to use a template method - violates Liskov substitution principle
Direct Known Subclasses
Instance Attribute Summary collapse
-
#explore_depth ⇒ Object
How deep to explore.
-
#failure_log ⇒ Object
If this is set the logger will log out failures to a file that you specify here, you can tail this log while the crawl is running so you can see what is failing.
-
#ignored_urls ⇒ Object
An array of urls to not crawl.
-
#links_to_explore ⇒ Object
The kind of links you would like.
-
#origin_url ⇒ Object
The url to start the crawl at.
-
#success_message ⇒ Object
The success message for the task, this is set by the broken link and expected links task.
Instance Method Summary collapse
-
#define ⇒ Object
:nodoc:.
-
#initialize(name) {|_self| ... } ⇒ BaseMagellanTask
constructor
:nodoc:.
Constructor Details
#initialize(name) {|_self| ... } ⇒ BaseMagellanTask
:nodoc:
20 21 22 23 24 25 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 20 def initialize(name) # :nodoc: @ignored_urls = [] @name=name yield self if block_given? define end |
Instance Attribute Details
#explore_depth ⇒ Object
How deep to explore
9 10 11 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 9 def explore_depth @explore_depth end |
#failure_log ⇒ Object
If this is set the logger will log out failures to a file that you specify here, you can tail this log while the crawl is running so you can see what is failing
18 19 20 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 18 def failure_log @failure_log end |
#ignored_urls ⇒ Object
An array of urls to not crawl
11 12 13 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 11 def ignored_urls @ignored_urls end |
#links_to_explore ⇒ Object
The kind of links you would like
13 14 15 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 13 def links_to_explore @links_to_explore end |
#origin_url ⇒ Object
The url to start the crawl at
7 8 9 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 7 def origin_url @origin_url end |
#success_message ⇒ Object
The success message for the task, this is set by the broken link and expected links task.
15 16 17 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 15 def @success_message end |
Instance Method Details
#define ⇒ Object
:nodoc:
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 27 def define # :nodoc: desc description task @name do settings = {:origin_url => origin_url, :depth_to_explore => explore_depth, :domains => [origin_url], :ignored_urls =>ignored_urls, :links_to_explore => links_to_explore, :trace => ENV['TRACE']} cartographer = Magellan::Cartographer.new(settings) observer = create_observer observer.add_observer(Magellan::Logger.new(failure_log)) cartographer.add_observer(observer) cartographer.crawl if observer.failed? STDERR.puts "\n" + observer. exit 1 else $stdout.puts "\n" + end end end |