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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a08d2ec63be7c6f1049ddc92de20e0184a9c4e959c6a20e97ce9c9214520d94
4
- data.tar.gz: 90178ba5a194cc91e24381c91bb691ddbafae498a033284a687698a8406c3b68
3
+ metadata.gz: b818f8062ce950e265819455075b42fd1cf2d1fc6270b57f547b3e93f19f0656
4
+ data.tar.gz: '08c396633d12172da0751719196247319731205b9ee6704ea4844bd3709321aa'
5
5
  SHA512:
6
- metadata.gz: 659647412602ecb689524f4f760f1b4f6f054617190ffb8adee922daeb5a715b75f6e245a062f250e18b9262dc27667f7081ed2ca168454552ae1ca12fd24e0b
7
- data.tar.gz: ac977120af8e531f0471d9f17601e7b59de9c9f44a40379d069b50227c4ec6d9674ab6f5a7791afb79f90174b6e532de3846f45d6f270459a94b2e12ecb47917
6
+ metadata.gz: ac9760ebe37190c941c973a4526ec8b8a7a2b1584585f324f80c531849f879f7cb471bcbac1beae02f3412fb6822fbb7e50e343e6e015e5ddbb9f5b552712a70
7
+ data.tar.gz: bc0ec52bafce17c3f090984370d98695fa49bfc1799293d1d6f421764f7a8ecfbe814c6d2b7bd6b03f023c0daefa517f3595bebcd7c0af53d0ce53ee153d4360
@@ -4,6 +4,6 @@ module OpenHAB
4
4
  module DSL
5
5
  # Version of openHAB helper libraries
6
6
  # @return [String]
7
- VERSION = "5.0.0.rc8"
7
+ VERSION = "5.0.0.rc9"
8
8
  end
9
9
  end
@@ -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"] += rubylib_dir
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/jsr223"
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 rubylib_dir
380
- jrubyscripting_config&.get("rubylib") || "#{org.openhab.core.OpenHAB.config_folder}/automation/lib/ruby"
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openhab-jrubyscripting
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc8
4
+ version: 5.0.0.rc9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer