openhab-scripting 4.32.2 → 4.32.5

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: 8d988eed567dd4fb75d8f43550f005cc1e09264310157c6ec7f267f82d68f6af
4
- data.tar.gz: f790a909228f3671204fe6e00c27064ee25ab69154f4b54a21efe233d36d6b2b
3
+ metadata.gz: bf1f1c2ae201fe502bf830cdfd68be82d9489931f4122e2ab196581ac0b2793a
4
+ data.tar.gz: 7b85b254e1ef2cf2d26a50c94719b2cbe12a7140eba86f9b9d70a428ccd7a960
5
5
  SHA512:
6
- metadata.gz: bf7f712761e6b051f674c0709abba39f13ca3cbc52db417cb7a5c40f013425f860b52bd8ff840f1bb60a81cbda845899c348a9da2045ad0b0480816e70478f4d
7
- data.tar.gz: 9c40d8bb624713aba27f93edc5c0dac12d003c14d3db47a37715954b7c788cf0d0f195e32797cd3a454eb984d57a05eb650660e585f476aff7ded57c4e6c5fff
6
+ metadata.gz: 4299bc30c7f47b534653808258263a9d1bca1cf5284a86e94bdece0f6084989a25db5ccba277c44b0fc1d59cb54e30eddccc0e63535cbe98669ced090860baad
7
+ data.tar.gz: 52acd07934bc24858bdfeebe257b423909db886549582b32a66e8efea6fa213be7259b9e7829def39e9a1c01ac8e9f4869ad209553cd7bcb0a99bbf1e5b734d5
@@ -9,12 +9,10 @@ module OpenHAB
9
9
  # Patches OpenHAB actions
10
10
  #
11
11
  module Actions
12
- java_import Java::OrgOpenhabCoreAutomationModuleScriptInternalDefaultscope::ScriptThingActions
13
-
14
12
  #
15
13
  # MonkeyPatching ScriptThingActions
16
14
  #
17
- class ScriptThingActions
15
+ class << $actions # rubocop:disable Style/GlobalVars
18
16
  field_reader :THING_ACTIONS_MAP
19
17
 
20
18
  #
@@ -23,7 +21,7 @@ module OpenHAB
23
21
  # @return [Set] of keys for defined actions in the form of 'scope-thing_uid'
24
22
  #
25
23
  def action_keys
26
- ScriptThingActions.THING_ACTIONS_MAP.keys
24
+ self.class.THING_ACTIONS_MAP.keys
27
25
  end
28
26
  end
29
27
  end
@@ -34,7 +34,6 @@ module OpenHAB
34
34
  # @yield [] Block executed in context of a RuleConfig
35
35
  #
36
36
  #
37
- # rubocop: disable Metrics/MethodLength
38
37
  def rule(rule_name, &block)
39
38
  thread_local(RULE_NAME: rule_name) do
40
39
  @rule_name = rule_name
@@ -43,12 +42,10 @@ module OpenHAB
43
42
  config.guard = Guard::Guard.new(run_context: config.caller, only_if: config.only_if, not_if: config.not_if)
44
43
  logger.trace { config.inspect }
45
44
  process_rule_config(config)
46
- nil # Must return something other than the rule object. See https://github.com/boc-tothefuture/openhab-jruby/issues/438
47
45
  end
48
46
  rescue StandardError => e
49
47
  logger.log_exception(e, @rule_name)
50
48
  end
51
- # rubocop: enable Metrics/MethodLength
52
49
 
53
50
  #
54
51
  # Cleanup rules in this script file
@@ -71,10 +68,10 @@ module OpenHAB
71
68
 
72
69
  rule = AutomationRule.new(config: config)
73
70
  Rules.script_rules << rule
74
- add_rule(rule)
71
+ added_rule = add_rule(rule)
75
72
 
76
73
  rule.execute(nil, { 'event' => Struct.new(:attachment).new(config.start_attachment) }) if config.on_start?
77
- rule
74
+ added_rule
78
75
  end
79
76
 
80
77
  #
@@ -20,8 +20,7 @@ module OpenHAB
20
20
  # Invert the type
21
21
  # @return [OnOffType] +OFF+ if +ON+, +ON+ if +OFF+
22
22
  def !
23
- return OFF if on?
24
- return ON if off?
23
+ on? ? OFF : ON
25
24
  end
26
25
  end
27
26
  end
@@ -270,8 +270,7 @@ module OpenHAB
270
270
  #
271
271
  def log_caller
272
272
  caller_locations.map(&:path)
273
- .grep_v(/rubygems/)
274
- .grep_v(/openhab-scripting/)
273
+ .grep_v(/rubygems|openhab-scripting|<script>/)
275
274
  .first
276
275
  .then { |caller| File.basename(caller, '.*') if caller }
277
276
  end
@@ -5,5 +5,5 @@
5
5
  #
6
6
  module OpenHAB
7
7
  # @return [String] Version of OpenHAB helper libraries
8
- VERSION = '4.32.2'
8
+ VERSION = '4.32.5'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-scripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.32.2
4
+ version: 4.32.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian O'Connell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2022-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler