From 38f28f77049e7160491b71167471a2175253b742 Mon Sep 17 00:00:00 2001 From: Ersin Akinci Date: Fri, 24 Jul 2015 16:51:10 -0700 Subject: 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. --- railties/lib/rails/tasks.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/tasks.rb b/railties/lib/rails/tasks.rb index c029dbcf82..d3e33584d7 100644 --- a/railties/lib/rails/tasks.rb +++ b/railties/lib/rails/tasks.rb @@ -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 -- cgit v1.2.3