| Module | PhusionPassenger::LoaderSharedHelpers |
| In: |
src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb
|
Provides shared functions for loader and preloader apps.
Activate a gem and require it. This method exists in order to load a library from RubyGems instead of from vendor_ruby. For example, on Debian systems, Rack may be installed from APT, but that is usually a very old version which we don‘t want. This method ensures that the RubyGems-installed version is loaded, not the the version in vendor_ruby. See the following threads for discussion: github.com/phusion/passenger/issues/1478 github.com/phusion/passenger/issues/1480
To be called after the request handler main loop is exited. This function will fire off necessary events perform necessary cleanup tasks.
To be called before the request handler main loop is entered, but after the app startup file has been loaded. This function will fire off necessary events and perform necessary preparation tasks.
forked indicates whether the current worker process is forked off from an ApplicationSpawner that has preloaded the app code. options are the spawn options that were passed.
Prepare an application process using rules for the given spawn options. This method is to be called before loading the application code.
startup_file is the application type‘s startup file, e.g. "config/environment.rb" for Rails apps and "config.ru" for Rack apps. options are the spawn options that were given.
This function may modify options. The modified options are to be passed to the request handler.
This method is to be called after the load path has been set up (e.g. Bundler.setup is called), but before loading the app code.
If the current working directory equals `app_root`, and `abs_path` is a file inside `app_root`, then returns its basename. Otherwise, returns `abs_path`.
The main use case for this method is to ensure that we load config.ru with a relative path (only its base name) in most circumstances, instead of with an absolute path. This is necessary in order to retain compatibility with apps that expect config.ru‘s FILE to be relative. See github.com/phusion/passenger/issues/1596