openhab-jrubyscripting 5.0.0.rc8 → 5.0.0.rc9
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/version.rb +1 -1
- data/lib/openhab/rspec/helpers.rb +18 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b818f8062ce950e265819455075b42fd1cf2d1fc6270b57f547b3e93f19f0656
|
4
|
+
data.tar.gz: '08c396633d12172da0751719196247319731205b9ee6704ea4844bd3709321aa'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac9760ebe37190c941c973a4526ec8b8a7a2b1584585f324f80c531849f879f7cb471bcbac1beae02f3412fb6822fbb7e50e343e6e015e5ddbb9f5b552712a70
|
7
|
+
data.tar.gz: bc0ec52bafce17c3f090984370d98695fa49bfc1799293d1d6f421764f7a8ecfbe814c6d2b7bd6b03f023c0daefa517f3595bebcd7c0af53d0ce53ee153d4360
|
data/lib/openhab/dsl/version.rb
CHANGED
@@ -184,7 +184,7 @@ module OpenHAB
|
|
184
184
|
def autorequires
|
185
185
|
ENV["RUBYLIB"] ||= ""
|
186
186
|
ENV["RUBYLIB"] += ":" unless ENV["RUBYLIB"].empty?
|
187
|
-
ENV["RUBYLIB"] +=
|
187
|
+
ENV["RUBYLIB"] += rubylib_dirs.join(":")
|
188
188
|
|
189
189
|
$LOAD_PATH.unshift(*ENV["RUBYLIB"]
|
190
190
|
.split(File::PATH_SEPARATOR)
|
@@ -265,10 +265,15 @@ module OpenHAB
|
|
265
265
|
# @return [void]
|
266
266
|
#
|
267
267
|
def load_rules
|
268
|
-
automation_path = "#{org.openhab.core.OpenHAB.config_folder}/automation/
|
268
|
+
automation_path = "#{org.openhab.core.OpenHAB.config_folder}/automation/ruby"
|
269
|
+
lib_dirs = rubylib_dirs.map { |d| File.join(d, "") }
|
270
|
+
lib_dirs << File.join(gem_home, "")
|
269
271
|
|
270
272
|
SuspendRules.suspend_rules do
|
271
273
|
files = Dir["#{automation_path}/**/*.rb"]
|
274
|
+
files.reject! do |f|
|
275
|
+
lib_dirs.any? { |l| f.start_with?(l) }
|
276
|
+
end
|
272
277
|
files.sort_by { |f| [get_start_level(f), f] }.each do |f|
|
273
278
|
load f
|
274
279
|
rescue Exception => e
|
@@ -376,8 +381,17 @@ module OpenHAB
|
|
376
381
|
ca.get_configuration("org.openhab.automation.jrubyscripting", nil)&.properties
|
377
382
|
end
|
378
383
|
|
379
|
-
def
|
380
|
-
jrubyscripting_config&.get("
|
384
|
+
def gem_home
|
385
|
+
gem_home = jrubyscripting_config&.get("gem_home")
|
386
|
+
return "#{org.openhab.core.OpenHAB.config_folder}/automation/ruby/.gem" unless gem_home
|
387
|
+
|
388
|
+
# strip everything after the first {
|
389
|
+
gem_home.split("{", 2).first
|
390
|
+
end
|
391
|
+
|
392
|
+
def rubylib_dirs
|
393
|
+
jrubyscripting_config&.get("rubylib")&.split(File::PATH_SEPARATOR) ||
|
394
|
+
["#{org.openhab.core.OpenHAB.config_folder}/automation/ruby/lib"]
|
381
395
|
end
|
382
396
|
|
383
397
|
def get_start_level(file)
|