[jrubyscripting] Implement dependency tracking (#13810)

* [jrubyscripting] implement dependency tracking

watchers had to be refactored similar to jsscripting.
it supports watching any directory referenced from RUBYLIB,
as well as the gem home. it properly excludes lib and gem home
(as well as other gem homes if you have multiple jruby versions
installed) from loading as regular scripts.

this is a breaking change if you don't have RUBYLIB explicitly
configured, and you are using the old default directory.

it's expected that the detection of what files and gems any
given script uses will be self-identified by the script, presumably
by the helper library.

JRubyScriptEngineConfiguration was largely refactored as part of this.
 * CONFIGURATION_PARAMETERS was renamed, and is no longer static, since
   it's modified every time the configuration is changed
 * OptionalConfigurationElement was simplified since default values
   are always provided now. this also simplified lots of other code
   that accesses the current settings.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
Cody Cutrer
2022-12-05 00:19:51 -07:00
committed by GitHub
parent a0ac57cfd9
commit 2382fadaaa
10 changed files with 692 additions and 161 deletions

View File

@@ -48,15 +48,17 @@
<parameter name="gem_home" type="text" required="false" groupName="environment">
<label>GEM_HOME</label>
<description><![CDATA[Location Ruby Gems will be installed and loaded, directory will be created if missing and gem
installs are specified. Defaults to "<tt>OPENHAB_CONF/scripts/lib/ruby/gem_home</tt>" when not specified.
<description><![CDATA[Location Ruby Gems will be installed to and loaded from. Directory will be created if necessary.
You can use <tt>{RUBY_ENGINE_VERSION}</tt>, <tt>{RUBY_ENGINE}</tt> and/or <tt>{RUBY_VERSION}</tt> replacements in this value to automatically point to
a new directory when the addon is updated with a new version of JRuby.
Defaults to "<tt>OPENHAB_CONF/automation/ruby/.gem/{RUBY_ENGINE_VERSION}</tt>" when not specified.
]]></description>
</parameter>
<parameter name="rubylib" type="text" required="false" groupName="environment">
<label>RUBYLIB</label>
<description><![CDATA[Search path for user libraries. Separate each path with a colon (semicolon in Windows). Defaults to
"<tt>OPENHAB_CONF/automation/lib/ruby</tt>" when not specified.]]></description>
"<tt>OPENHAB_CONF/automation/ruby/lib</tt>" when not specified.]]></description>
</parameter>
<parameter name="local_context" type="text" required="false" groupName="system">

View File

@@ -3,7 +3,7 @@ automation.config.jruby.check_update.description = Check RubyGems for updates to
automation.config.jruby.check_update.option.true = Check For Updates
automation.config.jruby.check_update.option.false = Do Not Check For Updates
automation.config.jruby.gem_home.label = GEM_HOME
automation.config.jruby.gem_home.description = Location Ruby Gems will be installed and loaded, directory will be created if missing and gem installs are specified. Defaults to "<tt>OPENHAB_CONF/scripts/lib/ruby/gem_home</tt>" when not specified.
automation.config.jruby.gem_home.description = Location Ruby Gems will be installed to and loaded from. Directory will be created if necessary. You can use <tt>{RUBY_ENGINE_VERSION}</tt>, <tt>{RUBY_ENGINE}</tt> and/or <tt>{RUBY_VERSION}</tt> replacements in this value to automatically point to a new directory when the addon is updated with a new version of JRuby. Defaults to "<tt>OPENHAB_CONF/automation/ruby/.gem/{RUBY_ENGINE_VERSION}</tt>" when not specified.
automation.config.jruby.gems.label = Ruby Gems
automation.config.jruby.gems.description = A comma separated list of Ruby Gems to install. Versions may be constrained by separating with an <tt>=</tt> and then the standard RubyGems version constraint, such as "<tt>openhab-scripting=~>4.0</tt>".
automation.config.jruby.group.environment.label = Ruby Environment
@@ -26,7 +26,7 @@ automation.config.jruby.local_variable.option.global = Global
automation.config.jruby.require.label = Require Scripts
automation.config.jruby.require.description = A comma separated list of script names to be required by the JRuby Scripting Engine before running user scripts.
automation.config.jruby.rubylib.label = RUBYLIB
automation.config.jruby.rubylib.description = Search path for user libraries. Separate each path with a colon (semicolon in Windows). Defaults to "<tt>OPENHAB_CONF/automation/lib/ruby</tt>" when not specified.
automation.config.jruby.rubylib.description = Search path for user libraries. Separate each path with a colon (semicolon in Windows). Defaults to "<tt>OPENHAB_CONF/automation/ruby/lib</tt>" when not specified.
# service