adamsalter / sitemap_generator

This plugin enables 'enterprise-class' Google Sitemaps to be easily generated for a Rails site as a rake task, using a simple 'Rails Routes'-like DSL. It allows you to take care of familiar Sitemap issues like: Gzip of Sitemap files, variable priority links, paging/sorting links (e.g. my_list?page=3), SSL host links (e.g. https:), Rails apps which are installed on a sub-path (e.g. example.com/blog_app/) and hidden AJAX routes. It includes a Sitemap Index file so it supports more than the standard 50,000 individual urls (up to a maximum of 2.5 billion), and pings all major search engines on completion (Google, Yahoo, MSN, Ask, SitemapWriter).
MIT License
268 stars 304 forks source link

tasks are polluting object with sitemap generator methods #3

Closed richievos closed 14 years ago

richievos commented 14 years ago

The following lines live in sitemap:create: task :create => [:environment] do include SitemapGenerator::Helper include ActionView::Helpers::NumberHelper

When those lines run, they're running their include on Object, adding a bunch of junk to it.

To prove this, add this to your Rakefile

at_exit { puts "I am #{self.class.name} and I have load_sitemap_rb defined on me? #{methods.include?('load_sitemap_rb')}" }

then run rake sitemap:create

I think the underlying issue is that there's quite a bit of code in the tasks file, that should maybe live somewhere else.

I'll take a crack at refactoring this and reference this issue.

richievos commented 14 years ago

I took a crack at it http://github.com/jerryvos/sitemap_generator/commit/69979bc78b593df6987fa53be86abbc053b1c860

kjvarga commented 14 years ago

Resolved.