edn_turbo 0.5.5 → 0.5.6

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
  SHA1:
3
- metadata.gz: 2bdaf1257c512aad396ab5db5e554d1a0c5bec29
4
- data.tar.gz: e51ad5ecc5029c72078bec4852990001544bc30a
3
+ metadata.gz: 55486f37f4ec63643add89b5ca31256f4e5e71eb
4
+ data.tar.gz: 1114085a545a160ab5329c0332574850a02bbf3e
5
5
  SHA512:
6
- metadata.gz: 5c052722da212c13e23d00966270cc82a38a91dba82c838f65c43c36d258230404918b517f6bf77d61ce2deb4bd43c01e1ce59efb5c8df289620694b66d3ea9a
7
- data.tar.gz: 7207cd8c45ff82be2a2482a4dbf76b81a234316a5580a145be6bfbc34abfd4a47f20235aa033099ee3fa9b3cd9155a9af13bd51f14a4515014ce024d52743337
6
+ metadata.gz: e10e95095bebcfc3b2216dd231642c0dfaf007e9a63ff05f177eb8e9f227ede8ff5ca2645bddd5dfaadb8b653c7413d8c8db96700e3bc6af4a2892b1e0f52b63
7
+ data.tar.gz: e1468de18ccd2b6de6d8ade7674dbcc863aa5a9119961697f186a081a0b3b22f7ba595d563e598587b83febf5b92239b39023233bad0482ab9e5a11867863c30
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- edn_turbo
2
- =========
1
+ edn_turbo 0.5.6
2
+ ===============
3
3
 
4
4
  Fast Ragel-based EDN parser for Ruby.
5
5
 
@@ -37,8 +37,8 @@ Dependencies
37
37
  ============
38
38
 
39
39
  - ruby gems:
40
- - [rake 10.3](http://rake.rubyforge.org)
41
- - [rake-compiler 0.9](http://rake-compiler.rubyforge.org)
40
+ - [rake](http://rake.rubyforge.org)
41
+ - [rake-compiler 1.0](http://rake-compiler.rubyforge.org)
42
42
  - [edn 1.1](https://github.com/relevance/edn-ruby)
43
43
  - [icu4c](http://icu-project.org/apiref/icu4c/)
44
44
 
@@ -49,9 +49,9 @@ Notes:
49
49
  - `edn_turbo` uses a ragel-based parser but the generated .cc file is
50
50
  bundled so ragel should not need to be installed.
51
51
 
52
- - As of 0.3.0, [rice](http://rice.rubyforge.org) is no longer
53
- required.
54
-
52
+ - If the gem fails to install due to a compilation error, make sure you
53
+ have `icu4c` installed. The reported gem install error doesn't make
54
+ it clear this is the issue.
55
55
 
56
56
  Usage
57
57
  =====
@@ -2,24 +2,48 @@
2
2
 
3
3
  require 'mkmf'
4
4
 
5
- HEADER_DIRS = [
6
- '/usr/local/include',
7
- '/usr/local/opt/icu4c/include',
8
- '/usr/include'
9
- ]
10
-
11
- LIB_DIRS = [
12
- '/usr/local/lib', # must be the first entry; add others after it
13
- '/usr/local/opt/icu4c/lib'
14
- ]
15
-
16
- dir_config('edn_ext', HEADER_DIRS, LIB_DIRS)
5
+ header_dirs =
6
+ if RUBY_PLATFORM =~ /darwin/
7
+ abort "\n>> failed to find pkg-config binary - Is brew installed? If so, run 'brew install pkg-config'?\n\n" unless
8
+ File.exist?('/usr/local/bin/pkg-config')
9
+
10
+ abort "\n>> failed to find icu4c package - Did you run 'brew install icu4c'?\n\n" unless
11
+ File.exist?('/usr/local/opt/icu4c/lib/pkgconfig/icu-uc.pc')
12
+
13
+ i_opt = %x[ export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig" && /usr/local/bin/pkg-config --cflags-only-I icu-uc ]
14
+ [
15
+ i_opt[/-I(.+?)\s/,1]
16
+ ].freeze
17
+ else
18
+ [
19
+ '/usr/local/include',
20
+ '/usr/local/opt/icu4c/include',
21
+ '/usr/include'
22
+ ].freeze
23
+ end
24
+
25
+ lib_dirs =
26
+ if RUBY_PLATFORM =~ /darwin/
27
+ l_opt = %x[ /usr/local/bin/pkg-config --libs icu-uc ]
28
+ [
29
+ l_opt[/-L(.+?)\s/,1]
30
+ ].freeze
31
+ else
32
+ [
33
+ '/usr/local/lib', # must be the first entry; add others after it
34
+ '/usr/local/opt/icu4c/lib'
35
+ ].freeze
36
+ end
37
+
38
+ dir_config('icuuc', header_dirs, lib_dirs)
17
39
 
18
40
  # feels very hackish to do this but the new icu4c needs it on MacOS
19
- $CXXFLAGS << ' -stdlib=libc++ -std=c++11' if RUBY_PLATFORM =~ /darwin/
41
+ $CXXFLAGS << ' -stdlib=libc++ -std=c++11' if RUBY_PLATFORM.match?(/darwin/)
20
42
 
21
- abort 'icu4c headers missing' unless find_header('unicode/uversion.h')
43
+ abort "\n>> failed to find icu4c headers - is icu4c installed?\n\n" unless
44
+ find_header('unicode/uversion.h')
22
45
 
23
- abort 'ic4c lib missing' unless have_library('icuuc')
46
+ abort "\n>> failed to find icu4c library - is icu4c installed?\n\n" unless
47
+ have_library('icuuc')
24
48
 
25
49
  create_makefile('edn_turbo/edn_turbo')
@@ -5,15 +5,7 @@
5
5
  module EDNT
6
6
  # Bind the given meta to the value.
7
7
  def self.extend_for_meta(value, ext_meta)
8
- meta = ext_meta
9
-
10
- metadata = meta.reduce({}) do |acc, m|
11
- case m
12
- when Symbol then acc.merge(m => true)
13
- when EDN::Type::Symbol then acc.merge(tag: m)
14
- else acc.merge(m)
15
- end
16
- end
8
+ metadata = EDNT.merge_meta(ext_meta)
17
9
 
18
10
  unless metadata.empty?
19
11
  value.extend EDN::Metadata
@@ -22,4 +14,14 @@ module EDNT
22
14
 
23
15
  value
24
16
  end
17
+
18
+ def self.merge_meta(meta)
19
+ meta.reduce({}) do |acc, m|
20
+ case m
21
+ when Symbol then acc.merge(m => true)
22
+ when EDN::Type::Symbol then acc.merge(tag: m)
23
+ else acc.merge(m)
24
+ end
25
+ end
26
+ end
25
27
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EDNT
4
- VERSION = '0.5.5'
5
- RELEASE_DATE = '2018-01-04'
4
+ VERSION = '0.5.6'
5
+ RELEASE_DATE = '2019-01-30'
6
6
  end
@@ -1,23 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- coding: utf-8 -*-
2
+
3
+ # frozen_string_literal: true
4
+
3
5
  $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
6
  require 'minitest/autorun'
5
7
  require 'edn_turbo'
6
8
  require 'date'
7
9
 
8
10
  class EDNT_Test < Minitest::Test
11
+ #
12
+ # helpers
9
13
  def setup
10
14
  @parser = EDNT::Parser.new
11
15
  end
12
16
 
13
17
  def check_file(file, expected_output)
14
18
  output = nil
15
- File.open(file) { |source|
19
+ File.open(file) do |source|
16
20
  input = source.instance_of?(String) ? source : source.read
17
21
 
18
22
  # test using parse() first
19
23
  output = @parser.parse(input)
20
- if expected_output == nil
24
+ if expected_output.nil?
21
25
  assert_nil(output)
22
26
  else
23
27
  assert_equal(expected_output, output)
@@ -26,23 +30,23 @@ class EDNT_Test < Minitest::Test
26
30
  # now test setting the source and using read (although one-shot)
27
31
  @parser.set_input(input)
28
32
  output = @parser.read
29
- if expected_output == nil
33
+ if expected_output.nil?
30
34
  assert_nil(output)
31
35
  else
32
36
  assert_equal(expected_output, output)
33
37
  end
34
- }
38
+ end
35
39
 
36
40
  # and test passing the IO
37
- File.open(file) { |file_io|
41
+ File.open(file) do |file_io|
38
42
  @parser.set_input(file_io)
39
43
  output = @parser.read
40
- if expected_output == nil
44
+ if expected_output.nil?
41
45
  assert_nil(output)
42
46
  else
43
47
  assert_equal(expected_output, output)
44
48
  end
45
- }
49
+ end
46
50
  output
47
51
  end
48
52
 
@@ -74,33 +78,26 @@ class EDNT_Test < Minitest::Test
74
78
  end
75
79
 
76
80
  def test_number
77
-
78
81
  check_file('test/number.edn',
79
82
  [0, 0, 5, 12, 232, -98798, 13213, 0.11, 231.312, -2321.0, 11.22, 432,
80
83
  123412341231212121241234,
81
84
  123412341231212121241234,
82
- 4.54e+44, 4.5e+44]
83
- )
85
+ 4.54e+44, 4.5e+44])
84
86
  end
85
87
 
86
88
  def test_keyword
87
-
88
89
  check_file('test/keyword.edn',
89
- [:key1, :"key_2/adsd2", :key_3, :"key-4", :"key_5/asd-32_ee", :"#/:a"]
90
- )
90
+ [:key1, :"key_2/adsd2", :key_3, :"key-4", :"key_5/asd-32_ee", :"#/:a"])
91
91
  end
92
92
 
93
93
  def test_values
94
-
95
94
  check_file('test/values.edn',
96
95
  [false, true, nil, "this is a test", "this\tis\\only\ta\ttest\rof\"various\nescaped\\values",
97
96
  ['c', "\n", "\t"],
98
- '123➪456®789']
99
- )
97
+ '123➪456®789'])
100
98
  end
101
99
 
102
100
  def test_builtin_tagged_inst
103
-
104
101
  check_file('test/inst.edn',
105
102
  [
106
103
  DateTime.rfc3339('1985-04-12T23:20:50.52Z'),
@@ -108,14 +105,11 @@ class EDNT_Test < Minitest::Test
108
105
  DateTime.rfc3339('1990-12-31T23:59:60Z'),
109
106
  DateTime.rfc3339('1990-12-31T15:59:60-08:00'),
110
107
  DateTime.rfc3339('1937-01-01T12:00:27.87+00:20')
111
- ]
112
- )
108
+ ])
113
109
  end
114
110
 
115
111
  def test_builtin_tagged_uuid
116
-
117
112
  check_file('test/uuid.edn', 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
118
-
119
113
  end
120
114
 
121
115
  def test_sets
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edn_turbo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Porras
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: edn
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.3'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake-compiler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.9'
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.9'
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.7'
69
- description: Optimization for parsing of EDN files using ragel in a c++ extension
69
+ description: Optimized plugin for parsing EDN files using ragel
70
70
  email: ed@motologic.com
71
71
  executables:
72
72
  - ppedn