1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Only load statistics.rake once from inside engine

When running rake stats from inside an engine,
the engine's Rakefile attempts to reload
statistics.rake after the test app loads it, which
results in STATS_DIRECTORIES being redefined and
an annoying warning. This patch skips loading
statistics.rake from tasks.rb if rake's current
scope isn't empty, i.e. if we are running from
inside an engine and not the test app dir or a
normal app.

Fixes #20510.
This commit is contained in:
Ersin Akinci 2015-07-24 16:51:10 -07:00 committed by Rafael Mendonça França
parent ce1bd47698
commit 38f28f7704
2 changed files with 11 additions and 3 deletions

View file

@ -1,4 +1,11 @@
* Make enabling or disabling caching in development mode possible with
* Fix STATS_DIRECTORIES already defined warning when running rake from within
the top level directory of an engine that has a test app.
Fixes #20510
*Ersin Akinci*
* Make enabling or disabling caching in development mode possible with
rake dev:cache.
Running rake dev:cache will create or remove tmp/caching-dev.txt. When this

View file

@ -11,8 +11,9 @@ require 'rake'
misc
restart
routes
statistics
tmp
).each do |task|
).tap { |arr|
arr << 'statistics' if Rake.application.current_scope.empty?
}.each do |task|
load "rails/tasks/#{task}.rake"
end