Permalink
Browse files

cleaned up document_root handling

  • Loading branch information...
Tobias Bielohlawek
Tobias Bielohlawek committed Mar 8, 2011
1 parent 17cc976 commit dee5ddbc60086018702dec5055be9cd7df15314e
Showing with 5 additions and 14 deletions.
  1. +5 −14 lib/big_sitemap.rb
View
@@ -46,8 +46,6 @@ def initialize(options={})
raise ArgumentError, '":batch_size" must be less than ":max_per_sitemap"'
end
- @options[:document_root] ||= document_root
-
unless @options[:document_root]
raise ArgumentError, 'Document root must be specified with the ":document_root" option'
end
@@ -103,9 +101,6 @@ def file_name(name)
"#{@file_path}/sitemap_#{name}"
end
- def document_root
- end
-
def clean
Dir["#{@file_path}/sitemap_*.{xml,xml.gz}"].each do |file|
FileUtils.rm file
@@ -347,12 +342,10 @@ class BigSitemapRails < BigSitemap
def initialize(options={})
require 'action_controller'
- super options.merge(:default_url_options => default_url_options)
+ DEFAULTS.merge!(:document_root => "#{Rails.root}/public", :url_options => default_url_options)
+ super(options)
end
- def document_root
- "#{Rails.root}/public"
- end
end
@@ -361,15 +354,13 @@ class BigSitemapMerb < BigSitemap
def initialize(options={})
require 'extlib'
- super
- end
- def document_root
- "#{Merb.root}/public"
+ DEFAULTS.merge!(:document_root => "#{Merb.root}/public")
+ super(options)
end
def table_name(model)
Extlib::Inflection.tableize(model.to_s)
end
-end
+end

0 comments on commit dee5ddb

Please sign in to comment.