Glad to hear you’re interested. To get it up and running, follow this link and you’ll find a jar compiled for OH3, even though the repo is a clone of openhab2-addons. After you drop it in the addons-folder, the rest should take care of itself.
You are very welcome to come with suggestions and/or PRs to improve the helper libraries!
Okay, I’ve got the openhab bundle installed, and restarted OpenHAB. It appears to be loading my script file, but the require "openhab" is broken. I created the services/jruby.cfg file, but I don’t see that the openhab-scripting gem was installed to my gem_home. Also, where does it find JRuby? Is it included in the jar? I.e. how would I install additional gems accessible to my rules? I obviously don’t want to use my system ruby (MRI 2.7), even if I set my GEM_HOME.
Jruby is included as a dependency, so it’s included in the bundle. Can you post the contents of the services/jruby.cfg file? This is how mine look e.g:
and no, /var/lib/openhab/config/org/openhab/automation/jrubyscripting.config is not showing anything. but I’m clearly running a ruby file in /etc/openhab/automation/jsr223/ruby/personal/test.rb that’s doing things like raise RUBY_VERSION and I can see the output in openhab.log. Note that I’m using OpenHAB 3.2.0-SNAPSHOT from 2 days ago.
Have you restarted OH after you saved the jruby.cfg-file? Don’t think it should be necessary, but not sure why it’s not being read otherwise. If that doesn’t work, try setting the configuration manually via the karaf console:
ah, I found the problem. the automation directory was owned by my user, not openhab, so it couldn’t write to it. I might have more questions, but I’m over that hurdle
so the env var is getting set correctly, but it’s not affecting $LOAD_PATH. I wonder if however JRuby is starting up inside the script host is not using the environment variable (as opposed to booting as its own process). https://github.com/jruby/jruby/blob/master/spec/ruby/command_line/rubylib_spec.rb sure implies that they only expect it to work with command line. maybe we should do $LOAD_PATH.unshift(ENV['RUBYLIB']) if ENV['RUBYLIB'] inside the openhab-jruby gem (with proper handling of splitting into multiple entries)?
I have been negligent in announcing new releases here…
Version 3.9.0 was just released and I would welcome @ccutrer who added the new feature and has been contributing across the board on bug fixes and optimizations.
I did have a look but could not understand it completely.
Am trying to get this working. This is jython
“actions.get(“pushover”, “pushover:pushover-account:Pushover”).sendMessage(result, “Openhab 3 - Front door Lock”)”
How would that be written in Jruby?
The document also mentions about 2 ways to access actions. one being the action way and the other thing based.