ffi-yajl 2.4.0 → 2.7.5
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 +4 -4
- data/README.md +8 -1
- data/ext/ffi_yajl/ext/dlopen/yajl.sym +18 -0
- data/ext/ffi_yajl/ext/encoder/encoder.c +1 -0
- data/ext/ffi_yajl/ext/encoder/extconf.rb +21 -0
- data/ext/ffi_yajl/ext/parser/extconf.rb +21 -0
- data/lib/ffi_yajl/benchmark.rb +5 -5
- data/lib/ffi_yajl/encoder.rb +2 -1
- data/lib/ffi_yajl/map_library_name.rb +11 -11
- data/lib/ffi_yajl/parser.rb +1 -0
- data/lib/ffi_yajl/version.rb +1 -1
- metadata +39 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36eb8453fae1ee5e3be035ff951f44e9cdedf82aa1741d17ad53337e724802d2
|
|
4
|
+
data.tar.gz: 38f7bb44043d5a3d7c0220de3cb2690e193062e459befa1f93f7704aaedd310a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ee931bf2998f8f11ed0ec592a077d27541c7ca39b319eed2fbb01f2b07dbadf70980f3df8b20844784d171988a818733f952d9f2b47aa4c366e0e466de840a8
|
|
7
|
+
data.tar.gz: 1fcce6171cc934967fcad4b92283902770154734be56d5bf1475b078da78ab6fa21d716e867dd72b5040f0396809149fda76e275d457e37d7d029629bd7680bf
|
data/README.md
CHANGED
|
@@ -15,7 +15,14 @@ ffi-yajl is a Ruby adapter for the [yajl](http://lloyd.github.io/yajl/) JSON par
|
|
|
15
15
|
|
|
16
16
|
## How to Install
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
**Warning** if building through Omnibus, a preinstalled ffi-yajl and libyajl2-gem version not matching the bundled version of the project you're attempting to build (e.g., Chef) may cause:
|
|
19
|
+
|
|
20
|
+
`cannot find -lyajldll: No such file or directory`
|
|
21
|
+
|
|
22
|
+
If your build script ends up up in this state, a short term fix is `gem uninstall -I libyajl2` before the failing `bundle install`
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Install from the command-line:
|
|
19
26
|
|
|
20
27
|
```
|
|
21
28
|
gem install ffi-yajl
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
_yajl_gen_alloc
|
|
2
|
+
_yajl_gen_array_close
|
|
3
|
+
_yajl_gen_array_open
|
|
4
|
+
_yajl_gen_bool
|
|
5
|
+
_yajl_gen_config
|
|
6
|
+
_yajl_gen_free
|
|
7
|
+
_yajl_gen_get_buf
|
|
8
|
+
_yajl_gen_map_close
|
|
9
|
+
_yajl_gen_map_open
|
|
10
|
+
_yajl_gen_null
|
|
11
|
+
_yajl_gen_number
|
|
12
|
+
_yajl_gen_string
|
|
13
|
+
_yajl_alloc
|
|
14
|
+
_yajl_complete_parse
|
|
15
|
+
_yajl_config
|
|
16
|
+
_yajl_free
|
|
17
|
+
_yajl_get_error
|
|
18
|
+
_yajl_parse
|
|
@@ -360,6 +360,7 @@ void Init_encoder() {
|
|
|
360
360
|
mExt = rb_define_module_under(mFFI_Yajl, "Ext");
|
|
361
361
|
mEncoder = rb_define_module_under(mExt, "Encoder");
|
|
362
362
|
cYajl_Gen = rb_define_class_under(mEncoder, "YajlGen", rb_cObject);
|
|
363
|
+
rb_undef_alloc_func(cYajl_Gen);
|
|
363
364
|
rb_define_method(mEncoder, "do_yajl_encode", mEncoder_do_yajl_encode, 3);
|
|
364
365
|
|
|
365
366
|
/* use rb_const_get instead of rb_define_class so that we don't get superclass mismatches */
|
|
@@ -27,6 +27,27 @@ def windows?
|
|
|
27
27
|
!!(RUBY_PLATFORM =~ /mswin|mingw|cygwin|windows/)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def macos?
|
|
31
|
+
!!(RUBY_PLATFORM =~ /darwin/)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def clang?
|
|
35
|
+
cc_version = `#{RbConfig.expand("$(CC) --version")}`
|
|
36
|
+
cc_version.match?(/clang/i)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# XCode 14 warns if `-Wl,-undefined dynamic_lookup` is specified, and as
|
|
40
|
+
# a result Ruby interpreters compiled under XCode 14 no longer specify
|
|
41
|
+
# this flag by default in DLDFLAGS. Let's specify the list of dynamic symbols
|
|
42
|
+
# here to avoid compilation failures.
|
|
43
|
+
if clang? && macos?
|
|
44
|
+
symfile = File.join(__dir__, "../dlopen/yajl.sym")
|
|
45
|
+
dynamic_symbols = File.readlines(symfile)
|
|
46
|
+
dynamic_symbols.each do |sym|
|
|
47
|
+
$DLDFLAGS << " -Wl,-U,#{sym.strip}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
30
51
|
if windows?
|
|
31
52
|
# include our libyajldll.a definitions on windows in the libyajl2 gem
|
|
32
53
|
$libs = "#{$libs} -lyajldll"
|
|
@@ -27,6 +27,27 @@ def windows?
|
|
|
27
27
|
!!(RUBY_PLATFORM =~ /mswin|mingw|cygwin|windows/)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def macos?
|
|
31
|
+
!!(RUBY_PLATFORM =~ /darwin/)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def clang?
|
|
35
|
+
cc_version = `#{RbConfig.expand("$(CC) --version")}`
|
|
36
|
+
cc_version.match?(/clang/i)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# XCode 14 warns if `-Wl,-undefined dynamic_lookup` is specified, and as
|
|
40
|
+
# a result Ruby interpreters compiled under XCode 14 no longer specify
|
|
41
|
+
# this flag by default in DLDFLAGS. Let's specify the list of dynamic symbols
|
|
42
|
+
# here to avoid compilation failures.
|
|
43
|
+
if clang? && macos?
|
|
44
|
+
symfile = File.join(__dir__, "../dlopen/yajl.sym")
|
|
45
|
+
dynamic_symbols = File.readlines(symfile)
|
|
46
|
+
dynamic_symbols.each do |sym|
|
|
47
|
+
$DLDFLAGS << " -Wl,-U,#{sym.strip}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
30
51
|
if windows?
|
|
31
52
|
# include our libyajldll.a definitions on windows in the libyajl2 gem
|
|
32
53
|
$libs = "#{$libs} -lyajldll"
|
data/lib/ffi_yajl/benchmark.rb
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
|
|
23
|
-
require "ffi_yajl/benchmark/encode
|
|
24
|
-
require "ffi_yajl/benchmark/encode_profile
|
|
25
|
-
require "ffi_yajl/benchmark/parse
|
|
26
|
-
require "ffi_yajl/benchmark/parse_profile
|
|
27
|
-
require "ffi_yajl/benchmark/parse_profile_ruby_prof
|
|
23
|
+
require "ffi_yajl/benchmark/encode"
|
|
24
|
+
require "ffi_yajl/benchmark/encode_profile"
|
|
25
|
+
require "ffi_yajl/benchmark/parse"
|
|
26
|
+
require "ffi_yajl/benchmark/parse_profile"
|
|
27
|
+
require "ffi_yajl/benchmark/parse_profile_ruby_prof"
|
data/lib/ffi_yajl/encoder.rb
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
module FFI_Yajl
|
|
24
24
|
class EncodeError < StandardError; end
|
|
25
|
+
|
|
25
26
|
class Encoder
|
|
26
27
|
attr_accessor :opts
|
|
27
28
|
|
|
@@ -35,7 +36,7 @@ module FFI_Yajl
|
|
|
35
36
|
|
|
36
37
|
if opts[:pretty]
|
|
37
38
|
yajl_gen_opts[:yajl_gen_beautify] = true
|
|
38
|
-
yajl_gen_opts[:yajl_gen_indent_string] = opts[:indent]
|
|
39
|
+
yajl_gen_opts[:yajl_gen_indent_string] = opts[:indent] || " "
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
# call either the ext or ffi hook
|
|
@@ -79,12 +79,12 @@ module FFI_Yajl
|
|
|
79
79
|
def dlopen_yajl_library
|
|
80
80
|
found = false
|
|
81
81
|
( expanded_library_names + library_names ).each do |libname|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
|
|
83
|
+
dlopen(libname)
|
|
84
|
+
found = true
|
|
85
|
+
break
|
|
86
|
+
rescue ArgumentError
|
|
87
|
+
|
|
88
88
|
end
|
|
89
89
|
raise "cannot find yajl library for platform" unless found
|
|
90
90
|
end
|
|
@@ -97,11 +97,11 @@ module FFI_Yajl
|
|
|
97
97
|
def ffi_open_yajl_library
|
|
98
98
|
found = false
|
|
99
99
|
expanded_library_names.each do |libname|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
|
|
101
|
+
ffi_lib libname
|
|
102
|
+
found = true
|
|
103
|
+
rescue LoadError
|
|
104
|
+
|
|
105
105
|
end
|
|
106
106
|
ffi_lib "yajl" unless found
|
|
107
107
|
end
|
data/lib/ffi_yajl/parser.rb
CHANGED
data/lib/ffi_yajl/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ffi-yajl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.7.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lamont Granquist
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: libyajl2
|
|
@@ -16,22 +16,47 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1
|
|
19
|
+
version: '2.1'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1
|
|
26
|
+
version: '2.1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: yajl
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: cookstyle
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '8.1'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '8.1'
|
|
27
55
|
description: Ruby FFI wrapper around YAJL 2.x
|
|
28
56
|
email: lamont@chef.io
|
|
29
57
|
executables:
|
|
30
58
|
- ffi-yajl-bench
|
|
31
|
-
extensions:
|
|
32
|
-
- ext/ffi_yajl/ext/encoder/extconf.rb
|
|
33
|
-
- ext/ffi_yajl/ext/parser/extconf.rb
|
|
34
|
-
- ext/ffi_yajl/ext/dlopen/extconf.rb
|
|
59
|
+
extensions: []
|
|
35
60
|
extra_rdoc_files:
|
|
36
61
|
- README.md
|
|
37
62
|
- LICENSE
|
|
@@ -41,6 +66,7 @@ files:
|
|
|
41
66
|
- bin/ffi-yajl-bench
|
|
42
67
|
- ext/ffi_yajl/ext/dlopen/dlopen.c
|
|
43
68
|
- ext/ffi_yajl/ext/dlopen/extconf.rb
|
|
69
|
+
- ext/ffi_yajl/ext/dlopen/yajl.sym
|
|
44
70
|
- ext/ffi_yajl/ext/encoder/encoder.c
|
|
45
71
|
- ext/ffi_yajl/ext/encoder/extconf.rb
|
|
46
72
|
- ext/ffi_yajl/ext/parser/extconf.rb
|
|
@@ -80,7 +106,7 @@ homepage: http://github.com/chef/ffi-yajl
|
|
|
80
106
|
licenses:
|
|
81
107
|
- MIT
|
|
82
108
|
metadata: {}
|
|
83
|
-
post_install_message:
|
|
109
|
+
post_install_message:
|
|
84
110
|
rdoc_options: []
|
|
85
111
|
require_paths:
|
|
86
112
|
- lib
|
|
@@ -88,15 +114,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
88
114
|
requirements:
|
|
89
115
|
- - ">="
|
|
90
116
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '
|
|
117
|
+
version: '3.1'
|
|
92
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
119
|
requirements:
|
|
94
120
|
- - ">="
|
|
95
121
|
- !ruby/object:Gem::Version
|
|
96
122
|
version: '0'
|
|
97
123
|
requirements: []
|
|
98
|
-
rubygems_version: 3.
|
|
99
|
-
signing_key:
|
|
124
|
+
rubygems_version: 3.3.27
|
|
125
|
+
signing_key:
|
|
100
126
|
specification_version: 4
|
|
101
127
|
summary: Ruby FFI wrapper around YAJL 2.x
|
|
102
128
|
test_files: []
|