lib/magellan/rake/base_magellan_task.rb in magellan-0.1.0 vs lib/magellan/rake/base_magellan_task.rb in magellan-0.1.1
- old
+ new
@@ -4,11 +4,14 @@
module Rake
class BaseMagellanTask < ::Rake::TaskLib
attr_accessor :origin_url
attr_accessor :explore_depth
attr_accessor :ignored_urls
-
+ attr_accessor :links_to_explore
+ attr_accessor :success_message
+ attr_accessor :failure_log
+
def initialize(name)
@ignored_urls = []
@name=name
yield self if block_given?
define
@@ -19,14 +22,14 @@
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)
+ observer.add_observer(Magellan::Logger.new(failure_log))
cartographer.add_observer(observer)
cartographer.crawl
if observer.failed?
- STDERR.puts observer.failure_message
+ STDERR.puts "\n" + observer.failure_message
exit 1
else
$stdout.puts "\n" + success_message
end
end