aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/app_rails_loader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/app_rails_loader.rb')
-rw-r--r--railties/lib/rails/app_rails_loader.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/railties/lib/rails/app_rails_loader.rb b/railties/lib/rails/app_rails_loader.rb
index 4a17803f1c..39d8007333 100644
--- a/railties/lib/rails/app_rails_loader.rb
+++ b/railties/lib/rails/app_rails_loader.rb
@@ -2,7 +2,9 @@ require 'pathname'
module Rails
module AppRailsLoader
- RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
+ extend self
+
+ RUBY = Gem.ruby
EXECUTABLES = ['bin/rails', 'script/rails']
BUNDLER_WARNING = <<EOS
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
@@ -26,7 +28,7 @@ generate it and add it to source control:
EOS
- def self.exec_app_rails
+ def exec_app_rails
original_cwd = Dir.pwd
loop do
@@ -49,13 +51,13 @@ EOS
# 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.
+ # Otherwise keep moving upwards in search of an executable.
Dir.chdir('..')
end
end
- def self.find_executable
- EXECUTABLES.find { |exe| File.exists?(exe) }
+ def find_executable
+ EXECUTABLES.find { |exe| File.file?(exe) }
end
end
end