Class: Magellan::Rake::BaseMagellanTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Magellan::Rake::BaseMagellanTask
- Defined in:
- lib/magellan/rake/base_magellan_task.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#explore_depth ⇒ Object
Returns the value of attribute explore_depth.
-
#failure_log ⇒ Object
Returns the value of attribute failure_log.
-
#ignored_urls ⇒ Object
Returns the value of attribute ignored_urls.
-
#links_to_explore ⇒ Object
Returns the value of attribute links_to_explore.
-
#origin_url ⇒ Object
Returns the value of attribute origin_url.
-
#success_message ⇒ Object
Returns the value of attribute success_message.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name) {|_self| ... } ⇒ BaseMagellanTask
constructor
A new instance of BaseMagellanTask.
Constructor Details
#initialize(name) {|_self| ... } ⇒ BaseMagellanTask
Returns a new instance of BaseMagellanTask.
13 14 15 16 17 18 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 13 def initialize(name) @ignored_urls = [] @name=name yield self if block_given? define end |
Instance Attribute Details
#explore_depth ⇒ Object
Returns the value of attribute explore_depth.
7 8 9 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 7 def explore_depth @explore_depth end |
#failure_log ⇒ Object
Returns the value of attribute failure_log.
11 12 13 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 11 def failure_log @failure_log end |
#ignored_urls ⇒ Object
Returns the value of attribute ignored_urls.
8 9 10 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 8 def ignored_urls @ignored_urls end |
#links_to_explore ⇒ Object
Returns the value of attribute links_to_explore.
9 10 11 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 9 def links_to_explore @links_to_explore end |
#origin_url ⇒ Object
Returns the value of attribute origin_url.
6 7 8 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 6 def origin_url @origin_url end |
#success_message ⇒ Object
Returns the value of attribute success_message.
10 11 12 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 10 def @success_message end |
Instance Method Details
#define ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/magellan/rake/base_magellan_task.rb', line 20 def define 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 |