]> git.basschouten.com Git - openhab-addons.git/commitdiff
[jrubyscripting] Fix broken image in README.md (#15435)
authorjimtng <2554958+jimtng@users.noreply.github.com>
Sat, 19 Aug 2023 20:41:54 +0000 (06:41 +1000)
committerGitHub <noreply@github.com>
Sat, 19 Aug 2023 20:41:54 +0000 (22:41 +0200)
* [jrubyscripting] Fix broken image in README.md
* [jrubyscripting] Update the base url in the regenerate instructions

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
bundles/org.openhab.automation.jrubyscripting/README.md
bundles/org.openhab.automation.jrubyscripting/doc/rule-config.png [new file with mode: 0644]
bundles/org.openhab.automation.jrubyscripting/doc/rule-engines.png [new file with mode: 0644]
bundles/org.openhab.automation.jrubyscripting/doc/rule-script.png [new file with mode: 0644]
bundles/org.openhab.automation.jrubyscripting/docs/images/rule-config.png [deleted file]
bundles/org.openhab.automation.jrubyscripting/docs/images/rule-engines.png [deleted file]
bundles/org.openhab.automation.jrubyscripting/docs/images/rule-script.png [deleted file]

index 157cb1ae1263e197424100804d14537a974919ce..39686cb12bd631f8c6d1610dda147a15fd2b0489 100644 (file)
@@ -1,5 +1,5 @@
 <!-- This file is auto-generated by YARD from https://github.com/openhab/openhab-jruby/blob/main/USAGE.md; please do not edit directly -->
-<!-- To regenerate, run `bin/yard display -f markdown -o https://openhab.github.io/openhab-jruby/5.4 file:USAGE.md` -->
+<!-- To regenerate, run `bin/yard display -f markdown -o https://openhab.github.io/openhab-jruby/main file:USAGE.md` -->
 
 # JRuby Scripting
 
@@ -217,18 +217,18 @@ Advanced users, or users migrating scripts from existing systems may want to use
 
 Using the openHAB UI, first create a new rule and set a trigger condition.
 
-![openHAB Rule Configuration](docs/images/rule-config.png)
+![openHAB Rule Configuration](doc/rule-config.png)
 
 #### Adding Actions
 
 Select "Add Action" and then select "Run Script" with "Ruby".
 This will bring up an empty script editor where you can enter your JavaScript.
 
-![openHAB Rule Engines](docs/images/rule-engines.png)
+![openHAB Rule Engines](doc/rule-engines.png)
 
 You can now write rules using standard Ruby along with the included openHAB [library](#library-details).
 
-![openHAB Rule Script](docs/images/rule-script.png)
+![openHAB Rule Script](doc/rule-script.png)
 
 For example, turning a light on:
 
@@ -740,23 +740,24 @@ Exec.execute_command_line('/path/to/program')
 
 ### Logging
 
-The JRuby Scripting addon has a global `logger` object for logging.
+The JRuby Scripting addon has a global `logger` object for logging. To log a message on `INFO` log level:
 
-```text
-log:set DEBUG org.openhab.automation.jrubyscripting.script
+```ruby
+logger.info("The current time is #{Time.now}")
 ```
 
 The default logger name for UI rules is `org.openhab.automation.jrubyscripting.script`.
 For file-based rules, it's based on the rule's ID, such as `org.openhab.automation.jrubyscripting.rule.myrule.rb:15`
-This can be changed by assigning a new logger locally.
 
-Please be aware that messages might not appear in the logs if the logger name does not start with `org.openhab`.
-This behaviour is due to [log4j2](https://logging.apache.org/log4j/2.x/) requiring definition for each logger prefix.
+To use a custom logger name:
 
 ```ruby
 logger = OpenHAB::Log.logger("org.openhab.custom")
 ```
 
+Please be aware that messages might not appear in the logs if the logger name does not start with `org.openhab`.
+This behaviour is due to [log4j2](https://logging.apache.org/log4j/2.x/) requiring definition for each logger prefix.
+
 The [logger](https://openhab.github.io/openhab-jruby/main/OpenHAB/Logger.html) is similar to a standard [Ruby Logger](https://docs.ruby-lang.org/en/master/Logger.html).
 Supported logging functions include:
 
@@ -810,7 +811,7 @@ When a script is unloaded, all created timers are automatically cancelled.
 You can access all variables of the current context in the created timers.
 
 Note: Variables can be mutated (changed) after the timer has been created.
-Be aware that this can lead to unattended side effects, e.g. when you change the variable after timer creation, which can make debugging quite difficult!
+Be aware that this can lead to unintentional side effects, e.g. when you change the variable after timer creation, which can make debugging quite difficult!
 
 ```ruby
 my_var = "Hello world!";
diff --git a/bundles/org.openhab.automation.jrubyscripting/doc/rule-config.png b/bundles/org.openhab.automation.jrubyscripting/doc/rule-config.png
new file mode 100644 (file)
index 0000000..e26c6a0
Binary files /dev/null and b/bundles/org.openhab.automation.jrubyscripting/doc/rule-config.png differ
diff --git a/bundles/org.openhab.automation.jrubyscripting/doc/rule-engines.png b/bundles/org.openhab.automation.jrubyscripting/doc/rule-engines.png
new file mode 100644 (file)
index 0000000..369938c
Binary files /dev/null and b/bundles/org.openhab.automation.jrubyscripting/doc/rule-engines.png differ
diff --git a/bundles/org.openhab.automation.jrubyscripting/doc/rule-script.png b/bundles/org.openhab.automation.jrubyscripting/doc/rule-script.png
new file mode 100644 (file)
index 0000000..91fa9d6
Binary files /dev/null and b/bundles/org.openhab.automation.jrubyscripting/doc/rule-script.png differ
diff --git a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-config.png b/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-config.png
deleted file mode 100644 (file)
index e26c6a0..0000000
Binary files a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-config.png and /dev/null differ
diff --git a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-engines.png b/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-engines.png
deleted file mode 100644 (file)
index 369938c..0000000
Binary files a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-engines.png and /dev/null differ
diff --git a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-script.png b/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-script.png
deleted file mode 100644 (file)
index 91fa9d6..0000000
Binary files a/bundles/org.openhab.automation.jrubyscripting/docs/images/rule-script.png and /dev/null differ