Skip to content

Commit 8f3e2cc

Browse files
committed
fix: Ensure Gem.paths are clear/reset after being adjusted during init
1 parent 1463d88 commit 8f3e2cc

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/warbler/templates/jar.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ ENV['GEM_PATH'] = nil # RGs sets Gem.paths.path = Gem.default_path + [ GEM_HOME
99
<% if config.bundler && config.bundler[:gemfile_path] -%>
1010
ENV['BUNDLE_GEMFILE'] = File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__)
1111
<% end -%>
12+
<%# Ensure any cached paths are cleared; otherwise behaviour can be indeterminate if the paths have already been read %>
13+
# Gem.clear_paths

lib/warbler/templates/war.erb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
if $servlet_context.nil?
22
ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path(File.join('..', '..', '<%= config.gem_path %>'), __FILE__)
3-
<% if config.override_gem_home -%>
4-
<% # GEM_HOME/GEM_PATH are set as .war gets extracted (on java -jar ...)
5-
# ... thus setting `ENV['GEM_PATH'] = nil` would cause a boot failure
6-
-%>
7-
<% end -%>
83
<% if config.bundler && config.bundler[:gemfile_path] -%>
94
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__)
105
<% end -%>
@@ -17,3 +12,5 @@ else
1712
ENV['BUNDLE_GEMFILE'] ||= $servlet_context.getRealPath('/<%= config.bundler[:gemfile_path] %>')
1813
<% end -%>
1914
end
15+
<%# Ensure any cached paths are cleared; otherwise behaviour can be indeterminate if the paths have already been read %>
16+
Gem.clear_paths

0 commit comments

Comments
 (0)