openhab-scripting 5.24.1 → 5.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54dc0e0852b8b85308e1f130d17148b15d4906a78b910e5b70ea40a70d0c62a9
4
- data.tar.gz: f2f5d323c52ad8cd7aa675ce71f87cfbad50526831388df86d183b27eba2f100
3
+ metadata.gz: 5c0fb1468d6bd40e3c969eb3da64c2291998d1c25f869ce8eadcdee5d8025f82
4
+ data.tar.gz: 1055efc1de0e69ecbd3f0c3ef7368f96c3edab4ae8395aeeb3da53b2bfcc2403
5
5
  SHA512:
6
- metadata.gz: 6bcec6e15d7fcfc6143b86996f276a8140932cb4dd6627d89e1d47a996d252cf8ab21620258c3a1f2b195ccc6d535c59bbbb1ebee46656f593fb13974f01b197
7
- data.tar.gz: 1e498846c24823319fa02a59b81c2400468b4463e95568051d45dcd111206238c5d97aa5901fdfb689816141a480bef1f7373d2ac554c170008323fd28ec88a9
6
+ metadata.gz: 779278a803232e079c5fc50f3094259b9d27500b82bc872bc7f38731f5dd836612a2582b558e50041d3098578fe1af3d2aa856c6e6400c3a854dba474e043a64
7
+ data.tar.gz: c3426e6d46f3edf2a6807b65c02ef12e4c2130ab943ec930b9815720458d45d0fc7a272a72829bd8b00be96c2e6549829cb5a07def11fbf647ccea942cfd89a7
@@ -111,6 +111,15 @@ module OpenHAB
111
111
  info.nil? || info.status_detail == RuleStatusDetail::DISABLED
112
112
  end
113
113
 
114
+ #
115
+ # Check if the rule's status detail != `DISABLED`
116
+ #
117
+ # @return [true, false]
118
+ #
119
+ def enabled?
120
+ !disabled?
121
+ end
122
+
114
123
  #
115
124
  # Checks if this rule has at least one of the given tags.
116
125
  #
@@ -2134,7 +2134,11 @@ module OpenHAB
2134
2134
  added_rule.actions.first.configuration.put("type", "application/x-ruby")
2135
2135
  added_rule.actions.first.configuration.put("script", script) if script
2136
2136
 
2137
- process_on_load { |module_id| rule.execute(nil, { "module" => module_id }) }
2137
+ if enabled
2138
+ process_on_load { |module_id| rule.execute(nil, { "module" => module_id }) }
2139
+ else
2140
+ added_rule.disable
2141
+ end
2138
2142
 
2139
2143
  added_rule
2140
2144
  end
@@ -2181,8 +2185,6 @@ module OpenHAB
2181
2185
  logger.warn "Rule '#{uid}' has no triggers, not creating rule"
2182
2186
  elsif !execution_blocks?
2183
2187
  logger.warn "Rule '#{uid}' has no execution blocks, not creating rule"
2184
- elsif !enabled
2185
- logger.trace { "Rule '#{uid}' marked as disabled, not creating rule." }
2186
2188
  else
2187
2189
  return true
2188
2190
  end
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.24.1"
7
+ VERSION = "5.24.2"
8
8
  end
9
9
  end
data/lib/openhab/log.rb CHANGED
@@ -13,11 +13,14 @@ module OpenHAB
13
13
  # Logging is available everywhere through the {#logger} object.
14
14
  #
15
15
  # The logging prefix is `org.openhab.automation.jrubyscripting`.
16
+ #
16
17
  # Logging within file-based rules will have the name of the file appended to
17
18
  # the logger name. Logging inside of a rule will have the id of the rule
18
- # appended to the logger name. Any classes will have the full class anem
19
+ # appended to the logger name. Any classes will have the full class name
19
20
  # appended to the logger name.
20
21
  #
22
+ # Logging within UI-based rules will have the rule UID appended to the logger.
23
+ #
21
24
  # @example The following entries are in a file named 'log_test.rb'
22
25
  # logger.trace('Test logging at trace') # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test] - Test logging at trace
23
26
  # logger.debug('Test logging at debug') # 2020-12-03 18:05:32.020 [DEBUG] [org.openhab.automation.jrubyscripting.log_test] - Test logging at debug
@@ -25,12 +28,22 @@ module OpenHAB
25
28
  # logger.info('Test logging at info') # 2020-12-03 18:05:41.817 [INFO ] [org.openhab.automation.jrubyscripting.log_test] - Test logging at info
26
29
  # logger.error('Test logging at error') # 2020-12-03 18:06:02.021 [ERROR] [org.openhab.automation.jrubyscripting.log_test] - Test logging at error
27
30
  #
31
+ # @example From a UI-based rule with UID 'rule_uid'
32
+ # logger.info('Test logging at info') # 2020-12-03 18:05:41.817 [INFO ] [org.openhab.automation.jrubyscripting.script.rule_uid] - Test logging at info
33
+ #
28
34
  # @example The following entries are in a file named 'log_test.rb'
35
+ # # Enable trace log level for all the rules in this file
36
+ # logger.level = :trace
37
+ #
29
38
  # rule 'foo' do
30
- # run { logger.trace('Test logging at trace') } # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.foo] - Test logging at trace
39
+ # run { logger.trace('Test logging at trace') } # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test.rule.log_test:1] - Test logging at trace
31
40
  # on_load
32
41
  # end
33
42
  #
43
+ # rule 'foo with id', id: "foo_id" do
44
+ # run { logger.trace('Test logging at trace') } # 2020-12-03 18:05:20.903 [TRACE] [org.openhab.automation.jrubyscripting.log_test.rule.foo_id] - Test logging at trace
45
+ # on_load
46
+ # end
34
47
  #
35
48
  # @example A log entry from inside a class
36
49
  # class MyClass
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.24.1
4
+ version: 5.24.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-07-26 00:00:00.000000000 Z
13
+ date: 2024-07-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler