1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/tasks.rb
Ersin Akinci 38f28f7704 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.
2015-08-06 17:34:29 -03:00

19 lines
283 B
Ruby

require 'rake'
# Load Rails Rakefile extensions
%w(
annotations
dev
framework
initializers
log
middleware
misc
restart
routes
tmp
).tap { |arr|
arr << 'statistics' if Rake.application.current_scope.empty?
}.each do |task|
load "rails/tasks/#{task}.rake"
end