lib/dynamic_sitemaps/generator.rb in dynamic_sitemaps-2.0.0.beta2 vs lib/dynamic_sitemaps/generator.rb in dynamic_sitemaps-2.0.0

- old
+ new

@@ -29,14 +29,16 @@ FileUtils.rm_rf DynamicSitemaps.temp_path end def move_to_destination sitemaps.map(&:folder).uniq.each do |folder| - destination = "#{DynamicSitemaps.path}/#{folder}" + destination = File.join(DynamicSitemaps.path, folder) FileUtils.mkdir_p destination - FileUtils.rm_rf Dir.glob("#{destination}/*") - FileUtils.mv Dir["#{DynamicSitemaps.temp_path}/#{folder}/*"], destination + FileUtils.rm_rf Dir.glob(File.join(destination, "*")) + + temp_files = File.join(DynamicSitemaps.temp_path, folder, "*.xml") + FileUtils.mv Dir.glob(temp_files), destination end remove_temp_dir end def ping_search_engines @@ -56,10 +58,10 @@ end def sitemap_for(collection, options = {}, &block) raise ArgumentError, "The collection given to `sitemap_for` must respond to #find_each. This is for performance. Use `Model.scoped` to get an ActiveRecord relation that responds to #find_each." unless collection.respond_to?(:find_each) - name = options.delete(:name) || collection.model_name.underscore.pluralize.to_sym + name = options.delete(:name) || collection.model_name.to_s.underscore.pluralize.to_sym options[:collection] = collection sitemap(name, options, &block) end \ No newline at end of file