jsonnet 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/ext/jsonnet/jsonnet.c +13 -3
- data/lib/jsonnet/version.rb +1 -1
- data/lib/jsonnet/vm.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a215d91a36c8af2f5ad4d145f571fbbc070cedb7
|
4
|
+
data.tar.gz: 4e5b93b2fc44a5c33bb1fb27830a33ee810b4e8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a38e5e7e776ac8d11505693adedd2fd05dfe0d01146e5e242241f2a82f9d2b849983d15bb1909cd24fcfe6404aee0eb87647074a34893204ae522fee0c14bc
|
7
|
+
data.tar.gz: 1d44661d345335978fe2f67fec727c06aa3888b08b8418f570b7b27226b57e6c9501d4cc93fb51b312a861cbe2c6ba515793031c34cfec92468f67b319cfa8bb
|
data/README.md
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
|
3
3
|
Jsonnet processor library. Wraps the official C++ implementation with a Ruby extention library.
|
4
4
|
|
5
|
-
## Status
|
6
|
-
Pre-alpha. Under development.
|
7
|
-
|
8
5
|
## Installation
|
9
6
|
|
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
|
+
|
10
15
|
Add this line to your application's Gemfile:
|
11
16
|
|
12
17
|
```ruby
|
data/ext/jsonnet/jsonnet.c
CHANGED
@@ -24,11 +24,12 @@ struct jsonnet_vm_wrap {
|
|
24
24
|
};
|
25
25
|
|
26
26
|
static void vm_free(void *ptr);
|
27
|
+
static void vm_mark(void *ptr);
|
27
28
|
|
28
29
|
static const rb_data_type_t jsonnet_vm_type = {
|
29
30
|
"JsonnetVm",
|
30
31
|
{
|
31
|
-
/* dmark = */
|
32
|
+
/* dmark = */ vm_mark,
|
32
33
|
/* dfree = */ vm_free,
|
33
34
|
/* dsize = */ 0,
|
34
35
|
},
|
@@ -135,7 +136,8 @@ jw_s_version(VALUE mod)
|
|
135
136
|
}
|
136
137
|
|
137
138
|
static VALUE
|
138
|
-
vm_s_new(VALUE mod)
|
139
|
+
vm_s_new(VALUE mod)
|
140
|
+
{
|
139
141
|
struct jsonnet_vm_wrap *vm;
|
140
142
|
VALUE self = TypedData_Make_Struct(cVM, struct jsonnet_vm_wrap, &jsonnet_vm_type, vm);
|
141
143
|
vm->vm = jsonnet_make();
|
@@ -144,12 +146,20 @@ vm_s_new(VALUE mod) {
|
|
144
146
|
}
|
145
147
|
|
146
148
|
static void
|
147
|
-
vm_free(void *ptr)
|
149
|
+
vm_free(void *ptr)
|
150
|
+
{
|
148
151
|
struct jsonnet_vm_wrap *vm = (struct jsonnet_vm_wrap*)ptr;
|
149
152
|
jsonnet_destroy(vm->vm);
|
150
153
|
REALLOC_N(vm, struct jsonnet_vm_wrap, 0);
|
151
154
|
}
|
152
155
|
|
156
|
+
static void
|
157
|
+
vm_mark(void *ptr)
|
158
|
+
{
|
159
|
+
struct jsonnet_vm_wrap *vm = (struct jsonnet_vm_wrap*)ptr;
|
160
|
+
rb_gc_mark(vm->callback);
|
161
|
+
}
|
162
|
+
|
153
163
|
static VALUE
|
154
164
|
vm_evaluate_file(VALUE self, VALUE fname, VALUE encoding, VALUE multi_p)
|
155
165
|
{
|
data/lib/jsonnet/version.rb
CHANGED
data/lib/jsonnet/vm.rb
CHANGED
@@ -33,5 +33,16 @@ module Jsonnet
|
|
33
33
|
def evaluate_file(filename, encoding: Encoding.default_external, multi: false)
|
34
34
|
eval_file(filename, encoding, multi)
|
35
35
|
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Lets the given block handle "import" expression of Jsonnet.
|
39
|
+
# @yieldparam [String] base base path to resolve "rel" from.
|
40
|
+
# @yieldparam [String] rel a relative or absolute path to the file to be imported
|
41
|
+
# @yieldreturn [Array<String>] a pair of the content of the imported file and
|
42
|
+
# its path.
|
43
|
+
def handle_import
|
44
|
+
self.import_callback = Proc.new
|
45
|
+
nil
|
46
|
+
end
|
36
47
|
end
|
37
48
|
end
|
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.0
|
4
|
+
version: 0.1.0
|
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-
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|