@rlkoshak: I’d love to get additional feedback from you on these (constructive!) criticisms. You’re a definite (spiritual, if not official ) leader in the community.
I know UI rules are supported now, and have been for some time. They’re probably not the primary method that any of the people that maintain the JRuby/OpenHAB libraries use, but we’re at least aware of them. So let’s assume that’s no longer an issue…
As for the gem installation method - I’m kind of surprised. I’ve always felt the gem method was ingenious and super friction-free. But maybe that’s because my comparison was trying to install the JavaScript and/or Python helper libraries in the super early days of support for non-DSL rules of any type in the first place, where you had to do git clones and modify files, and then updating them was all-but impossible. And I’m also partial to and very familiar with gems, since I have a very deep Ruby background. So… how do you think we could make this better? At the moment, the workflow is the install the org.openhab.automation.jrubyscripting add-on, then go and configure it to tell it which gem(s) you want installed by default, including version constraints. I think there has been hesitancy in the past by maintainers of the JRuby/openHAB libraries to too-strongly endorse their own gem. But it seems like maybe that’s misplaced. How would you feel if we changed the default configuration for the add-on to install a helper library gem? Would eliminate one more step. I can’t imagine anyone using any of the JSR223 languages without a helper library nowadays. After working on the helper library extensively the past few months, I think I finally could write some rules without it, but it would be a lot of work.
Next up … inter-rule caching. I assume you’re referring mainly to UI rules, no? Because if you’re writing file-based rules, it’s excessively simple to just have a variable (there are several types in Ruby) that lives at the top level outside of any particular rule, just like you would in DSL. There’s not currently a way to access a global variable between files, because each file gets its own instance of JRuby (unless you tweak some configuration that the add-on at least lets you tweak, but hasn’t really been tested to work well that way). Okay, so back to UI rules - wouldn’t all languages have the same problem? It seems that https://github.com/openhab/openhab-core/pull/2887 is really what we need, and it’s still pending. As soon as it’s in, I’d be happy to quickly add idiomatic support to it for the JRuby libraries. If you really think this is a major obstacle to adoption of people using JRuby actions, I could even jump in and try to get the core PR through. I’ve been gaining some experience in core and a couple of other addons lately too, so I’m feeling like I could get to that.
And finally… documentation. I totally hear you here. For the past month or two I’ve been working on major refactoring of the JRuby scripting libraries, and part of that was motivated by dissatisfaction with the documentation (both using it, and writing it). You can see the new docs for my release candidate at Redirecting to YARD documentation.../. It’s now strictly in the primary code-documentation tool for Ruby (YARD), so the class, method, and parameter details etc. are guaranteed to be up to date with the library’s actual code, and the examples are now inline so you don’t have to jump back and forth between example and narrative documentation to the technical documentation. It is still not on Introduction | openHAB, but given that the library evolves on a very different schedule from openHAB itself, I don’t think that’s necessarily a bad thing – and wouldn’t really be possible I don’t think, given how it’s generated via YARD. We could definitely improve the theming to look more like the official documentation site. So, given that, would a link to this documentation from the add-on’s README and main configuration page in openHAB proper improve the discoverability enough?
Oh, and one more thing. Would you recommend that we try to get the gem’s repository moved into the openHAB org on GitHub, instead of hosted on our own personal account? It doesn’t really matter to me where it is, as long as we can continue to maintain it ourselves. But it would give even more air of endorsement of “this is how you use Ruby in openHAB”. And the docs could move to https://openhab.github.io/openhab-jrubyscripting/ - a slightly better URL.
Let me know your thoughts, I definitely want to appeal to as broad of an audience of openHAB users as possible.