jsonnet 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: a215d91a36c8af2f5ad4d145f571fbbc070cedb7
4
- data.tar.gz: 4e5b93b2fc44a5c33bb1fb27830a33ee810b4e8f
3
+ metadata.gz: 594f8f8d8e1b7fe224e63b82ac7f66c29e56baee
4
+ data.tar.gz: c46ca9961aaa22fd42f54623b7a375487f4b541f
5
5
  SHA512:
6
- metadata.gz: 84a38e5e7e776ac8d11505693adedd2fd05dfe0d01146e5e242241f2a82f9d2b849983d15bb1909cd24fcfe6404aee0eb87647074a34893204ae522fee0c14bc
7
- data.tar.gz: 1d44661d345335978fe2f67fec727c06aa3888b08b8418f570b7b27226b57e6c9501d4cc93fb51b312a861cbe2c6ba515793031c34cfec92468f67b319cfa8bb
6
+ metadata.gz: fd7fbcc1dcdcdff7cc6f7367d8b878ae712326d5bc9f69a010b7bb5a42d98fad132c6ee1145fc21708d73422261e0d0b56e198c4a47e9756594144a84229eba1
7
+ data.tar.gz: 0f34b0b7b14ac0a290fa9f4f6563d8359f53343bd82f0b958f3f2c423e77eb58c92d3f82bb06bf16b9a46d546bcb288dba9e775cf1d2a91ed7ef2d617c929aad
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ dist: trusty
3
+ script: bundle exec rake test
4
+
5
+ matrix:
6
+ include:
7
+ - os: linux
8
+ rvm: 2.3.4
9
+ - os: osx
10
+ rvm: 2.3.4
11
+ - os: linux
12
+ rvm: 2.4.0
13
+ - os: osx
14
+ rvm: 2.4.0
15
+ fast_finish: true
16
+
data/README.md CHANGED
@@ -1,17 +1,11 @@
1
+ [![Build Status](https://travis-ci.org/yugui/ruby-jsonnet.svg?branch=master)](https://travis-ci.org/yugui/ruby-jsonnet)
2
+
1
3
  # Jsonnet
2
4
 
3
- Jsonnet processor library. Wraps the official C++ implementation with a Ruby extention library.
5
+ [Jsonnet][] processor library. Wraps the official C++ implementation with a Ruby extension library.
4
6
 
5
7
  ## Installation
6
8
 
7
- Install libjsonnet:
8
-
9
- $ git clone https://github.com/google/jsonnet.git
10
- $ cd jsonnet
11
- $ make
12
- $ sudo cp libjsonnet.so /usr/local/lib/libjsonnet.so
13
- $ sudo cp libjsonnet.h /usr/local/include/libjsonnet.h
14
-
15
9
  Add this line to your application's Gemfile:
16
10
 
17
11
  ```ruby
@@ -20,20 +14,85 @@ gem 'jsonnet'
20
14
 
21
15
  And then execute:
22
16
 
23
- $ bundle
17
+ ```shell
18
+ $ bundle install
19
+ ```
24
20
 
25
21
  Or install it yourself as:
26
22
 
27
- $ gem install jsonnet
23
+ ```shell
24
+ $ gem install jsonnet
25
+ ```
26
+
27
+ By default this gem will compile and install Jsonnet (v0.9.4) as part of
28
+ installation. However you can use the system version of Jsonnet if you prefer.
29
+ This would be the recommended route if you want to use a different version
30
+ of Jsonnet or are having problems installing this.
31
+
32
+ To install libjsonnet:
33
+
34
+ ```shell
35
+ $ git clone https://github.com/google/jsonnet.git
36
+ $ cd jsonnet
37
+ $ make libjsonnet.so
38
+ $ sudo cp libjsonnet.so /usr/local/lib/libjsonnet.so
39
+ $ sudo cp include/libjsonnet.h /usr/local/include/libjsonnet.h
40
+ ```
41
+
42
+ Note: /usr/local/lib and /usr/local/include are used as they are library lookup
43
+ locations. You may need to adjust these for your system if you have errors
44
+ running this gem saying it can't open libjsonnet.so - on Ubuntu for instance
45
+ I found /lib worked when /usr/local/lib did not.
46
+
47
+ To install this gem without jsonnet:
48
+
49
+ Use `JSONNET_USE_SYSTEM_LIBRARIES` ENV var:
50
+
51
+ ```shell
52
+ $ JSONNET_USE_SYSTEM_LIBRARIES=1 bundle install
53
+ ```
54
+
55
+ or, the `--use-system-libraries` option:
56
+
57
+
58
+ ```shell
59
+ gem install jsonnet -- --use-system-libraries
60
+ ```
28
61
 
29
62
  ## Usage
30
63
 
31
- TODO: Write usage instructions here
64
+ Load the library with `require "jsonnet"`
65
+
66
+ You can evaluate a string of Jsonnet using `Jsonnet.parse`
67
+
68
+ ```
69
+ irb(main):002:0> Jsonnet.evaluate('{ foo: "bar" }')
70
+ => {"foo"=>"bar"}
71
+ ```
72
+ Or load a file using `Jsonnet.load`
73
+
74
+ ```
75
+ irb(main):002:0> Jsonnet.load('example.jsonnet')
76
+ => {"baz"=>1}
77
+ ```
78
+
79
+ To get closer to the C++ interface you can create an instance of `Jsonnet::VM`
80
+
81
+ ```
82
+ irb(main):002:0> vm = Jsonnet::VM.new
83
+ => #<Jsonnet::VM:0x007fd29aa1e568>
84
+ irb(main):003:0> vm.evaluate('{ foo: "bar" }')
85
+ => "{\n \"foo\": \"bar\"\n}\n"
86
+ irb(main):004:0> vm.evaluate_file('example.jsonnet')
87
+ => "{\n \"baz\": 1\n}\n"
88
+ ```
32
89
 
33
90
  ## Contributing
34
91
 
35
- 1. Fork it ( https://github.com/yugui/jsonnet/fork )
92
+ 1. Fork it ( https://github.com/yugui/ruby-jsonnet/fork )
36
93
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
94
  3. Commit your changes (`git commit -am 'Add some feature'`)
38
95
  4. Push to the branch (`git push origin my-new-feature`)
39
96
  5. Create a new Pull Request
97
+
98
+ [Jsonnet]: https://github.com/google/jsonnet
@@ -1,6 +1,61 @@
1
1
  require 'mkmf'
2
+ require 'fileutils'
3
+
4
+ def using_system_libraries?
5
+ arg_config('--use-system-libraries', !!ENV['JSONNET_USE_SYSTEM_LIBRARIES'])
6
+ end
2
7
 
3
8
  dir_config('jsonnet')
9
+
10
+ unless using_system_libraries?
11
+ message "Building jsonnet using packaged libraries.\n"
12
+ require 'rubygems'
13
+ gem 'mini_portile2', '~> 2.2.0'
14
+ require 'mini_portile2'
15
+ message "Using mini_portile version #{MiniPortile::VERSION}\n"
16
+
17
+ recipe = MiniPortile.new('jsonnet', 'v0.9.4')
18
+ recipe.files = ['https://github.com/google/jsonnet/archive/v0.9.4.tar.gz']
19
+ class << recipe
20
+
21
+ def compile
22
+ # We want to create a file a library we can link to. Jsonnet provides us
23
+ # with the command `make libjsonnet.so` which creates a shared object
24
+ # however that won't be bundled into the compiled output so instead
25
+ # we compile the c into .o files and then create an archive that can
26
+ # be linked to
27
+ execute('compile', make_cmd)
28
+ execute('archive', 'ar rcs libjsonnet.a core/desugarer.o core/formatter.o core/lexer.o core/libjsonnet.o core/parser.o core/pass.o core/static_analysis.o core/string_utils.o core/vm.o third_party/md5/md5.o')
29
+ end
30
+
31
+ def configured?
32
+ true
33
+ end
34
+
35
+ def install
36
+ lib_path = File.join(port_path, 'lib')
37
+ include_path = File.join(port_path, 'include')
38
+
39
+ FileUtils.mkdir_p([lib_path, include_path])
40
+
41
+ FileUtils.cp(File.join(work_path, 'libjsonnet.a'), lib_path)
42
+ FileUtils.cp(File.join(work_path, 'include', 'libjsonnet.h'), include_path)
43
+ end
44
+ end
45
+
46
+ recipe.cook
47
+ # I tried using recipe.activate here but that caused this file to build ok
48
+ # but the makefile to fail. These commands add the necessary paths to do both
49
+ $LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH
50
+ $CPPFLAGS << " -I#{recipe.path}/include"
51
+
52
+ # This resolves an issue where you can get improper linkage when compiling
53
+ # and get an error like "undefined symbol: _ZTVN10__cxxabiv121__vmi_class_type_infoE"
54
+ # experienced on ubuntu.
55
+ # See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=193950
56
+ $LIBS << " -lstdc++"
57
+ end
58
+
4
59
  abort 'libjsonnet.h not found' unless have_header('libjsonnet.h')
5
60
  abort 'libjsonnet not found' unless have_library('jsonnet')
6
61
  create_makefile('jsonnet/jsonnet_wrap')
@@ -136,12 +136,13 @@ jw_s_version(VALUE mod)
136
136
  }
137
137
 
138
138
  static VALUE
139
- vm_s_new(VALUE mod)
139
+ vm_s_new(int argc, const VALUE *argv, VALUE klass)
140
140
  {
141
141
  struct jsonnet_vm_wrap *vm;
142
142
  VALUE self = TypedData_Make_Struct(cVM, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
143
143
  vm->vm = jsonnet_make();
144
144
  vm->callback = Qnil;
145
+ rb_obj_call_init(self, argc, argv);
145
146
  return self;
146
147
  }
147
148
 
@@ -259,7 +260,7 @@ import_callback_thunk(void *ctx, const char *base, const char *rel, char **found
259
260
  /**
260
261
  * Sets a custom way to resolve "import" expression.
261
262
  * @param [#call] callback receives two parameters and returns two values.
262
- * The first parameter "base" is a base directory to resolve
263
+ * The first parameter "base" is a base directory to resolve
263
264
  * "rel" from.
264
265
  * The second parameter "rel" is an absolute or a relative
265
266
  * path to the file to import.
@@ -322,7 +323,7 @@ vm_set_gc_growth_trigger(VALUE self, VALUE val)
322
323
  }
323
324
 
324
325
  /*
325
- * Let #evalutae and #evaluate_file return a raw String instead of JSON-encoded string if val is true
326
+ * Let #evaluate and #evaluate_file return a raw String instead of JSON-encoded string if val is true
326
327
  * @param [Boolean] val
327
328
  */
328
329
  static VALUE
@@ -343,15 +344,6 @@ vm_set_max_trace(VALUE self, VALUE val)
343
344
  return Qnil;
344
345
  }
345
346
 
346
- static VALUE
347
- vm_set_debug_ast(VALUE self, VALUE val)
348
- {
349
- struct jsonnet_vm_wrap *vm;
350
- TypedData_Get_Struct(self, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
351
- jsonnet_debug_ast(vm->vm, RTEST(val));
352
- return Qnil;
353
- }
354
-
355
347
  void
356
348
  Init_jsonnet_wrap(void)
357
349
  {
@@ -362,7 +354,7 @@ Init_jsonnet_wrap(void)
362
354
  rb_define_singleton_method(mJsonnet, "libversion", jw_s_version, 0);
363
355
 
364
356
  cVM = rb_define_class_under(mJsonnet, "VM", rb_cData);
365
- rb_define_singleton_method(cVM, "new", vm_s_new, 0);
357
+ rb_define_singleton_method(cVM, "new", vm_s_new, -1);
366
358
  rb_define_private_method(cVM, "eval_file", vm_evaluate_file, 3);
367
359
  rb_define_private_method(cVM, "eval_snippet", vm_evaluate, 3);
368
360
  rb_define_method(cVM, "ext_var", vm_ext_var, 2);
@@ -371,7 +363,6 @@ Init_jsonnet_wrap(void)
371
363
  rb_define_method(cVM, "gc_growth_trigger=", vm_set_gc_growth_trigger, 1);
372
364
  rb_define_method(cVM, "string_output=", vm_set_string_output, 1);
373
365
  rb_define_method(cVM, "max_trace=", vm_set_max_trace, 1);
374
- rb_define_method(cVM, "debug_ast=", vm_set_debug_ast, 1);
375
366
  rb_define_method(cVM, "import_callback=", vm_set_import_callback, 1);
376
367
 
377
368
  eEvaluationError = rb_define_class_under(mJsonnet, "EvaluationError", rb_eRuntimeError);
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.add_runtime_dependency "mini_portile2", "~>2.2.0"
23
+
22
24
  spec.add_development_dependency "bundler", "~> 1.7"
23
25
  spec.add_development_dependency "rake", "~> 10.0"
24
26
  spec.add_development_dependency "test-unit", "~> 3.1.3"
@@ -1,7 +1,47 @@
1
1
  require "jsonnet/version"
2
- require "jsonnet/jsonnet_wrap"
3
2
  require "jsonnet/vm"
3
+ require "json"
4
4
 
5
5
  module Jsonnet
6
- # Your code goes here...
6
+ module_function
7
+
8
+ ##
9
+ # Evaluates a string of Jsonnet and returns a hash of the resulting JSON
10
+ #
11
+ # @param [String] jsonnet Jsonnet source string, ideally in UTF-8 encoding
12
+ # @param [Hash] jsonnet_options A hash of options to for Jsonnet::VM.
13
+ # Available options are: filename, multi,
14
+ # import_callback, gc_growth_triger,
15
+ # gc_min_objects, max_stack, max_trace
16
+ # @param [Hash] json_options Options supported by {JSON.parse}[http://www.rubydoc.info/github/flori/json/JSON#parse-class_method]
17
+ # @return [Hash] The JSON representation as a hash
18
+ # @raise [UnsupportedOptionError] Raised when an option passed is unsupported by Jsonnet::VM
19
+ #
20
+ # @note This method runs Jsonnet::VM#evaluate and runs the string
21
+ # output through {JSON.parse}[http://www.rubydoc.info/github/flori/json/JSON#parse-class_method]
22
+ # so those should be looked at for furhter details
23
+ def evaluate(jsonnet, jsonnet_options: {}, json_options: {})
24
+ output = VM.evaluate(jsonnet, jsonnet_options)
25
+ JSON.parse(output, json_options)
26
+ end
27
+
28
+ ##
29
+ # Loads a Jsonnet file and returns a hash of the resulting JSON
30
+ #
31
+ # @param [String] path path to the jsonnet file
32
+ # @param [Hash] jsonnet_options A hash of options to for Jsonnet::VM.
33
+ # Available options are: encoding, multi,
34
+ # import_callback, gc_growth_triger,
35
+ # gc_min_objects, max_stack, max_trace
36
+ # @param [Hash] json_options Options supported by {JSON.parse}[http://www.rubydoc.info/github/flori/json/JSON#parse-class_method]
37
+ # @return [Hash] The JSON representation as a hash
38
+ # @raise [UnsupportedOptionError] Raised when an option passed is unsupported by Jsonnet::VM
39
+ #
40
+ # @note This method runs Jsonnet::VM#evaluate_file and runs the string
41
+ # output through {JSON.parse}[http://www.rubydoc.info/github/flori/json/JSON#parse-class_method]
42
+ # so those should be looked at for furhter details
43
+ def load(path, jsonnet_options: {}, json_options: {})
44
+ output = VM.evaluate_file(path, jsonnet_options)
45
+ JSON.parse(output, json_options)
46
+ end
7
47
  end
@@ -1,3 +1,3 @@
1
1
  module Jsonnet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,5 +1,59 @@
1
+ require "jsonnet/jsonnet_wrap"
2
+
1
3
  module Jsonnet
2
4
  class VM
5
+ class << self
6
+ ##
7
+ # Convenient method to evaluate a Jsonnet snippet.
8
+ #
9
+ # It implicitly instantiates a VM and then evaluate Jsonnet with the VM.
10
+ #
11
+ # @param snippet [String] Jsonnet source string.
12
+ # @param options [Hash] options to {.new} or options to {#evaluate}
13
+ # @return [String]
14
+ # @see #evaluate
15
+ def evaluate(snippet, options = {})
16
+ snippet_check = ->(key, value) { key.to_s.match(/^filename|multi$/) }
17
+ snippet_options = options.select &snippet_check
18
+ vm_options = options.reject &snippet_check
19
+ new(vm_options).evaluate(snippet, snippet_options)
20
+ end
21
+
22
+ ##
23
+ # Convenient method to evaluate a Jsonnet file.
24
+ #
25
+ # It implicitly instantiates a VM and then evaluates Jsonnet with the VM.
26
+ #
27
+ # @param filename [String] Jsonnet source file.
28
+ # @param options [Hash] options to {.new} or options to {#evaluate_file}
29
+ # @return [String]
30
+ # @see #evaluate_file
31
+ def evaluate_file(filename, options = {})
32
+ file_check = ->(key, value) { key.to_s.match(/^encoding|multi$/) }
33
+ file_options = options.select &file_check
34
+ vm_options = options.reject &file_check
35
+ new(vm_options).evaluate_file(filename, file_options)
36
+ end
37
+ end
38
+
39
+ ##
40
+ # initializes a new VM with the given configuration.
41
+ #
42
+ # @param [Hash] options a mapping from option names to their values.
43
+ # It can have names of writable attributes in VM class as keys.
44
+ # @return [VM] the VM.
45
+ def initialize(options = {})
46
+ options.each do |key, value|
47
+ method = "#{key}="
48
+ if respond_to?(method)
49
+ public_send(method, value)
50
+ else
51
+ raise UnsupportedOptionError.new("Jsonnet VM does not support #{key} option")
52
+ end
53
+ end
54
+ self
55
+ end
56
+
3
57
  ##
4
58
  # Evaluates Jsonnet source.
5
59
  #
@@ -11,9 +65,9 @@ module Jsonnet
11
65
  # @raise [EvaluationError] raised when the evaluation results an error.
12
66
  # @raise [UnsupportedEncodingError] raised when the encoding of jsonnet
13
67
  # is not ASCII-compatible.
14
- # @note It is recommended to encode the source string in UTF-8 because
15
- # Jsonnet expects it is ASCII-compatible, the result JSON string
16
- # shall be UTF-{8,16,32} according to RFC 7159 thus the only
68
+ # @note It is recommended to encode the source string in UTF-8 because
69
+ # Jsonnet expects it is ASCII-compatible, the result JSON string
70
+ # shall be UTF-{8,16,32} according to RFC 7159 thus the only
17
71
  # intersection between the requirements is UTF-8.
18
72
  def evaluate(jsonnet, filename: "(jsonnet)", multi: false)
19
73
  eval_snippet(jsonnet, filename, multi)
@@ -26,9 +80,9 @@ module Jsonnet
26
80
  # @param [Boolean] multi enables multi-mode
27
81
  # @return [String] a JSON representation of the evaluation result
28
82
  # @raise [EvaluationError] raised when the evaluation results an error.
29
- # @note It is recommended to encode the source file in UTF-8 because
30
- # Jsonnet expects it is ASCII-compatible, the result JSON string
31
- # shall be UTF-{8,16,32} according to RFC 7159 thus the only
83
+ # @note It is recommended to encode the source file in UTF-8 because
84
+ # Jsonnet expects it is ASCII-compatible, the result JSON string
85
+ # shall be UTF-{8,16,32} according to RFC 7159 thus the only
32
86
  # intersection between the requirements is UTF-8.
33
87
  def evaluate_file(filename, encoding: Encoding.default_external, multi: false)
34
88
  eval_file(filename, encoding, multi)
@@ -44,5 +98,7 @@ module Jsonnet
44
98
  self.import_callback = Proc.new
45
99
  nil
46
100
  end
101
+
102
+ class UnsupportedOptionError < RuntimeError; end
47
103
  end
48
104
  end
@@ -1,8 +1,51 @@
1
1
  require 'jsonnet'
2
+
3
+ require 'tempfile'
2
4
  require 'test/unit'
3
5
 
4
6
  class TestJsonnet < Test::Unit::TestCase
5
7
  test 'libversion returns a String' do
6
- assert_kind_of String, Jsonnet.libversion
8
+ assert_kind_of String, Jsonnet.libversion
9
+ end
10
+
11
+ test 'Jsonnet.evaluate returns a JSON parsed result' do
12
+ result = Jsonnet.evaluate('{ foo: "bar" }')
13
+ assert_equal result, { "foo" => "bar" }
14
+ end
15
+
16
+ test 'Jsonnet.evaluate can accept options for JSON' do
17
+ result = Jsonnet.evaluate('{ foo: "bar" }', json_options: { symbolize_names: true })
18
+ assert_equal result, { foo: "bar" }
19
+ end
20
+
21
+ test 'Jsonnet.evaluate can accept options for Jsonnet VM' do
22
+ result = Jsonnet.evaluate(
23
+ 'import "imported.jsonnet"',
24
+ jsonnet_options: {
25
+ import_callback: ->(_base, _rel) do
26
+ return ['{ foo: "bar" }', 'imported']
27
+ end
28
+ }
29
+ )
30
+ assert_equal result, { "foo" => "bar" }
31
+ end
32
+
33
+ test 'Jsonnet.load returns a JSON parsed result' do
34
+ result = Jsonnet.load(example_jsonnet_file.path)
35
+ assert_equal result, { "foo1" => 1 }
36
+ end
37
+
38
+ private
39
+
40
+ def example_jsonnet_file
41
+ example = Tempfile.open("example.jsonnet") do |f|
42
+ f.write %<
43
+ local myvar = 1;
44
+ {
45
+ ["foo" + myvar]: myvar,
46
+ }
47
+ >
48
+ f
49
+ end
7
50
  end
8
51
  end
@@ -47,7 +47,7 @@ class TestVM < Test::Unit::TestCase
47
47
  vm = Jsonnet::VM.new
48
48
  begin
49
49
  with_example_file(%q{ ["unterminated string }) {|fname|
50
- vm.evaluate_file(fname.encode(Encoding::SJIS))
50
+ vm.evaluate_file(fname.encode(Encoding::SJIS))
51
51
  }
52
52
  rescue Jsonnet::EvaluationError => e
53
53
  assert_equal Encoding::SJIS, e.message.encoding
@@ -104,7 +104,7 @@ class TestVM < Test::Unit::TestCase
104
104
  test "Jsonnet::VM#evaluate raises an error in the encoding of filename" do
105
105
  vm = Jsonnet::VM.new
106
106
  begin
107
- vm.evaluate(%Q{ ["unterminated string }, filename: "テスト.json".encode(Encoding::SJIS))
107
+ vm.evaluate(%Q{ ["unterminated string }, filename: "テスト.json".encode(Encoding::SJIS))
108
108
  rescue Jsonnet::EvaluationError => e
109
109
  assert_equal Encoding::SJIS, e.message.encoding
110
110
  end
@@ -211,10 +211,6 @@ class TestVM < Test::Unit::TestCase
211
211
  Jsonnet::VM.new.max_trace = 1
212
212
  end
213
213
 
214
- test "Jsonnet::VM responds to debug_ast=" do
215
- Jsonnet::VM.new.debug_ast = true
216
- end
217
-
218
214
  test "Jsonnet::VM#string_output lets the VM output a raw string" do
219
215
  vm = Jsonnet::VM.new
220
216
  vm.string_output = true
@@ -229,7 +225,7 @@ class TestVM < Test::Unit::TestCase
229
225
  case [base, rel]
230
226
  when ['/path/to/base/', 'imported1.jsonnet']
231
227
  return <<-EOS, '/path/to/imported1/imported1.jsonnet'
232
- import "imported2.jsonnet" {
228
+ (import "imported2.jsonnet") + {
233
229
  b: 2,
234
230
  }
235
231
  EOS
@@ -242,7 +238,7 @@ class TestVM < Test::Unit::TestCase
242
238
  end
243
239
  }
244
240
  result = vm.evaluate(<<-EOS, filename: "/path/to/base/example.jsonnet")
245
- import "imported1.jsonnet" { c: 3 }
241
+ (import "imported1.jsonnet") + { c: 3 }
246
242
  EOS
247
243
 
248
244
  expected = {"a" => 1, "b" => 2, "c" => 3}
@@ -255,7 +251,7 @@ class TestVM < Test::Unit::TestCase
255
251
  vm.import_callback = ->(base, rel) { called = true; raise }
256
252
  assert_raise(Jsonnet::EvaluationError) {
257
253
  vm.evaluate(<<-EOS)
258
- import "a.jsonnet" {}
254
+ (import "a.jsonnet") + {}
259
255
  EOS
260
256
  }
261
257
  assert_true called
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mini_portile2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.2.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +89,7 @@ extensions:
75
89
  extra_rdoc_files: []
76
90
  files:
77
91
  - ".gitignore"
92
+ - ".travis.yml"
78
93
  - Gemfile
79
94
  - LICENSE.txt
80
95
  - README.md
@@ -108,11 +123,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
123
  version: '0'
109
124
  requirements: []
110
125
  rubyforge_project:
111
- rubygems_version: 2.4.5
126
+ rubygems_version: 2.6.10
112
127
  signing_key:
113
128
  specification_version: 4
114
129
  summary: Jsonnet library
115
130
  test_files:
116
131
  - test/test_jsonnet.rb
117
132
  - test/test_vm.rb
118
- has_rdoc: