diff --git a/railties/lib/rails/app_rails_loader.rb b/railties/lib/rails/app_rails_loader.rb index aae628290df32..4a17803f1c7c9 100644 --- a/railties/lib/rails/app_rails_loader.rb +++ b/railties/lib/rails/app_rails_loader.rb @@ -4,28 +4,7 @@ module Rails module AppRailsLoader RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"] EXECUTABLES = ['bin/rails', 'script/rails'] - - def self.exec_app_rails - original_cwd = Dir.pwd - - until exe = find_executable - # If we exhaust the search there is no executable, this could be a - # call to generate a new application, so restore the original cwd. - Dir.chdir(original_cwd) and return if Pathname.new(Dir.pwd).root? - - # Otherwise keep moving upwards in search of a executable. - Dir.chdir('..') - end - - contents = File.read(exe) - - # This is the Rails executable, let's use it - if contents =~ /(APP|ENGINE)_PATH/ - exec RUBY, exe, *ARGV - - # This is a Bundler binstub. Stop and explain how to upgrade. - elsif exe =~ /bin\/rails$/ && contents =~ /This file was generated by Bundler/ - $stderr.puts <<-end_bin_upgrade_warning + BUNDLER_WARNING = <