Simplify rake task hierarchy#477
Merged
n-rodriguez merged 1 commit intokjvarga:masterfrom Mar 20, 2026
Merged
Conversation
c01bd17 to
79f3776
Compare
jasonkarns
added a commit
to jasonkarns/sitemap_generator
that referenced
this pull request
Mar 21, 2026
* upstream/master: Enhance Rails railtie to respect existing rails configuration (kjvarga#478) Improve Sitemap method-missing implementation (kjvarga#473) Fix broken specs (kjvarga#476) Simplify rake task hierarchy (kjvarga#477) Fix AWS upload deprecation (kjvarga#464)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The require structure (both for loading the sitemap_generator gem, and for booting the Rails :environment), is legacy remainder from Rails plugins (pre Rails 4).
As the gem now only supports Rails 6+, we can simplify the task dependency tree quite a bit.
sitemap:requiretask down to only requiring the 'sitemap_generator' gem.This may be necessary in an app, where these tasks are loaded directly from the user's Rakefile via
require 'sitemap_generator/tasks'.Enhance this base
sitemap:requiretask to boot the rails environment, but only if Rails is defined. (ie, in a Rails app) With :environment added as a pre-req, it will run before thesitemap:requiretask. If in a Rails environment, and after the environment is booted, it is unlikely that we even need a require. (In most cases, the gem will already have been required by Rails usingBundler.require.) However, we cannot assume this is the case, as user's may omit the sitemap_generator gem from auto-requiring.Simplify all pre-req references to depend on the base
sitemap:requiretask (which would be conditionally enhanced if in a Rails app).