jsonnet 0.5.2 → 0.5.3

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: b21144880989556e02da3a182e6d527b7038aa090917a9f52563c77533348736
4
- data.tar.gz: 5326728e4f910249f23cd7f26ccebab4630da2f13dc3f1a9d1bb15e000aaffc2
3
+ metadata.gz: 21fb3547860dbf786a960705f8ec154f2068b07679091020da431fd1b407a4fd
4
+ data.tar.gz: 7860579f2f6931a3635ccae64de7c2de558644e6833e302b6511efb00f494a17
5
5
  SHA512:
6
- metadata.gz: 8423047526b7bcda8f25501bfa8b937cf585786982d477053445230877b4dc7ea0cff3d398abcc6cdacddbc8387611a187f9760ae7290034dbb4b157768cd833
7
- data.tar.gz: 36f6a67d475dbddbc356fe42a9d164af6dabdf7d9be49dfb19b127413f24e0458aa7c8ae3306100a9f1f031b933a0346874137fb1589555bc35cc6625d291728
6
+ metadata.gz: b1abbd8abe2a2670b366bd249ed92106d06c55e43db8c3ffd4c263c7151b985361a653f8d032782e0a5a3900af0e26d3f2a6a761246669463fbc0d22999df498
7
+ data.tar.gz: 59e92b2680be878b8dfeb29c876aa877eaa22562ee5e60a4deb98f24b8e7cf27702f1e3b78404f31f21be1e6d0475e606e90398805f1b92d20bcdbcdd1ef7b7d
@@ -14,7 +14,7 @@ jobs:
14
14
  name: Test
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: ['2.7', '3.0', '3.1']
17
+ ruby-version: ['2.7', '3.0', '3.1', '3.2']
18
18
  os: ['ubuntu-latest', 'macos-latest']
19
19
  runs-on: ${{ matrix.os }}
20
20
 
data/README.md CHANGED
@@ -63,7 +63,7 @@ gem install jsonnet -- --use-system-libraries
63
63
 
64
64
  Load the library with `require "jsonnet"`
65
65
 
66
- You can evaluate a string of Jsonnet using `Jsonnet.parse`
66
+ You can evaluate a string of Jsonnet using `Jsonnet.evaluate`
67
67
 
68
68
  ```
69
69
  irb(main):002:0> Jsonnet.evaluate('{ foo: "bar" }')
@@ -11,6 +11,14 @@
11
11
  */
12
12
  #define RUBYJSONNET_GLOBAL_ESCAPE_MAGIC "\x07\x03\x0c:rubytag:\x07\x03\x0c:"
13
13
 
14
+ /* Copied from vm_core.h in Ruby. State variables in global escapes have
15
+ * this value when an exception is raised.
16
+ *
17
+ * TODO(yugui) Find a better way to distinguish "raise" from "throw".
18
+ * It is not a very good idea to depend on the implementation details of Ruby.
19
+ */
20
+ #define RUBY_TAG_RAISE 0x6
21
+
14
22
  /*
15
23
  * callback support in VM
16
24
  */
@@ -44,9 +52,9 @@ invoke_callback(VALUE args)
44
52
  static VALUE
45
53
  rescue_callback(int state, const char *fmt, ...)
46
54
  {
47
- VALUE err = rb_errinfo();
48
- if (rb_obj_is_kind_of(err, rb_eException)) {
49
- VALUE msg = rb_protect(rubyjsonnet_format_exception, rb_errinfo(), NULL);
55
+ if (state == RUBY_TAG_RAISE) {
56
+ VALUE err = rb_errinfo();
57
+ VALUE msg = rb_protect(rubyjsonnet_format_exception, err, NULL);
50
58
  if (msg == Qnil) {
51
59
  va_list ap;
52
60
  va_start(ap, fmt);
data/ext/jsonnet/vm.c CHANGED
@@ -59,16 +59,15 @@ rubyjsonnet_obj_to_vm(VALUE wrap)
59
59
  }
60
60
 
61
61
  static VALUE
62
- vm_s_new(int argc, const VALUE *argv, VALUE klass)
62
+ vm_s_allocate(VALUE klass)
63
63
  {
64
64
  struct jsonnet_vm_wrap *vm;
65
- VALUE self = TypedData_Make_Struct(cVM, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
65
+ VALUE self = TypedData_Make_Struct(klass, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
66
66
  vm->vm = jsonnet_make();
67
67
  vm->import_callback = Qnil;
68
68
  vm->native_callbacks.len = 0;
69
69
  vm->native_callbacks.contexts = NULL;
70
70
 
71
- rb_obj_call_init(self, argc, argv);
72
71
  return self;
73
72
  }
74
73
 
@@ -81,11 +80,10 @@ vm_free(void *ptr)
81
80
 
82
81
  for (i = 0; i < vm->native_callbacks.len; ++i) {
83
82
  struct native_callback_ctx *ctx = vm->native_callbacks.contexts[i];
84
- RB_REALLOC_N(ctx, struct native_callback_ctx, 0);
83
+ xfree(ctx);
85
84
  }
86
- RB_REALLOC_N(vm->native_callbacks.contexts, struct native_callback_ctx *, 0);
87
-
88
- RB_REALLOC_N(vm, struct jsonnet_vm_wrap, 0);
85
+ xfree(vm->native_callbacks.contexts);
86
+ xfree(vm);
89
87
  }
90
88
 
91
89
  static void
@@ -390,7 +388,7 @@ void
390
388
  rubyjsonnet_init_vm(VALUE mJsonnet)
391
389
  {
392
390
  cVM = rb_define_class_under(mJsonnet, "VM", rb_cObject);
393
- rb_define_singleton_method(cVM, "new", vm_s_new, -1);
391
+ rb_define_alloc_func(cVM, vm_s_allocate);
394
392
  rb_define_private_method(cVM, "eval_file", vm_evaluate_file, 3);
395
393
  rb_define_private_method(cVM, "eval_snippet", vm_evaluate, 3);
396
394
  rb_define_private_method(cVM, "fmt_file", vm_fmt_file, 2);
@@ -1,3 +1,3 @@
1
1
  module Jsonnet
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
data/test/test_vm.rb CHANGED
@@ -54,7 +54,6 @@ class TestVM < Test::Unit::TestCase
54
54
  end
55
55
  end
56
56
 
57
-
58
57
  test 'Jsonnet::VM#evaluate evaluates snippet' do
59
58
  vm = Jsonnet::VM.new
60
59
  result = vm.evaluate(<<-EOS, filename: 'example.snippet')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Yugui Sonoda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-24 00:00:00.000000000 Z
11
+ date: 2023-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_portile2