From 0caf8ffd7d19a3a3c8d7eca158b4ea66185ce4ae Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 11 Apr 2016 12:20:53 +0200 Subject: [PATCH] revises fileutils dependencies in railties With the exception of what is loaded in active_support/rails, each file is responsible for its own dependencies. You cannot rely on runtime order of execution. --- railties/lib/rails/application.rb | 1 - railties/lib/rails/application/bootstrap.rb | 7 ++++--- railties/lib/rails/dev_caching.rb | 2 ++ railties/lib/rails/generators/actions/create_migration.rb | 1 + railties/lib/rails/generators/app_base.rb | 1 + railties/lib/rails/tasks/framework.rake | 1 + railties/lib/rails/tasks/restart.rake | 2 ++ railties/lib/rails/tasks/tmp.rake | 2 ++ 8 files changed, 13 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 4729ddcf62..756006cdf4 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -1,4 +1,3 @@ -require 'fileutils' require 'yaml' require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/object/blank' diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb index 9baf8aa742..f615f22b26 100644 --- a/railties/lib/rails/application/bootstrap.rb +++ b/railties/lib/rails/application/bootstrap.rb @@ -1,6 +1,7 @@ -require "active_support/notifications" -require "active_support/dependencies" -require "active_support/descendants_tracker" +require 'fileutils' +require 'active_support/notifications' +require 'active_support/dependencies' +require 'active_support/descendants_tracker' module Rails class Application diff --git a/railties/lib/rails/dev_caching.rb b/railties/lib/rails/dev_caching.rb index 3c20164f0f..f2a53d6417 100644 --- a/railties/lib/rails/dev_caching.rb +++ b/railties/lib/rails/dev_caching.rb @@ -1,3 +1,5 @@ +require 'fileutils' + module Rails module DevCaching # :nodoc: class << self diff --git a/railties/lib/rails/generators/actions/create_migration.rb b/railties/lib/rails/generators/actions/create_migration.rb index d664b07652..6c5b55466d 100644 --- a/railties/lib/rails/generators/actions/create_migration.rb +++ b/railties/lib/rails/generators/actions/create_migration.rb @@ -1,3 +1,4 @@ +require 'fileutils' require 'thor/actions' module Rails diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 89341e6fa2..151bf9a879 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -1,3 +1,4 @@ +require 'fileutils' require 'digest/md5' require 'active_support/core_ext/string/strip' require 'rails/version' unless defined?(Rails::VERSION) diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index 61fb8311a5..b28d47ef12 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -1,3 +1,4 @@ +require 'fileutils' require 'active_support/deprecation' namespace :app do diff --git a/railties/lib/rails/tasks/restart.rake b/railties/lib/rails/tasks/restart.rake index 7e15bb55a1..4f013484d3 100644 --- a/railties/lib/rails/tasks/restart.rake +++ b/railties/lib/rails/tasks/restart.rake @@ -1,3 +1,5 @@ +require 'fileutils' + desc "Restart app by touching tmp/restart.txt" task :restart do FileUtils.mkdir_p('tmp') diff --git a/railties/lib/rails/tasks/tmp.rake b/railties/lib/rails/tasks/tmp.rake index 22785da557..deadb43892 100644 --- a/railties/lib/rails/tasks/tmp.rake +++ b/railties/lib/rails/tasks/tmp.rake @@ -1,3 +1,5 @@ +require 'fileutils' + namespace :tmp do desc "Clear cache and socket files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear)" task clear: ["tmp:cache:clear", "tmp:sockets:clear"]