Skip to content

Commit c2f3eed

Browse files
authored
Document console commands and bundle_gemfile setting (#427)
Docs for openhab/openhab-addons#18404 and openhab/openhab-addons#18374 Signed-off-by: Jimmy Tanagra <[email protected]>
1 parent a7f6023 commit c2f3eed

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

USAGE.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Additional [example rules are available](docs/examples.md), as well as examples
109109
- [Dynamic Generation of Rules](#dynamic-generation-of-rules)
110110
- [Scenes and Scripts](#scenes-and-scripts)
111111
- [Hooks](#hooks)
112+
- [Console Commands](#console-commands)
112113
- [Calling Java From JRuby](#calling-java-from-jruby)
113114
- [Full Documentation](#full-documentation)
114115

@@ -158,12 +159,14 @@ Simply change the `gems` and `require` configuration settings.
158159
| --------------------- | ---------------------------------------------------------------------------------------------------------- |
159160
| `gem_home` | The path to store Ruby Gems. <br/><br/>Default: `$OPENHAB_CONF/automation/ruby/.gem/{RUBY_ENGINE_VERSION}` |
160161
| `gems` | A list of gems to install. <br/><br/>Default: `openhab-scripting=~>5.0` |
162+
| `bundle_gemfile` | The path to your Gemfile relative to `$OPENHAB_CONF/automation/ruby`. <br/><br/>Default: `Gemfile` |
161163
| `check_update` | Check for updated version of `gems` on start up or settings change. <br/><br/>Default: `true` |
162164
| `require` | List of scripts to be required automatically. <br/><br/>Default: `openhab/dsl` |
163165
| `rubylib` | Search path for user libraries. <br/><br/>Default: `$OPENHAB_CONF/automation/ruby/lib` |
164166
| `dependency_tracking` | Enable dependency tracking. <br/><br/>Default: `true` |
165167
| `local_context` | See notes below. <br/><br/>Default: `singlethread` |
166168
| `local_variables` | See notes below. <br/><br/>Default: `transient` |
169+
| `console` | The default script used by `jrubyscripting console` Karaf console command. <br/><br/>Default: `irb` |
167170

168171
When using file-based configuration, these parameters must be prefixed with `org.openhab.automation.jrubyscripting:`, for example:
169172

@@ -194,15 +197,31 @@ Examples:
194197
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
195198
| `openhab-scripting` | install the latest version of `openhab-scripting` gem |
196199
| `openhab-scripting=~>5.0.0` | install the latest version 5.0.x but not 5.1.x |
197-
| `openhab-scripting=~>5.0` | install the latest version 5.x but not 6.x |
200+
| `openhab-scripting=~>5.0` | install the latest version 5.x but not 6.x. **This is the default/recommended setting.** |
198201
| `openhab-scripting=~>5.0, faraday=~>2.7;>=2.7.4` | install `openhab-scripting` gem version 5.x and `faraday` gem version 2.7.4 or higher, but less than 3.0 |
199202
| `gem1= >= 2.2.1; <= 2.2.5` | install `gem1` gem version 2.2.1 or above, but less than or equal to version 2.2.5 |
200203

204+
### bundle_gemfile <!-- omit from toc -->
205+
206+
A path to your Gemfile, including the file name.
207+
It can be an absolute path, or just the file-name portion, in which case it will be resolved to `$OPENHAB_CONF/automation/ruby`.
208+
The default is `Gemfile`.
209+
210+
If the Gemfile doesn't exist, the [gems](#gems) setting will take effect, and bundler will not be used.
211+
212+
The [bundler init console command](#console-commands) can be used to create a new Gemfile, or you can create it manually.
213+
When this Gemfile exists, the [gems](#gems) setting will be ignored, and only the gems specified in your Gemfile will be installed and used.
214+
215+
Note that by default, the gems listed in the Gemfile will also be required, so it's not necessary to require them again in the [require](#require) setting.
216+
To disable this behavior for a specific gem, add a `require: false` argument to the `gem` command within the Gemfile.
217+
201218
### check_update <!-- omit from toc -->
202219

203220
Check RubyGems for updates to the above gems when openHAB starts or JRuby settings are changed.
204221
Otherwise it will try to fulfil the requirements with locally installed gems, and you can manage them yourself with an external Ruby by setting the same GEM_HOME.
205222

223+
This setting equally applies whether you're using bundler with [Gemfile](#bundle_gemfile) or the [gems](#gems) way of installing Ruby gems.
224+
206225
### require <!-- omit from toc -->
207226

208227
A comma separated list of script names to be required by the JRuby Scripting Engine at the beginning of user scripts.
@@ -1886,6 +1905,19 @@ script_unloaded do
18861905
end
18871906
```
18881907

1908+
## Console Commands
1909+
1910+
Karaf Console commands are provided for performing maintenance and troubleshooting tasks.
1911+
The commands are prefixed with `openhab:jrubyscripting` or just `jrubyscripting` followed by the sub-commands listed below:
1912+
1913+
| Command | Description |
1914+
| --------- | ---------------------------------------------------------------------------------------------------------------- |
1915+
| `info` | Displays information about JRuby Scripting add-on |
1916+
| `console` | Starts an interactive JRuby REPL console which allows you to interact directly with the current openHAB runtime. |
1917+
| `bundle` | Runs Ruby bundler with your Gemfile as configured with [bundle_gemfile](#bundle_gemfile) setting |
1918+
| `gem` | Runs Ruby gem command to installs, upgrade, uninstall gems that are located in your [gem_home](#gem_home) |
1919+
| `prune` | Removes gem files and directories from older openhab installations. |
1920+
18891921
## Calling Java From JRuby
18901922

18911923
JRuby can [access almost any Java object](https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby) that's available in the current JVM.

0 commit comments

Comments
 (0)