[jrubyscripting] avoid polluting environment when auto-installing gems ()

fixes https://github.com/boc-tothefuture/openhab-jruby/issues/634;
regression from https://github.com/openhab/openhab-addons/pull/13151

Signed-Off-By: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
Cody Cutrer 2022-08-28 13:45:35 -06:00 committed by GitHub
parent a327167a58
commit 449d3518f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -164,8 +164,10 @@ public class JRubyScriptEngineConfiguration {
}
String[] gems = gemsConfigElement.getValue().get().split(",");
String gemCommand = "require 'bundler/inline'\nrequire 'openssl'\n\ngemfile(" + checkUpdate + ") do\n"
+ " source 'https://rubygems.org/'\n";
// Set update_native_env_enabled to false so that bundler doesn't leak
// into other script engines
String gemCommand = "require 'jruby'\nJRuby.runtime.instance_config.update_native_env_enabled = false\nrequire 'bundler/inline'\nrequire 'openssl'\n\ngemfile("
+ checkUpdate + ") do\n" + " source 'https://rubygems.org/'\n";
int validGems = 0;
for (String gem : gems) {
gem = gem.trim();