openhab-jrubyscripting 5.0.0.rc5 → 5.0.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/core/actions.rb +6 -6
- data/lib/openhab/core/dependency_tracking.rb +34 -0
- data/lib/openhab/core/entity_lookup.rb +132 -78
- data/lib/openhab/core/events/item_channel_link.rb +2 -2
- data/lib/openhab/core/events/item_command_event.rb +1 -1
- data/lib/openhab/core/events/item_event.rb +2 -2
- data/lib/openhab/core/events/item_state_changed_event.rb +1 -1
- data/lib/openhab/core/events/thing.rb +1 -1
- data/lib/openhab/core/items/accepted_data_types.rb +2 -2
- data/lib/openhab/core/items/contact_item.rb +1 -1
- data/lib/openhab/core/items/dimmer_item.rb +2 -2
- data/lib/openhab/core/items/generic_item.rb +45 -224
- data/lib/openhab/core/items/group_item.rb +5 -3
- data/lib/openhab/core/items/image_item.rb +2 -2
- data/lib/openhab/core/items/item.rb +219 -0
- data/lib/openhab/core/items/metadata/hash.rb +1 -1
- data/lib/openhab/core/items/persistence.rb +4 -5
- data/lib/openhab/core/items/provider.rb +2 -2
- data/lib/openhab/core/items/proxy.rb +68 -7
- data/lib/openhab/core/items/registry.rb +6 -6
- data/lib/openhab/core/items/semantics/enumerable.rb +6 -6
- data/lib/openhab/core/items/semantics.rb +8 -7
- data/lib/openhab/core/items.rb +2 -1
- data/lib/openhab/core/provider.rb +14 -7
- data/lib/openhab/core/rules/registry.rb +2 -2
- data/lib/openhab/core/rules.rb +1 -1
- data/lib/openhab/core/script_handling.rb +6 -6
- data/lib/openhab/core/things/channel.rb +1 -1
- data/lib/openhab/core/things/channel_uid.rb +2 -2
- data/lib/openhab/core/things/item_channel_link.rb +2 -2
- data/lib/openhab/core/things/links/provider.rb +2 -2
- data/lib/openhab/core/things/registry.rb +1 -1
- data/lib/openhab/core/things/thing.rb +1 -1
- data/lib/openhab/core/types/date_time_type.rb +4 -4
- data/lib/openhab/core/types/hsb_type.rb +2 -2
- data/lib/openhab/core/types/quantity_type.rb +1 -1
- data/lib/openhab/core/types.rb +1 -1
- data/lib/openhab/core/uid.rb +1 -1
- data/lib/openhab/core/value_cache.rb +188 -0
- data/lib/openhab/core.rb +57 -15
- data/lib/openhab/core_ext/ruby/symbol.rb +7 -0
- data/lib/openhab/dsl/items/builder.rb +17 -10
- data/lib/openhab/dsl/items/ensure.rb +5 -5
- data/lib/openhab/dsl/items/timed_command.rb +4 -4
- data/lib/openhab/dsl/rules/automation_rule.rb +53 -39
- data/lib/openhab/dsl/rules/builder.rb +128 -79
- data/lib/openhab/dsl/rules/guard.rb +5 -5
- data/lib/openhab/dsl/rules/name_inference.rb +20 -1
- data/lib/openhab/dsl/rules/rule_triggers.rb +3 -3
- data/lib/openhab/dsl/rules/terse.rb +1 -0
- data/lib/openhab/dsl/rules/triggers/changed.rb +26 -23
- data/lib/openhab/dsl/rules/triggers/command.rb +6 -5
- data/lib/openhab/dsl/rules/triggers/conditions/duration.rb +2 -2
- data/lib/openhab/dsl/rules/triggers/cron/cron.rb +2 -2
- data/lib/openhab/dsl/rules/triggers/cron/cron_handler.rb +6 -6
- data/lib/openhab/dsl/rules/triggers/updated.rb +5 -5
- data/lib/openhab/dsl/rules/triggers/watch/watch_handler.rb +11 -12
- data/lib/openhab/dsl/things/builder.rb +73 -14
- data/lib/openhab/dsl/version.rb +2 -2
- data/lib/openhab/dsl.rb +43 -17
- data/lib/openhab/log.rb +5 -5
- data/lib/openhab/rspec/configuration.rb +5 -5
- data/lib/openhab/rspec/example_group.rb +1 -1
- data/lib/openhab/rspec/helpers.rb +4 -4
- data/lib/openhab/rspec/hooks.rb +19 -1
- data/lib/openhab/rspec/karaf.rb +12 -19
- data/lib/openhab/rspec/suspend_rules.rb +2 -1
- data/lib/openhab/yard/base_helper.rb +46 -0
- data/lib/openhab/yard/markdown_directive.rb +125 -0
- data/lib/openhab/yard/markdown_helper.rb +99 -0
- metadata +10 -3
@@ -52,7 +52,7 @@ module OpenHAB
|
|
52
52
|
module RSpec
|
53
53
|
#
|
54
54
|
# Provides helper methods for use in specs, to easily work with and adjust
|
55
|
-
# the
|
55
|
+
# the openHAB environment.
|
56
56
|
#
|
57
57
|
# These methods are automatically available in RSpec spec blocks, as well
|
58
58
|
# as other per-spec hooks like `before` and `after`. You can also call them
|
@@ -175,7 +175,7 @@ module OpenHAB
|
|
175
175
|
end
|
176
176
|
|
177
177
|
#
|
178
|
-
# Require all files configured to be autorequired with the jrubyscripting addon in
|
178
|
+
# Require all files configured to be autorequired with the jrubyscripting addon in openHAB.
|
179
179
|
#
|
180
180
|
# This method is normally called by RSpec hooks.
|
181
181
|
#
|
@@ -306,7 +306,7 @@ module OpenHAB
|
|
306
306
|
end
|
307
307
|
|
308
308
|
#
|
309
|
-
# Install an
|
309
|
+
# Install an openHAB addon
|
310
310
|
#
|
311
311
|
# @param [String] addon_id The addon id, such as "binding-mqtt"
|
312
312
|
# @param [true,false] wait Wait until OSGi has confirmed the bundle is installed and running before returning.
|
@@ -348,7 +348,7 @@ module OpenHAB
|
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
351
|
-
# @return [String] The filename of the
|
351
|
+
# @return [String] The filename of the openHAB log.
|
352
352
|
def log_file
|
353
353
|
"#{java.lang.System.get_property("openhab.logdir", nil)}/openhab.log"
|
354
354
|
end
|
data/lib/openhab/rspec/hooks.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module OpenHAB
|
4
4
|
#
|
5
5
|
# This module contains helper methods, hooks, and infrastracture to
|
6
|
-
# boot
|
6
|
+
# boot openHAB inside of JRuby, and run RSpec (or other Ruby processes)
|
7
7
|
# in that context.
|
8
8
|
#
|
9
9
|
# @see file:testing.md Testing Your Rules
|
@@ -11,6 +11,14 @@ module OpenHAB
|
|
11
11
|
module RSpec
|
12
12
|
Object.include Helpers if defined?(IRB)
|
13
13
|
|
14
|
+
# @!visibility private
|
15
|
+
module Hooks
|
16
|
+
class << self
|
17
|
+
attr_accessor :cache_script_extension
|
18
|
+
end
|
19
|
+
self.cache_script_extension = nil
|
20
|
+
end
|
21
|
+
|
14
22
|
Helpers.launch_karaf(
|
15
23
|
include_bindings: Configuration.include_bindings,
|
16
24
|
include_jsondb: Configuration.include_jsondb,
|
@@ -28,6 +36,15 @@ module OpenHAB
|
|
28
36
|
Helpers.send(:set_up_autoupdates)
|
29
37
|
Helpers.load_transforms
|
30
38
|
Helpers.load_rules
|
39
|
+
|
40
|
+
if DSL.shared_cache
|
41
|
+
Hooks.cache_script_extension = OSGi.service(
|
42
|
+
"org.openhab.core.automation.module.script.ScriptExtensionProvider",
|
43
|
+
filter:
|
44
|
+
"(component.name=org.openhab.core.automation.module.script.rulesupport.internal.CacheScriptExtension)"
|
45
|
+
)
|
46
|
+
Hooks.cache_script_extension.class.field_reader :sharedCache
|
47
|
+
end
|
31
48
|
end
|
32
49
|
|
33
50
|
config.before do
|
@@ -79,6 +96,7 @@ module OpenHAB
|
|
79
96
|
Timecop.return
|
80
97
|
restore_autoupdate_items
|
81
98
|
Mocks::PersistenceService.instance.reset
|
99
|
+
Hooks.cache_script_extension.sharedCache.clear if DSL.shared_cache
|
82
100
|
end
|
83
101
|
end
|
84
102
|
end
|
data/lib/openhab/rspec/karaf.rb
CHANGED
@@ -20,6 +20,14 @@ module OpenHAB
|
|
20
20
|
def get(type)
|
21
21
|
@manager.get(type, "jruby")
|
22
22
|
end
|
23
|
+
|
24
|
+
def default_presets
|
25
|
+
@manager.default_presets
|
26
|
+
end
|
27
|
+
|
28
|
+
def import_preset(preset)
|
29
|
+
@manager.find_preset(preset, "rspec")
|
30
|
+
end
|
23
31
|
end
|
24
32
|
private_constant :ScriptExtensionManagerWrapper
|
25
33
|
|
@@ -73,7 +81,7 @@ module OpenHAB
|
|
73
81
|
service = org.apache.karaf.instance.core.internal.InstanceServiceImpl.new
|
74
82
|
settings = org.apache.karaf.instance.core.InstanceSettings.new(0, 0, 0, path, nil, nil, nil)
|
75
83
|
root_instance = service.instances.find(&:root?)
|
76
|
-
raise ArgumentError "No root instance found to clone... has
|
84
|
+
raise ArgumentError "No root instance found to clone... has openHAB run yet?" unless root_instance
|
77
85
|
|
78
86
|
return if service.get_instance("rspec")
|
79
87
|
|
@@ -121,7 +129,7 @@ module OpenHAB
|
|
121
129
|
launch_karaf
|
122
130
|
at_exit do
|
123
131
|
@main.destroy
|
124
|
-
# OSGi/
|
132
|
+
# OSGi/openHAB leave a ton of threads around. Kill ourselves ASAP
|
125
133
|
code = if $!.nil? || ($!.is_a?(SystemExit) && $!.success?)
|
126
134
|
0
|
127
135
|
elsif $!.is_a?(SystemExit)
|
@@ -566,21 +574,6 @@ module OpenHAB
|
|
566
574
|
wait_for_service("org.openhab.core.automation.module.script.internal.ScriptExtensionManager") do |sem|
|
567
575
|
# since we're not created by the ScriptEngineManager, this never gets set; manually set it
|
568
576
|
$se = $scriptExtension = ScriptExtensionManagerWrapper.new(sem)
|
569
|
-
scope_values = sem.find_default_presets("rspec")
|
570
|
-
scope_values = scope_values.entry_set.to_a
|
571
|
-
|
572
|
-
scope_values.each do |entry|
|
573
|
-
key = entry.key
|
574
|
-
value = entry.value
|
575
|
-
# convert Java classes to Ruby classes
|
576
|
-
value = value.ruby_class if value.is_a?(java.lang.Class) # rubocop:disable Lint/UselessAssignment
|
577
|
-
# variables are globals; constants go into the global namespace
|
578
|
-
key = case key[0]
|
579
|
-
when "a".."z" then "$#{key}"
|
580
|
-
when "A".."Z" then "::#{key}"
|
581
|
-
end
|
582
|
-
eval("#{key} = value unless defined?(#{key})", nil, __FILE__, __LINE__) # rubocop:disable Security/Eval
|
583
|
-
end
|
584
577
|
end
|
585
578
|
end
|
586
579
|
|
@@ -731,7 +724,7 @@ module OpenHAB
|
|
731
724
|
sls = OSGi.service("org.openhab.core.service.StartLevelService")
|
732
725
|
|
733
726
|
unless sls
|
734
|
-
# try a different (hacky!) way to get it, since in
|
727
|
+
# try a different (hacky!) way to get it, since in openHAB 3.2.0 it's not exposed as a service
|
735
728
|
scr = OSGi.service("org.osgi.service.component.runtime.ServiceComponentRuntime")
|
736
729
|
scr.class.field_reader :componentRegistry
|
737
730
|
cr = scr.componentRegistry
|
@@ -771,7 +764,7 @@ module OpenHAB
|
|
771
764
|
File.write("#{oh_userdata}/etc/org.apache.karaf.features.xml", <<~XML)
|
772
765
|
<?xml version="1.0" encoding="UTF-8"?>
|
773
766
|
<featuresProcessing xmlns="http://karaf.apache.org/xmlns/features-processing/v1.0.0" xmlns:f="http://karaf.apache.org/xmlns/features/v1.6.0">
|
774
|
-
<!-- From
|
767
|
+
<!-- From openHAB 3.2.0 -->
|
775
768
|
<bundleReplacements>
|
776
769
|
<bundle originalUri="mvn:org.ops4j.pax.logging/pax-logging-api/[0,2.0.13)" replacement="mvn:org.ops4j.pax.logging/pax-logging-api/2.0.13" mode="maven" />
|
777
770
|
<bundle originalUri="mvn:org.ops4j.pax.logging/pax-logging-log4j2/[0,2.0.13)" replacement="mvn:org.ops4j.pax.logging/pax-logging-log4j2/2.0.13" mode="maven" />
|
@@ -18,7 +18,8 @@ module OpenHAB
|
|
18
18
|
logger.trace { "Execute called with mod (#{mod&.to_string}) and inputs (#{inputs.inspect})" }
|
19
19
|
logger.trace { "Event details #{inputs["event"].inspect}" } if inputs&.key?("event")
|
20
20
|
trigger_conditions(inputs).process(mod: mod, inputs: inputs) do
|
21
|
-
|
21
|
+
event = extract_event(inputs)
|
22
|
+
process_queue(create_queue(event), mod, event)
|
22
23
|
end
|
23
24
|
rescue Exception => e
|
24
25
|
raise if defined?(::RSpec) && ::RSpec.current_example.example_group.propagate_exceptions?
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
module OpenHAB
|
6
|
+
module YARD
|
7
|
+
# @!visibility private
|
8
|
+
module BaseHelper
|
9
|
+
def preprocess(text)
|
10
|
+
html = Nokogiri::HTML5.fragment(text)
|
11
|
+
|
12
|
+
context = if ENV["ADDON"]
|
13
|
+
:addon
|
14
|
+
else
|
15
|
+
:yard
|
16
|
+
end
|
17
|
+
|
18
|
+
# process directives on which content is supposed to be included in this context
|
19
|
+
node = html.children.first
|
20
|
+
loop do
|
21
|
+
break unless node
|
22
|
+
|
23
|
+
next_node = node.next
|
24
|
+
|
25
|
+
if node.comment? && (directive = MarkdownDirective.new(node)).directive?
|
26
|
+
next_node = directive.process(context) || next_node
|
27
|
+
end
|
28
|
+
node = next_node
|
29
|
+
end
|
30
|
+
|
31
|
+
html.to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
def link_object(obj, title = nil, *)
|
35
|
+
::YARD::Handlers::JRuby::Base.infer_java_class(obj) if obj.is_a?(String)
|
36
|
+
obj = ::YARD::Registry.resolve(object, obj, true, true) if obj.is_a?(String)
|
37
|
+
if obj.is_a?(::YARD::CodeObjects::Java::Base) && (see = obj.docstring.tag(:see))
|
38
|
+
# link to the first see tag
|
39
|
+
return linkify(see.name, title&.to_s || see.text)
|
40
|
+
end
|
41
|
+
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
module OpenHAB
|
6
|
+
module YARD
|
7
|
+
# @!visibility private
|
8
|
+
class MarkdownDirective
|
9
|
+
attr_reader :comment, :context
|
10
|
+
|
11
|
+
def initialize(comment)
|
12
|
+
@comment = comment
|
13
|
+
@lines = comment.text.split("\n")
|
14
|
+
directive_text = @lines.first.strip
|
15
|
+
|
16
|
+
@multiline = @lines.length > 1
|
17
|
+
@directive = false
|
18
|
+
return unless (match = directive_text.match(%r{^<(/)?(!)?([a-z]+)-only>$}))
|
19
|
+
|
20
|
+
@closing = match[1]
|
21
|
+
@context = match[3].to_sym
|
22
|
+
@inverted = match[2]
|
23
|
+
|
24
|
+
if closing? && multiline?
|
25
|
+
log.warn "In file `#{file}':#{line}: Multiline closing directives are not allowed (#{directive_text})."
|
26
|
+
return
|
27
|
+
end
|
28
|
+
@directive = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def directive?
|
32
|
+
@directive
|
33
|
+
end
|
34
|
+
|
35
|
+
def multiline?
|
36
|
+
@multiline
|
37
|
+
end
|
38
|
+
|
39
|
+
def closing?
|
40
|
+
@closing
|
41
|
+
end
|
42
|
+
|
43
|
+
def inverted?
|
44
|
+
@inverted
|
45
|
+
end
|
46
|
+
|
47
|
+
def match?(context)
|
48
|
+
result = context == self.context
|
49
|
+
result = !result if inverted?
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
def closing_directive
|
54
|
+
return nil if multiline?
|
55
|
+
|
56
|
+
unless instance_variable_defined?(:@closing_directive)
|
57
|
+
next_node = @comment.next
|
58
|
+
loop do
|
59
|
+
return @closing_directive = nil unless next_node
|
60
|
+
|
61
|
+
if next_node.comment?
|
62
|
+
directive = MarkdownDirective.new(next_node)
|
63
|
+
if directive.directive? &&
|
64
|
+
directive.closing? &&
|
65
|
+
directive.context == context &&
|
66
|
+
directive.inverted? == inverted?
|
67
|
+
return @closing_directive = next_node
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
next_node = next_node.next
|
72
|
+
end
|
73
|
+
end
|
74
|
+
@closing_directive
|
75
|
+
end
|
76
|
+
|
77
|
+
def process(context)
|
78
|
+
return unless directive?
|
79
|
+
return if closing?
|
80
|
+
|
81
|
+
matched = match?(context)
|
82
|
+
|
83
|
+
# if it's a matched multiline, extract the contents and insert them directly,
|
84
|
+
# and remove the comment
|
85
|
+
if multiline?
|
86
|
+
result = comment.next
|
87
|
+
comment.before(Nokogiri::HTML5.fragment(@lines[1..].join("\n"))) if matched
|
88
|
+
comment.remove
|
89
|
+
return result
|
90
|
+
end
|
91
|
+
|
92
|
+
unless closing_directive
|
93
|
+
log.warn "In file `#{file}':#{line}: Unmatched directive <#{"!" if inverted?}#{context}-only>."
|
94
|
+
return
|
95
|
+
end
|
96
|
+
|
97
|
+
result = closing_directive.next
|
98
|
+
|
99
|
+
unless matched
|
100
|
+
# remove all nodes between the opening and closing directives
|
101
|
+
comment.next.remove while comment.next != closing_directive
|
102
|
+
end
|
103
|
+
# now remove the directives themselves
|
104
|
+
closing_directive.remove
|
105
|
+
comment.remove
|
106
|
+
result
|
107
|
+
end
|
108
|
+
|
109
|
+
def file
|
110
|
+
((defined?(@file) && @file) ? @file.filename : object.file) || "(unknown)"
|
111
|
+
end
|
112
|
+
|
113
|
+
def line
|
114
|
+
return @line if instance_variable_defined?(@line)
|
115
|
+
|
116
|
+
@line = (if defined?(@file) && @file
|
117
|
+
1
|
118
|
+
else
|
119
|
+
(object.docstring.line_range ? object.docstring.line_range.first : 1)
|
120
|
+
end) + (match ? $`.count("\n") : 0)
|
121
|
+
@line += comment.line - 1
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
|
5
|
+
module OpenHAB
|
6
|
+
module YARD
|
7
|
+
# @!visibility private
|
8
|
+
module MarkdownHelper
|
9
|
+
# @group Linking Objects and URLs
|
10
|
+
|
11
|
+
def diskfile
|
12
|
+
preprocess(super)
|
13
|
+
end
|
14
|
+
|
15
|
+
# mostly copied from HTMLHelper
|
16
|
+
def resolve_links(text)
|
17
|
+
blockquotes = false
|
18
|
+
text.gsub(%r{(```)|(\\|!)?\{(?!\})(\S+?)(?:\s([^\}]*?\S))?\}(?=[\W<]|.+</|$)}m) do |str|
|
19
|
+
blockquote = $1
|
20
|
+
escape = $2
|
21
|
+
name = $3
|
22
|
+
title = $4
|
23
|
+
match = $&
|
24
|
+
if blockquote
|
25
|
+
blockquotes = !blockquotes
|
26
|
+
next str
|
27
|
+
end
|
28
|
+
next str if blockquotes
|
29
|
+
|
30
|
+
next(match[1..-1]) if escape
|
31
|
+
|
32
|
+
next(match) if name[0, 1] == '|'
|
33
|
+
|
34
|
+
if object.is_a?(String)
|
35
|
+
object
|
36
|
+
else
|
37
|
+
link = linkify(name, title)
|
38
|
+
if (link == name || link == title) && (name + ' ' + link !~ /\A<a\s.*>/)
|
39
|
+
match = /(.+)?(\{#{Regexp.quote name}(?:\s.*?)?\})(.+)?/.match(text)
|
40
|
+
file = (defined?(@file) && @file ? @file.filename : object.file) || '(unknown)'
|
41
|
+
line = (defined?(@file) && @file ? 1 : (object.docstring.line_range ? object.docstring.line_range.first : 1)) + (match ? $`.count("\n") : 0)
|
42
|
+
log.warn "In file `#{file}':#{line}: Cannot resolve link to #{name} from text" + (match ? ":" : ".") +
|
43
|
+
"\n\t" + (match[1] ? '...' : '') + match[2].delete("\n") + (match[3] ? '...' : '') if match
|
44
|
+
end
|
45
|
+
|
46
|
+
link
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# mostly copied from HTMLHelper
|
52
|
+
def link_object(obj, title = nil, anchor = nil, relative = true)
|
53
|
+
return title if obj.nil?
|
54
|
+
|
55
|
+
obj = Registry.resolve(object, obj, true, true) if obj.is_a?(String)
|
56
|
+
|
57
|
+
was_const = false
|
58
|
+
# Re-link references to constants that are aliases to their target. But keep
|
59
|
+
# their current title.
|
60
|
+
while obj.is_a?(CodeObjects::ConstantObject) && obj.target
|
61
|
+
title ||= h(object.relative_path(obj)).to_s
|
62
|
+
was_const = true
|
63
|
+
obj = obj.target
|
64
|
+
end
|
65
|
+
return link_object(obj, title, anchor, relative) if was_const
|
66
|
+
|
67
|
+
title = if title
|
68
|
+
title.to_s
|
69
|
+
elsif object.is_a?(CodeObjects::Base)
|
70
|
+
# Check if we're linking to a class method in the current
|
71
|
+
# object. If we are, create a title in the format of
|
72
|
+
# "CurrentClass.method_name"
|
73
|
+
if obj.is_a?(CodeObjects::MethodObject) && obj.scope == :class && obj.parent == object
|
74
|
+
h([object.name, obj.sep, obj.name].join)
|
75
|
+
elsif obj.title != obj.path
|
76
|
+
h(obj.title)
|
77
|
+
else
|
78
|
+
h(object.relative_path(obj))
|
79
|
+
end
|
80
|
+
else
|
81
|
+
h(obj.title)
|
82
|
+
end
|
83
|
+
return title unless serializer
|
84
|
+
return title if obj.is_a?(CodeObjects::Proxy)
|
85
|
+
|
86
|
+
link = url_for(obj, anchor, relative)
|
87
|
+
link ? link_url(link, title, title: h("#{obj.title} (#{obj.type})")) : title
|
88
|
+
rescue Parser::UndocumentableError
|
89
|
+
log.warn "The namespace of link #{obj.inspect} is a constant or invalid."
|
90
|
+
title || obj.to_s
|
91
|
+
end
|
92
|
+
|
93
|
+
def link_url(url, title = nil, _params = nil)
|
94
|
+
title ||= url
|
95
|
+
"[#{title}](#{url})"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-jrubyscripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -327,6 +327,7 @@ extra_rdoc_files: []
|
|
327
327
|
files:
|
328
328
|
- lib/openhab/core.rb
|
329
329
|
- lib/openhab/core/actions.rb
|
330
|
+
- lib/openhab/core/dependency_tracking.rb
|
330
331
|
- lib/openhab/core/entity_lookup.rb
|
331
332
|
- lib/openhab/core/events.rb
|
332
333
|
- lib/openhab/core/events/abstract_event.rb
|
@@ -346,6 +347,7 @@ files:
|
|
346
347
|
- lib/openhab/core/items/generic_item.rb
|
347
348
|
- lib/openhab/core/items/group_item.rb
|
348
349
|
- lib/openhab/core/items/image_item.rb
|
350
|
+
- lib/openhab/core/items/item.rb
|
349
351
|
- lib/openhab/core/items/location_item.rb
|
350
352
|
- lib/openhab/core/items/metadata.rb
|
351
353
|
- lib/openhab/core/items/metadata/hash.rb
|
@@ -408,6 +410,7 @@ files:
|
|
408
410
|
- lib/openhab/core/types/un_def_type.rb
|
409
411
|
- lib/openhab/core/types/up_down_type.rb
|
410
412
|
- lib/openhab/core/uid.rb
|
413
|
+
- lib/openhab/core/value_cache.rb
|
411
414
|
- lib/openhab/core_ext.rb
|
412
415
|
- lib/openhab/core_ext/between.rb
|
413
416
|
- lib/openhab/core_ext/java/class.rb
|
@@ -429,6 +432,7 @@ files:
|
|
429
432
|
- lib/openhab/core_ext/ruby/date_time.rb
|
430
433
|
- lib/openhab/core_ext/ruby/numeric.rb
|
431
434
|
- lib/openhab/core_ext/ruby/range.rb
|
435
|
+
- lib/openhab/core_ext/ruby/symbol.rb
|
432
436
|
- lib/openhab/core_ext/ruby/time.rb
|
433
437
|
- lib/openhab/dsl.rb
|
434
438
|
- lib/openhab/dsl/events.rb
|
@@ -484,6 +488,7 @@ files:
|
|
484
488
|
- lib/openhab/rspec/shell.rb
|
485
489
|
- lib/openhab/rspec/suspend_rules.rb
|
486
490
|
- lib/openhab/yard.rb
|
491
|
+
- lib/openhab/yard/base_helper.rb
|
487
492
|
- lib/openhab/yard/cli/stats.rb
|
488
493
|
- lib/openhab/yard/code_objects/group_object.rb
|
489
494
|
- lib/openhab/yard/code_objects/java/base.rb
|
@@ -498,6 +503,8 @@ files:
|
|
498
503
|
- lib/openhab/yard/handlers/jruby/java_import_handler.rb
|
499
504
|
- lib/openhab/yard/handlers/jruby/mixin_handler.rb
|
500
505
|
- lib/openhab/yard/html_helper.rb
|
506
|
+
- lib/openhab/yard/markdown_directive.rb
|
507
|
+
- lib/openhab/yard/markdown_helper.rb
|
501
508
|
- lib/openhab/yard/tags/constant_directive.rb
|
502
509
|
- lib/openhab/yard/tags/group_directive.rb
|
503
510
|
- lib/openhab/yard/tags/library.rb
|
@@ -528,5 +535,5 @@ requirements: []
|
|
528
535
|
rubygems_version: 3.3.7
|
529
536
|
signing_key:
|
530
537
|
specification_version: 4
|
531
|
-
summary: JRuby Helper Libraries for
|
538
|
+
summary: JRuby Helper Libraries for openHAB Scripting
|
532
539
|
test_files: []
|