Class: Puma::Launcher::BundlePruner
- Inherits:
-
Object
- Object
- Puma::Launcher::BundlePruner
- Defined in:
- lib/puma/launcher/bundle_pruner.rb
Overview
This class is used to pickup Gemfile changes during application restarts.
Instance Method Summary collapse
-
#initialize(original_argv, extra_runtime_dependencies, log_writer) ⇒ BundlePruner
constructor
A new instance of BundlePruner.
- #prune ⇒ Object
Constructor Details
#initialize(original_argv, extra_runtime_dependencies, log_writer) ⇒ BundlePruner
Returns a new instance of BundlePruner.
10 11 12 13 14 |
# File 'lib/puma/launcher/bundle_pruner.rb', line 10 def initialize(original_argv, extra_runtime_dependencies, log_writer) @original_argv = Array(original_argv) @extra_runtime_dependencies = Array(extra_runtime_dependencies) @log_writer = log_writer end |
Instance Method Details
#prune ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/puma/launcher/bundle_pruner.rb', line 16 def prune return if ENV['PUMA_BUNDLER_PRUNED'] return unless defined?(Bundler) require_rubygems_min_version! unless puma_wild_path log "! Unable to prune Bundler environment, continuing" return end dirs = paths_to_require_after_prune log '* Pruning Bundler environment' home = ENV['GEM_HOME'] bundle_gemfile = Bundler.original_env['BUNDLE_GEMFILE'] bundle_app_config = Bundler.original_env['BUNDLE_APP_CONFIG'] with_unbundled_env do ENV['GEM_HOME'] = home ENV['BUNDLE_GEMFILE'] = bundle_gemfile ENV['PUMA_BUNDLER_PRUNED'] = '1' ENV["BUNDLE_APP_CONFIG"] = bundle_app_config args = [Gem.ruby, puma_wild_path, '-I', dirs.join(':')] + @original_argv # Ruby 2.0+ defaults to true which breaks socket activation args += [{:close_others => false}] Kernel.exec(*args) end end |