openhab-scripting 5.18.0 → 5.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/dsl/rules/builder.rb +2 -2
- data/lib/openhab/dsl/rules/terse.rb +21 -16
- data/lib/openhab/dsl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfc9ae60d0f82fc677a157ac0efd58c12fc597f5ac8f3d79d7aa9c472e2c5d3a
|
4
|
+
data.tar.gz: b8bf1721d064b2f88554722518496aa6c53b89407a9fb212880972725e49901f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e50f4ce2c5832a39b3ab9c7b7a489b22697a23b20ce803a633f28ea9b44ed2661a820cdefd00bc54c71cb212a2c1a1d96c35c413937cd3ac514aec55a4c13da
|
7
|
+
data.tar.gz: a298851e7255074cb21d9fd4e495a8c8dc750425b0db3319ab17353c2e07106e0f669a40912bbe98cc6db9f252ff70ebe68b9c94fb7366c4b257200da13eefda
|
@@ -73,7 +73,7 @@ module OpenHAB
|
|
73
73
|
# run { logger.info "Happy new day!" }
|
74
74
|
# end
|
75
75
|
#
|
76
|
-
def rule(name = nil, id: nil, replace:
|
76
|
+
def rule(name = nil, id: nil, replace: nil, script: nil, binding: nil, &block)
|
77
77
|
raise ArgumentError, "Block is required" unless block
|
78
78
|
|
79
79
|
inferred_id = nil
|
@@ -89,7 +89,7 @@ module OpenHAB
|
|
89
89
|
|
90
90
|
if replace
|
91
91
|
logger.debug { "Removing existing rule '#{builder.uid}'." } if DSL.rules.remove(builder.uid)
|
92
|
-
|
92
|
+
elsif replace.nil?
|
93
93
|
id_not_inferred = inferred_id.nil? || inferred_id != builder.uid
|
94
94
|
if id_not_inferred && (existing_rule = $rules.get(builder.uid))
|
95
95
|
logger.warn "Rule '#{builder.uid}' is not created because " \
|
@@ -44,22 +44,27 @@ module OpenHAB
|
|
44
44
|
# @see BuilderDSL#$1
|
45
45
|
def def_terse_rule(trigger)
|
46
46
|
class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
47
|
-
def #{trigger}(*args, id: nil, name: nil, description: nil,
|
48
|
-
tag: nil, tags: nil, on_load: false, **kwargs, &block)
|
49
|
-
raise ArgumentError, "Block is required" unless block
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
def #{trigger}(*args, id: nil, name: nil, description: nil, # def changed(*args, id: nil, name: nil, description: nil,
|
48
|
+
tag: nil, tags: nil, on_load: false, **kwargs, &block) # tag: nil, tags: nil, on_load: false, **kwargs, &block)
|
49
|
+
raise ArgumentError, "Block is required" unless block # raise ArgumentError, "Block is required" unless block
|
50
|
+
#
|
51
|
+
replace = nil # replace = nil
|
52
|
+
unless id # unless id
|
53
|
+
replace = false # replace = false
|
54
|
+
id = NameInference.infer_rule_id_from_block(block) # id = NameInference.infer_rule_id_from_block(block)
|
55
|
+
end # end
|
56
|
+
script = block.source rescue nil # script = block.source rescue nil
|
57
|
+
caller_binding = block.binding # caller_binding = block.binding
|
58
|
+
rule name, id: id, replace: replace, script: script, # rule name, id: id, replace: replace, script: script
|
59
|
+
binding: caller_binding do # binding: caller_binding do
|
60
|
+
self.on_load if on_load # self.on_load if on_load
|
61
|
+
self.description(description) if description # self.description(description) if description
|
62
|
+
self.tags(*Array.wrap(tag), *Array.wrap(tags)) # self.tags(*Array.wrap(tag), *Array.wrap(tags))
|
63
|
+
#{trigger}(*args, **kwargs) # changed(*args, **kwargs)
|
64
|
+
run(&block) # run(&block)
|
65
|
+
end # end
|
66
|
+
end # end
|
67
|
+
module_function #{trigger.inspect} # module_function :changed
|
63
68
|
RUBY
|
64
69
|
end
|
65
70
|
end
|
data/lib/openhab/dsl/version.rb
CHANGED
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.18.
|
4
|
+
version: 5.18.1
|
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-
|
13
|
+
date: 2024-04-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -485,7 +485,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
485
485
|
- !ruby/object:Gem::Version
|
486
486
|
version: '0'
|
487
487
|
requirements: []
|
488
|
-
rubygems_version: 3.5.
|
488
|
+
rubygems_version: 3.5.7
|
489
489
|
signing_key:
|
490
490
|
specification_version: 4
|
491
491
|
summary: JRuby Helper Libraries for openHAB Scripting
|