kjvarga/sitemap_generator — pull request #90 by choladay (2012-10-19 02:19:19+00:00)
Title: Add `only` and `exclude` options to conditionally generate groups

Hello,

This is my first open source contribution so if I missed anything please let me know and I'd be happy to correct it.

This commit comes from my use case where certain `group`s in my sitemap.rb take hours to run, even longer in development. This made testing sitemap generation an issue.

In many cases I would want to run everything but the very slow groups. In some cases I would want to test run only the groups I modified. My workaround was to comment out unwanted groups but since my sitemap.rb was several hundred lines it became cumbersome.

My solution is to add rake task options so that only the groups I want generated get run e.g.

`rake sitemap:refresh:no_ping EXCLUDE=very_slow_group` to skip the long running groups.

Or

`rake sitemap:refresh:no_ping ONLY=newly_modified_group` to only run modified groups.

Groups that are skipped are printed like:

`! group "very_slow_group" not processed - not included in ONLY option`

and

`! group "very_slow_group" not processed - not included in EXCLUDE option`

respectively.

My implementation was to essentially piggyback off the `VERBOSE` option definition.

Thank you and I appreciate any feedback you can give me.

-Chris Holaday