Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Rake::DSL methods available within Railtie rake_tasks block #1174

Merged
merged 1 commit into from May 21, 2011

Conversation

bilts
Copy link
Contributor

@bilts bilts commented May 21, 2011

Fixes incompatibility introduced by Rake 0.9.0

As of Rake 0.9.0, methods such as 'task' are no longer available globally. They're placed in Rake::DSL instead. This breaks Rails::Application's initialize_tasks method. It also breaks subclasses of Railties which call Rake's methods in a rake_tasks block.

I've updated Rails::Railtie to extend Rake::DSL (if available) before loading tasks, so that formerly-global rake methods can still be called within rake_tasks blocks. I also updated Rails::Application to add its tasks within a rake_task block so it can use the rake DSL methods without issues.

This fixes issue 1171. The code is compatible with Rake 0.9.0 and Rake 0.8.7.

The change needs to be back-ported to the 3-0-stable branch as well.

Fixes incompatibility introduced by Rake 0.9.0
@gnufied
Copy link
Contributor

gnufied commented May 21, 2011

+1, This is a valid patch and fixes many of the failing tests.

@rohitarondekar
Copy link
Contributor

+1
This fixes failing tests in railties and allows a rails 3.1.0.beta-1 app to run rake tasks! :)

@dhh
Copy link
Member

dhh commented May 21, 2011

I wonder if we should wait an see what happens with Rake 0.9.1. The change was very backwards incompatible. You'd think they'd at least go to Rake 1.0 to make it.

dhh added a commit that referenced this pull request May 21, 2011
Make Rake::DSL methods available within Railtie rake_tasks block (so we're compatible with Rake 0.9.0).
@dhh dhh merged commit 8b719cf into rails:master May 21, 2011
@jasnow
Copy link

jasnow commented Jul 23, 2011

Unclear if this is in 3-1-stable branch.

Getting these messages during RUBYOPTS="-W0" rake test:

...WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Class#task called at /Users/whitemac/source/rails/railties/tmp/app/config/application.rb:48:in block in <class:Application>' ..WARNING: Global access to Rake DSL methods is deprecated. Please include ... Rake::DSL into classes and modules which use the Rake DSL methods. WARNING: DSL method Class#task called at /Users/whitemac/source/rails/railties/tmp/app/config/application.rb:44:inblock in class:Application'**

@jasnow
Copy link

jasnow commented Jul 23, 2011

Here my Gist of my run

https://gist.github.com/1101548

sguha00 pushed a commit to spore-sh/spore-rails that referenced this pull request May 8, 2015
This should not be needed rails/rails#1174
sheax0r pushed a commit to sheax0r/dotenv that referenced this pull request Sep 13, 2015
This should not be needed rails/rails#1174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rake 0.9.0 not working with 3.1 beta1
5 participants