class method
self.exec_app_rails
Ruby on Rails 4.0.13
Since v4.0.13 Last seen in v4.1.16Available in: v4.0.13 v4.1.16
Signature
self.exec_app_rails()
No documentation comment.
Source
# File railties/lib/rails/app_rails_loader.rb, line 29
def self.exec_app_rails
original_cwd = Dir.pwd
loop do
if exe = find_executable
contents = File.read(exe)
if contents =~ /(APP|ENGINE)_PATH/
exec RUBY, exe, *ARGV
break # non reachable, hack to be able to stub exec in the test suite
elsif exe.end_with?('bin/rails') && contents.include?('This file was generated by Bundler')
$stderr.puts(BUNDLER_WARNING)
Object.const_set(:APP_PATH, File.expand_path('config/application', Dir.pwd))
require File.expand_path('../boot', APP_PATH)
require 'rails/commands'
break
end
end
# 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
end
Defined in railties/lib/rails/app_rails_loader.rb line 29
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::AppRailsLoader