From 9f79234aab43ad74ffada03d6ecd10273a46afe2 Mon Sep 17 00:00:00 2001 From: Dave Allie Date: Fri, 28 Jun 2019 09:15:59 +1000 Subject: [PATCH] Fix typos and extraneous checks and rescues --- examples/config.rb | 2 +- lib/puma/dsl.rb | 4 ++-- lib/puma/launcher.rb | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/examples/config.rb b/examples/config.rb index 987d8d8c0e..0504ad47e7 100644 --- a/examples/config.rb +++ b/examples/config.rb @@ -160,7 +160,7 @@ # prune_bundler -# Extra gems to be loaded when the environment bundler context is pruned. +# Extra gems to be loaded when the bundler context is pruned. # Only applies if prune_bundler is used. # extra_runtime_dependencies ['gem_name_1', 'gem_name_2'] diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 2f46f18fc0..6e48675a80 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -462,8 +462,8 @@ def raise_exception_on_sigterm(answer=true) # When using prune_bundler, if extra runtime dependencies need to be loaded to # initialize your app, then this setting can be used. # - # For each gem's name passed, that gem will be loaded when the environment - # is pruned. + # Before bundler is pruned, the gem names supplied will be looked up in the bundler + # context and then loaded again after bundler is pruned. def extra_runtime_dependencies(answer = []) @options[:extra_runtime_dependencies] = Array(answer) end diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb index 0b914e35b4..5291d426ee 100644 --- a/lib/puma/launcher.rb +++ b/lib/puma/launcher.rb @@ -273,14 +273,12 @@ def prune_bundler "#{d.name}:#{spec.version.to_s}" end - if @options[:extra_runtime_dependencies] - @options[:extra_runtime_dependencies].each do |d_name| - spec = Bundler.rubygems.loaded_specs(d_name) rescue nil - if spec - dirs += spec.require_paths.map { |x| File.join(spec.full_gem_path, x) } - else - log "* Couldn't to load extra dependency: #{d_name}" - end + @options[:extra_runtime_dependencies].each do |d_name| + spec = Bundler.rubygems.loaded_specs(d_name) + if spec + dirs += spec.require_paths.map { |x| File.join(spec.full_gem_path, x) } + else + log "* Could not load extra dependency: #{d_name}" end end