yamlscript 0.1.47 → 0.1.48

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: 10dd08cf871c441a40213613b4b14e8726a49d1a33b6e91124b5b8d62d891d48
4
- data.tar.gz: 78632e3afcbc8e41fb207e4f1e42d6478bffd53c86ce5a18054473b12c20a264
3
+ metadata.gz: 25bc6a4a8da3c4fdbcb664adbfa5b5b7f7f0d33b6cf9a783e6c94e038e3dd66d
4
+ data.tar.gz: b3b382de5eabe5d1aa7e89feab34120d82b177f93ba79f1b76adcfc8c341f265
5
5
  SHA512:
6
- metadata.gz: 49cc91260a0abb5cac771529db3f006a8422e53b8d3641d0c3216c49d798a38234b241a3556946d24e2be9b0f2e18f8f207c149fe2dc05a014389e5de1b65a01
7
- data.tar.gz: d935703e8f152e54e2f23b7ac25c4a18acfbebdf26063a01ac4a072eb6fb7e7d3d2ce749d68849003dc29bcbe4ebfa815fa4c6df4ba415ac679ee250d662c62f
6
+ metadata.gz: 21995ea38b53c046c4c36611e13a4b83c3b81dbfce770b431dcbee8dfd5bec842ca227b8f0ed37be4cadb30447399b9831c43746545614d8ac1ab5a8256dc28d
7
+ data.tar.gz: 36dafd7fe695c476602e5d352de4ade5ef5ecdcf6d3a8e08248adcb511c47bcd318aeccef5e4fc11f5318e600ade11cc836bed7c4f86c32cc79b824ba4cb01f6
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.1.48] - 2024-03-29
2
+
3
+ - libyamlscript 0.1.48
4
+
1
5
  ## [0.1.47] - 2024-03-25
2
6
 
3
7
  - libyamlscript 0.1.47
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class YAMLScript
4
- VERSION = "0.1.47"
4
+ VERSION = "0.1.48"
5
5
  end
data/lib/yamlscript.rb CHANGED
@@ -13,10 +13,10 @@ require_relative 'yamlscript/version'
13
13
  class YAMLScript
14
14
  Error = Class.new(StandardError)
15
15
 
16
- # TODO: This value is automatically updated by 'make bump'.
16
+ # This value is automatically updated by 'make bump'.
17
17
  # The version number is used to find the correct shared library file.
18
18
  # We currently only support binding to an exact version of libyamlscript.
19
- YAMLSCRIPT_VERSION = '0.1.47'
19
+ YAMLSCRIPT_VERSION = '0.1.48'
20
20
 
21
21
  # A low-level interface to the native library
22
22
  module LibYAMLScript
@@ -33,7 +33,7 @@ class YAMLScript
33
33
  end
34
34
  end
35
35
 
36
- def self.filename
36
+ def self.libyamlscript_name
37
37
  "libyamlscript.#{extension}.#{YAMLSCRIPT_VERSION}"
38
38
  end
39
39
 
@@ -49,18 +49,24 @@ class YAMLScript
49
49
  end
50
50
 
51
51
  # Find the libyamlscript shared library file path
52
- def self.path
53
- name = filename
52
+ def self.find_libyamlscript_path
53
+ name = libyamlscript_name
54
54
  path = ld_library_paths.map {
55
55
  |dir| File.join(dir, name) }.detect { |file| File.exist?(file)
56
56
  }
57
57
 
58
- raise Error, "Shared library file `#{name}` not found" unless path
58
+ vers = YAMLSCRIPT_VERSION
59
+ raise Error, <<-ERROR unless path
60
+
61
+ Shared library file `#{name}` not found
62
+ Try: curl -sSL yamlscript.org/install | VERSION=#{vers} LIB=1 bash
63
+ See: https://github.com/yaml/yamlscript/wiki/Installing-YAMLScript
64
+ ERROR
59
65
 
60
66
  path
61
67
  end
62
68
 
63
- dlload path
69
+ dlload find_libyamlscript_path
64
70
 
65
71
  extern \
66
72
  'int graal_create_isolate(void* params, void** isolate, void** thread)'
@@ -93,16 +99,19 @@ class YAMLScript
93
99
  def load(ys_code)
94
100
  # Create a new GraalVM isolate thread for each call to load()
95
101
  thread = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
96
- LibYAMLScript.graal_create_isolate(nil, @isolate.ref, thread.ref)
102
+ raise Error, "Failed to create isolate" unless \
103
+ LibYAMLScript.graal_create_isolate(nil, @isolate.ref, thread.ref).zero?
97
104
 
98
105
  # Call 'load_ys_to_json' function in libyamlscript shared library
99
106
  json_data = LibYAMLScript.load_ys_to_json(thread, ys_code)
100
107
  resp = JSON.parse(json_data.to_s)
101
- raise Error, 'Failed to tear down isolate' \
102
- unless LibYAMLScript.graal_tear_down_isolate(thread).zero?
103
- raise Error, @error['cause'] if (@error = resp['error'])
108
+
109
+ raise Error, "Failed to tear down isolate" unless \
110
+ LibYAMLScript.graal_tear_down_isolate(thread).zero?
111
+ raise Error, @error['cause'] if @error = resp['error']
112
+
104
113
  data = resp.fetch('data') do
105
- raise Error, 'Unexpected response from libyamlscript'
114
+ raise Error, "Unexpected response from 'libyamlscript'"
106
115
  end
107
116
 
108
117
  data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamlscript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.47
4
+ version: 0.1.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ingy döt Net
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-03-25 00:00:00.000000000 Z
12
+ date: 2024-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.3.5
66
+ rubygems_version: 3.1.2
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Program in YAML