json_pure 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +14 -0
  3. data/VERSION +1 -1
  4. data/json_pure.gemspec +47 -19
  5. data/lib/json/version.rb +1 -1
  6. data/tests/fixtures/fail29.json +1 -0
  7. data/tests/fixtures/fail30.json +1 -0
  8. data/tests/fixtures/fail31.json +1 -0
  9. data/tests/fixtures/fail32.json +1 -0
  10. metadata +16 -48
  11. data/.gitignore +0 -18
  12. data/.travis.yml +0 -23
  13. data/README-json-jruby.md +0 -33
  14. data/Rakefile +0 -334
  15. data/diagrams/.keep +0 -0
  16. data/ext/json/ext/fbuffer/fbuffer.h +0 -187
  17. data/ext/json/ext/generator/depend +0 -1
  18. data/ext/json/ext/generator/extconf.rb +0 -4
  19. data/ext/json/ext/generator/generator.c +0 -1612
  20. data/ext/json/ext/generator/generator.h +0 -174
  21. data/ext/json/ext/parser/depend +0 -1
  22. data/ext/json/ext/parser/extconf.rb +0 -31
  23. data/ext/json/ext/parser/parser.c +0 -2164
  24. data/ext/json/ext/parser/parser.h +0 -92
  25. data/ext/json/ext/parser/parser.rl +0 -924
  26. data/ext/json/extconf.rb +0 -3
  27. data/install.rb +0 -23
  28. data/java/src/json/ext/ByteListTranscoder.java +0 -166
  29. data/java/src/json/ext/Generator.java +0 -447
  30. data/java/src/json/ext/GeneratorMethods.java +0 -231
  31. data/java/src/json/ext/GeneratorService.java +0 -42
  32. data/java/src/json/ext/GeneratorState.java +0 -520
  33. data/java/src/json/ext/OptionsReader.java +0 -113
  34. data/java/src/json/ext/Parser.java +0 -2374
  35. data/java/src/json/ext/Parser.rl +0 -905
  36. data/java/src/json/ext/ParserService.java +0 -34
  37. data/java/src/json/ext/RuntimeInfo.java +0 -116
  38. data/java/src/json/ext/StringDecoder.java +0 -166
  39. data/java/src/json/ext/StringEncoder.java +0 -117
  40. data/java/src/json/ext/Utils.java +0 -88
  41. data/json-java.gemspec +0 -38
  42. data/json.gemspec +0 -140
  43. data/references/rfc7159.txt +0 -899
  44. data/tools/diff.sh +0 -18
  45. data/tools/fuzz.rb +0 -131
  46. data/tools/server.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19ad55284912f57f06f2aa2d0a6336486ee6d20112a3cec8e3f4e918a0fbd338
4
- data.tar.gz: 159c717b0b0cc8e4e6d8609b542b113fb8c483e1a306b6582f8a98ddadc20090
3
+ metadata.gz: ccaf5d00b6462faaa558a21e868626904f051a833eea93e81e2ae2e3cdc9dfd0
4
+ data.tar.gz: 63d055fcb71de6f94d7c2632aba540f5450631a96813a7eee962939a0957b43d
5
5
  SHA512:
6
- metadata.gz: fba550423cbfb98dfe9abc4fe534e7fbeff135cde38a0e17b98123dbf8a664b70e7d26e130b536292123268266917251c06800b1224eca3007e1f6f54a148b16
7
- data.tar.gz: fbe734f8b76e9f4c4c90304d11fa8026d349e2684f01358140cb36113720a57016fbbe8b12857f5e2c7b82baef2ac09a528b7839e17a22f87132940af98da2a0
6
+ metadata.gz: 7f40f310a0c21b71b936caa11fa219f24a746719d4e7f10c07a2dc7747a741943344a639ad21b404964413d00fe3f9a74c97e936d3fe82a1a36c23aae522724e
7
+ data.tar.gz: 53cc02a7433b9d08cd7f6ba48bce2de608c8daac160e662fa8cf14d65173b9402527390a521aa90a1679fb0ee67f4e9a25b1e3cf4baeb7765c7adc12439f13fc
data/CHANGES.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changes
2
2
 
3
+ ## 2020-12-17 (2.4.1)
4
+
5
+ * Restore version.rb with 2.4.1
6
+
7
+ ## 2020-12-15 (2.4.0)
8
+
9
+ * Implement a freeze: parser option #447
10
+ * Fix an issue with generate_pretty and empty objects in the Ruby and Java implementations #449
11
+ * Fix JSON.load_file doc #448
12
+ * Fix pure parser with unclosed arrays / objects #425
13
+ * bundle the LICENSE file in the gem #444
14
+ * Add an option to escape forward slash character #405
15
+ * RDoc for JSON #439 #446 #442 #434 #433 #430
16
+
3
17
  ## 2020-06-30 (2.3.1)
4
18
 
5
19
  * Spelling and grammar fixes for comments. Pull request #191 by Josh
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.4.1
@@ -4,30 +4,58 @@ Gem::Specification.new do |s|
4
4
  s.name = "json_pure".freeze
5
5
  s.version = File.read("VERSION").chomp
6
6
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
8
- s.require_paths = ["lib".freeze]
9
- s.authors = ["Florian Frank".freeze]
7
+ s.summary = "JSON Implementation for Ruby".freeze
10
8
  s.description = "This is a JSON implementation in pure Ruby.".freeze
9
+ s.licenses = ["Ruby".freeze]
10
+ s.authors = ["Florian Frank".freeze]
11
11
  s.email = "flori@ping.de".freeze
12
+
12
13
  s.extra_rdoc_files = ["README.md".freeze]
13
- s.files = ["./tests/test_helper.rb".freeze, ".gitignore".freeze, ".travis.yml".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README-json-jruby.md".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "diagrams/.keep".freeze, "ext/json/ext/fbuffer/fbuffer.h".freeze, "ext/json/ext/generator/depend".freeze, "ext/json/ext/generator/extconf.rb".freeze, "ext/json/ext/generator/generator.c".freeze, "ext/json/ext/generator/generator.h".freeze, "ext/json/ext/parser/depend".freeze, "ext/json/ext/parser/extconf.rb".freeze, "ext/json/ext/parser/parser.c".freeze, "ext/json/ext/parser/parser.h".freeze, "ext/json/ext/parser/parser.rl".freeze, "ext/json/extconf.rb".freeze, "install.rb".freeze, "java/src/json/ext/ByteListTranscoder.java".freeze, "java/src/json/ext/Generator.java".freeze, "java/src/json/ext/GeneratorMethods.java".freeze, "java/src/json/ext/GeneratorService.java".freeze, "java/src/json/ext/GeneratorState.java".freeze, "java/src/json/ext/OptionsReader.java".freeze, "java/src/json/ext/Parser.java".freeze, "java/src/json/ext/Parser.rl".freeze, "java/src/json/ext/ParserService.java".freeze, "java/src/json/ext/RuntimeInfo.java".freeze, "java/src/json/ext/StringDecoder.java".freeze, "java/src/json/ext/StringEncoder.java".freeze, "java/src/json/ext/Utils.java".freeze, "json-java.gemspec".freeze, "json.gemspec".freeze, "json_pure.gemspec".freeze, "lib/json.rb".freeze, "lib/json/add/bigdecimal.rb".freeze, "lib/json/add/complex.rb".freeze, "lib/json/add/core.rb".freeze, "lib/json/add/date.rb".freeze, "lib/json/add/date_time.rb".freeze, "lib/json/add/exception.rb".freeze, "lib/json/add/ostruct.rb".freeze, "lib/json/add/range.rb".freeze, "lib/json/add/rational.rb".freeze, "lib/json/add/regexp.rb".freeze, "lib/json/add/set.rb".freeze, "lib/json/add/struct.rb".freeze, "lib/json/add/symbol.rb".freeze, "lib/json/add/time.rb".freeze, "lib/json/common.rb".freeze, "lib/json/ext.rb".freeze, "lib/json/ext/.keep".freeze, "lib/json/generic_object.rb".freeze, "lib/json/pure.rb".freeze, "lib/json/pure/generator.rb".freeze, "lib/json/pure/parser.rb".freeze, "lib/json/version.rb".freeze, "references/rfc7159.txt".freeze, "tests/fixtures/fail10.json".freeze, "tests/fixtures/fail11.json".freeze, "tests/fixtures/fail12.json".freeze, "tests/fixtures/fail13.json".freeze, "tests/fixtures/fail14.json".freeze, "tests/fixtures/fail18.json".freeze, "tests/fixtures/fail19.json".freeze, "tests/fixtures/fail2.json".freeze, "tests/fixtures/fail20.json".freeze, "tests/fixtures/fail21.json".freeze, "tests/fixtures/fail22.json".freeze, "tests/fixtures/fail23.json".freeze, "tests/fixtures/fail24.json".freeze, "tests/fixtures/fail25.json".freeze, "tests/fixtures/fail27.json".freeze, "tests/fixtures/fail28.json".freeze, "tests/fixtures/fail3.json".freeze, "tests/fixtures/fail4.json".freeze, "tests/fixtures/fail5.json".freeze, "tests/fixtures/fail6.json".freeze, "tests/fixtures/fail7.json".freeze, "tests/fixtures/fail8.json".freeze, "tests/fixtures/fail9.json".freeze, "tests/fixtures/obsolete_fail1.json".freeze, "tests/fixtures/pass1.json".freeze, "tests/fixtures/pass15.json".freeze, "tests/fixtures/pass16.json".freeze, "tests/fixtures/pass17.json".freeze, "tests/fixtures/pass2.json".freeze, "tests/fixtures/pass26.json".freeze, "tests/fixtures/pass3.json".freeze, "tests/json_addition_test.rb".freeze, "tests/json_common_interface_test.rb".freeze, "tests/json_encoding_test.rb".freeze, "tests/json_ext_parser_test.rb".freeze, "tests/json_fixtures_test.rb".freeze, "tests/json_generator_test.rb".freeze, "tests/json_generic_object_test.rb".freeze, "tests/json_parser_test.rb".freeze, "tests/json_string_matching_test.rb".freeze, "tests/test_helper.rb".freeze, "tools/diff.sh".freeze, "tools/fuzz.rb".freeze, "tools/server.rb".freeze]
14
- s.homepage = "http://flori.github.com/json".freeze
15
- s.licenses = ["Ruby".freeze]
16
14
  s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze]
15
+ s.files = [
16
+ "CHANGES.md".freeze,
17
+ "Gemfile".freeze,
18
+ "LICENSE".freeze,
19
+ "README.md".freeze,
20
+ "VERSION".freeze,
21
+ "json_pure.gemspec".freeze,
22
+ "lib/json.rb".freeze,
23
+ "lib/json/add/bigdecimal.rb".freeze,
24
+ "lib/json/add/complex.rb".freeze,
25
+ "lib/json/add/core.rb".freeze,
26
+ "lib/json/add/date.rb".freeze,
27
+ "lib/json/add/date_time.rb".freeze,
28
+ "lib/json/add/exception.rb".freeze,
29
+ "lib/json/add/ostruct.rb".freeze,
30
+ "lib/json/add/range.rb".freeze,
31
+ "lib/json/add/rational.rb".freeze,
32
+ "lib/json/add/regexp.rb".freeze,
33
+ "lib/json/add/set.rb".freeze,
34
+ "lib/json/add/struct.rb".freeze,
35
+ "lib/json/add/symbol.rb".freeze,
36
+ "lib/json/add/time.rb".freeze,
37
+ "lib/json/common.rb".freeze,
38
+ "lib/json/ext.rb".freeze,
39
+ "lib/json/ext/.keep".freeze,
40
+ "lib/json/generic_object.rb".freeze,
41
+ "lib/json/pure.rb".freeze,
42
+ "lib/json/pure/generator.rb".freeze,
43
+ "lib/json/pure/parser.rb".freeze,
44
+ "lib/json/version.rb".freeze,
45
+ ] + Dir["tests/**/*"]
46
+ s.homepage = "http://flori.github.com/json".freeze
47
+ s.metadata = {
48
+ 'bug_tracker_uri' => 'https://github.com/flori/json/issues',
49
+ 'changelog_uri' => 'https://github.com/flori/json/blob/master/CHANGES.md',
50
+ 'documentation_uri' => 'http://flori.github.io/json/doc/index.html',
51
+ 'homepage_uri' => 'http://flori.github.io/json/',
52
+ 'source_code_uri' => 'https://github.com/flori/json',
53
+ 'wiki_uri' => 'https://github.com/flori/json/wiki'
54
+ }
55
+
17
56
  s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze)
18
- s.rubygems_version = "3.1.2".freeze
19
- s.summary = "JSON Implementation for Ruby".freeze
20
57
  s.test_files = ["./tests/test_helper.rb".freeze]
21
58
 
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
24
- end
25
-
26
- if s.respond_to? :add_runtime_dependency then
27
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
28
- s.add_development_dependency(%q<test-unit>.freeze, [">= 2.0", "< 4.0"])
29
- else
30
- s.add_dependency(%q<rake>.freeze, [">= 0"])
31
- s.add_dependency(%q<test-unit>.freeze, [">= 2.0", "< 4.0"])
32
- end
59
+ s.add_development_dependency "rake"
60
+ s.add_development_dependency "test-unit"
33
61
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  module JSON
3
3
  # JSON version
4
- VERSION = '2.3.1'
4
+ VERSION = '2.4.1'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -0,0 +1 @@
1
+ {
@@ -0,0 +1 @@
1
+ [
@@ -0,0 +1 @@
1
+ [1, 2, 3,
@@ -0,0 +1 @@
1
+ {"foo": "bar"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_pure
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-15 00:00:00.000000000 Z
11
+ date: 2020-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,20 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '4.0'
33
+ version: '0'
37
34
  type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: '2.0'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '4.0'
40
+ version: '0'
47
41
  description: This is a JSON implementation in pure Ruby.
48
42
  email: flori@ping.de
49
43
  executables: []
@@ -52,43 +46,11 @@ extra_rdoc_files:
52
46
  - README.md
53
47
  files:
54
48
  - "./tests/test_helper.rb"
55
- - ".gitignore"
56
- - ".travis.yml"
57
49
  - CHANGES.md
58
50
  - Gemfile
59
51
  - LICENSE
60
- - README-json-jruby.md
61
52
  - README.md
62
- - Rakefile
63
53
  - VERSION
64
- - diagrams/.keep
65
- - ext/json/ext/fbuffer/fbuffer.h
66
- - ext/json/ext/generator/depend
67
- - ext/json/ext/generator/extconf.rb
68
- - ext/json/ext/generator/generator.c
69
- - ext/json/ext/generator/generator.h
70
- - ext/json/ext/parser/depend
71
- - ext/json/ext/parser/extconf.rb
72
- - ext/json/ext/parser/parser.c
73
- - ext/json/ext/parser/parser.h
74
- - ext/json/ext/parser/parser.rl
75
- - ext/json/extconf.rb
76
- - install.rb
77
- - java/src/json/ext/ByteListTranscoder.java
78
- - java/src/json/ext/Generator.java
79
- - java/src/json/ext/GeneratorMethods.java
80
- - java/src/json/ext/GeneratorService.java
81
- - java/src/json/ext/GeneratorState.java
82
- - java/src/json/ext/OptionsReader.java
83
- - java/src/json/ext/Parser.java
84
- - java/src/json/ext/Parser.rl
85
- - java/src/json/ext/ParserService.java
86
- - java/src/json/ext/RuntimeInfo.java
87
- - java/src/json/ext/StringDecoder.java
88
- - java/src/json/ext/StringEncoder.java
89
- - java/src/json/ext/Utils.java
90
- - json-java.gemspec
91
- - json.gemspec
92
54
  - json_pure.gemspec
93
55
  - lib/json.rb
94
56
  - lib/json/add/bigdecimal.rb
@@ -113,7 +75,6 @@ files:
113
75
  - lib/json/pure/generator.rb
114
76
  - lib/json/pure/parser.rb
115
77
  - lib/json/version.rb
116
- - references/rfc7159.txt
117
78
  - tests/fixtures/fail10.json
118
79
  - tests/fixtures/fail11.json
119
80
  - tests/fixtures/fail12.json
@@ -130,7 +91,11 @@ files:
130
91
  - tests/fixtures/fail25.json
131
92
  - tests/fixtures/fail27.json
132
93
  - tests/fixtures/fail28.json
94
+ - tests/fixtures/fail29.json
133
95
  - tests/fixtures/fail3.json
96
+ - tests/fixtures/fail30.json
97
+ - tests/fixtures/fail31.json
98
+ - tests/fixtures/fail32.json
134
99
  - tests/fixtures/fail4.json
135
100
  - tests/fixtures/fail5.json
136
101
  - tests/fixtures/fail6.json
@@ -155,13 +120,16 @@ files:
155
120
  - tests/json_parser_test.rb
156
121
  - tests/json_string_matching_test.rb
157
122
  - tests/test_helper.rb
158
- - tools/diff.sh
159
- - tools/fuzz.rb
160
- - tools/server.rb
161
123
  homepage: http://flori.github.com/json
162
124
  licenses:
163
125
  - Ruby
164
- metadata: {}
126
+ metadata:
127
+ bug_tracker_uri: https://github.com/flori/json/issues
128
+ changelog_uri: https://github.com/flori/json/blob/master/CHANGES.md
129
+ documentation_uri: http://flori.github.io/json/doc/index.html
130
+ homepage_uri: http://flori.github.io/json/
131
+ source_code_uri: https://github.com/flori/json
132
+ wiki_uri: https://github.com/flori/json/wiki
165
133
  post_install_message:
166
134
  rdoc_options:
167
135
  - "--title"
@@ -181,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
149
  - !ruby/object:Gem::Version
182
150
  version: '0'
183
151
  requirements: []
184
- rubygems_version: 3.1.4
152
+ rubygems_version: 3.2.1
185
153
  signing_key:
186
154
  specification_version: 4
187
155
  summary: JSON Implementation for Ruby
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- .*.sw[pon]
2
- *.bundle
3
- coverage
4
- tags
5
- pkg
6
- .nfs.*
7
- .idea
8
- java/Json.iml
9
- Gemfile.lock
10
- .rvmrc
11
- *.rbc
12
- .rbx
13
- .AppleDouble
14
- .DS_Store
15
- */**/Makefile
16
- */**/*.o
17
- .byebug_history
18
- *.log
@@ -1,23 +0,0 @@
1
- # Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
2
- #bundler_args: --binstubs
3
- language: ruby
4
-
5
- # Specify which ruby versions you wish to run your tests on, each version will be used
6
- rvm:
7
- - 2.1
8
- - 2.2
9
- - 2.3
10
- - 2.4
11
- - 2.5
12
- - 2.6
13
- - 2.7.0-preview3
14
- - ruby-head
15
- - jruby-9.1 # Ruby 2.3
16
- - jruby-9.2 # Ruby 2.5
17
- - truffleruby
18
- matrix:
19
- allow_failures:
20
- - rvm: ruby-head
21
- - rvm: truffleruby
22
- script: "bundle exec rake"
23
- sudo: false
@@ -1,33 +0,0 @@
1
- JSON-JRuby
2
- ==========
3
-
4
- JSON-JRuby is a port of Florian Frank's native
5
- [`json` library](http://json.rubyforge.org/) to JRuby.
6
- It aims to be a perfect drop-in replacement for `json_pure`.
7
-
8
-
9
- Development version
10
- ===================
11
-
12
- The latest version is available from the
13
- [Git repository](http://github.com/mernen/json-jruby/tree):
14
-
15
- git clone git://github.com/mernen/json-jruby.git
16
-
17
-
18
- Compiling
19
- =========
20
-
21
- You'll need JRuby version 1.2 or greater to build JSON-JRuby.
22
- Its path must be set on the `jruby.dir` property of
23
- `nbproject/project.properties` (defaults to `../jruby`).
24
-
25
- Additionally, you'll need [Ant](http://ant.apache.org/), and
26
- [Ragel](http://www.cs.queensu.ca/~thurston/ragel/) 6.4 or greater.
27
-
28
- Then, from the folder where the sources are located, type:
29
-
30
- ant clean jar
31
-
32
- to clean any leftovers from previous builds and generate the `.jar` files.
33
- To generate a RubyGem, specify the `gem` action rather than `jar`.
data/Rakefile DELETED
@@ -1,334 +0,0 @@
1
- begin
2
- require 'rubygems/package_task'
3
- rescue LoadError
4
- end
5
-
6
- require 'rbconfig'
7
- include\
8
- begin
9
- RbConfig
10
- rescue NameError
11
- Config
12
- end
13
-
14
- require 'rake/clean'
15
- CLOBBER.include 'doc', 'Gemfile.lock'
16
- CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
17
- FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'],
18
- FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class,dSYM}"],
19
- FileList['java/src/**/*.class']
20
-
21
- require 'rake/testtask'
22
- class UndocumentedTestTask < Rake::TestTask
23
- def desc(*) end
24
- end
25
-
26
- which = lambda { |c|
27
- w = `which #{c}`
28
- break w.chomp unless w.empty?
29
- }
30
-
31
- MAKE = ENV['MAKE'] || %w[gmake make].find(&which)
32
- BUNDLE = ENV['BUNDLE'] || %w[bundle].find(&which)
33
- PKG_NAME = 'json'
34
- PKG_TITLE = 'JSON Implementation for Ruby'
35
- PKG_VERSION = File.read('VERSION').chomp
36
- PKG_FILES = FileList[`git ls-files`.split(/\n/)]
37
-
38
- EXT_ROOT_DIR = 'ext/json/ext'
39
- EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
40
- EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
41
- RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
42
- EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
43
- EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
44
- EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
45
- EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
46
-
47
- JAVA_DIR = "java/src/json/ext"
48
- JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl"
49
- JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
50
- JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
51
- JAVA_CLASSES = []
52
- JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
53
- JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
54
-
55
- RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find(&which)
56
- RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find(&which)
57
-
58
- desc "Installing library (pure)"
59
- task :install_pure => :version do
60
- ruby 'install.rb'
61
- end
62
-
63
- task :install_ext_really do
64
- sitearchdir = CONFIG["sitearchdir"]
65
- cd 'ext' do
66
- for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
67
- d = File.join(sitearchdir, file)
68
- mkdir_p File.dirname(d)
69
- install(file, d)
70
- end
71
- warn " *** Installed EXT ruby library."
72
- end
73
- end
74
-
75
- desc "Installing library (extension)"
76
- task :install_ext => [ :compile, :install_pure, :install_ext_really ]
77
-
78
- desc "Installing library (extension)"
79
- task :install => :install_ext
80
-
81
- desc m = "Writing version information for #{PKG_VERSION}"
82
- task :version do
83
- puts m
84
- File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v|
85
- v.puts <<EOT
86
- # frozen_string_literal: false
87
- module JSON
88
- # JSON version
89
- VERSION = '#{PKG_VERSION}'
90
- VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
91
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
92
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
93
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
94
- end
95
- EOT
96
- end
97
- end
98
-
99
- task :check_env do
100
- ENV.key?('JSON') or fail "JSON env var is required"
101
- end
102
-
103
- desc "Testing library (pure ruby)"
104
- task :test_pure => [ :set_env_pure, :check_env, :do_test_pure ]
105
- task(:set_env_pure) { ENV['JSON'] = 'pure' }
106
-
107
- UndocumentedTestTask.new do |t|
108
- t.name = 'do_test_pure'
109
- t.libs << 'lib' << 'tests'
110
- t.test_files = FileList['tests/*_test.rb']
111
- t.verbose = true
112
- t.options = '-v'
113
- end
114
-
115
- desc "Testing library (pure ruby and extension)"
116
- task :test => [ :test_pure, :test_ext ]
117
-
118
- namespace :gems do
119
- desc 'Install all development gems'
120
- task :install do
121
- sh "#{BUNDLE}"
122
- end
123
- end
124
-
125
- if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
126
- ENV['JAVA_HOME'] ||= [
127
- '/usr/local/java/jdk',
128
- '/usr/lib/jvm/java-6-openjdk',
129
- '/Library/Java/Home',
130
- ].find { |c| File.directory?(c) }
131
- if ENV['JAVA_HOME']
132
- warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}"
133
- ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':'
134
- warn " *** java binaries are assumed to be in #{java_path.inspect}"
135
- else
136
- warn " *** JAVA_HOME was not set or could not be guessed!"
137
- exit 1
138
- end
139
-
140
- file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do
141
- cd JAVA_DIR do
142
- if RAGEL_CODEGEN == 'ragel'
143
- sh "ragel Parser.rl -J -o Parser.java"
144
- else
145
- sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
146
- end
147
- end
148
- end
149
-
150
- desc "Generate parser for java with ragel"
151
- task :ragel => JAVA_PARSER_SRC
152
-
153
- desc "Delete the ragel generated Java source"
154
- task :ragel_clean do
155
- rm_rf JAVA_PARSER_SRC
156
- end
157
-
158
- JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar")
159
- if File.exist?(JRUBY_JAR)
160
- JAVA_SOURCES.each do |src|
161
- classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
162
- obj = src.sub(/\.java\Z/, '.class')
163
- file obj => src do
164
- sh 'javac', '-classpath', classpath, '-source', '1.6', '-target', '1.6', src
165
- end
166
- JAVA_CLASSES << obj
167
- end
168
- else
169
- warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!"
170
- end
171
-
172
- desc "Compiling jruby extension"
173
- task :compile => JAVA_CLASSES
174
-
175
- desc "Package the jruby gem"
176
- task :jruby_gem => :create_jar do
177
- sh 'gem build json-java.gemspec'
178
- mkdir_p 'pkg'
179
- mv "json-#{PKG_VERSION}-java.gem", 'pkg'
180
- end
181
-
182
- desc "Testing library (jruby)"
183
- task :test_ext => [ :set_env_ext, :create_jar, :check_env, :do_test_ext ]
184
- task(:set_env_ext) { ENV['JSON'] = 'ext' }
185
-
186
- UndocumentedTestTask.new do |t|
187
- t.name = 'do_test_ext'
188
- t.libs << 'lib' << 'tests'
189
- t.test_files = FileList['tests/*_test.rb']
190
- t.verbose = true
191
- t.options = '-v'
192
- end
193
-
194
- file JRUBY_PARSER_JAR => :compile do
195
- cd 'java/src' do
196
- parser_classes = FileList[
197
- "json/ext/ByteListTranscoder*.class",
198
- "json/ext/OptionsReader*.class",
199
- "json/ext/Parser*.class",
200
- "json/ext/RuntimeInfo*.class",
201
- "json/ext/StringDecoder*.class",
202
- "json/ext/Utils*.class"
203
- ]
204
- sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes
205
- mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR)
206
- end
207
- end
208
-
209
- desc "Create parser jar"
210
- task :create_parser_jar => JRUBY_PARSER_JAR
211
-
212
- file JRUBY_GENERATOR_JAR => :compile do
213
- cd 'java/src' do
214
- generator_classes = FileList[
215
- "json/ext/ByteListTranscoder*.class",
216
- "json/ext/OptionsReader*.class",
217
- "json/ext/Generator*.class",
218
- "json/ext/RuntimeInfo*.class",
219
- "json/ext/StringEncoder*.class",
220
- "json/ext/Utils*.class"
221
- ]
222
- sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes
223
- mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR)
224
- end
225
- end
226
-
227
- desc "Create generator jar"
228
- task :create_generator_jar => JRUBY_GENERATOR_JAR
229
-
230
- desc "Create parser and generator jars"
231
- task :create_jar => [ :create_parser_jar, :create_generator_jar ]
232
-
233
- desc "Build all gems and archives for a new release of the jruby extension."
234
- task :build => [ :clean, :version, :jruby_gem ]
235
-
236
- task :release => :build
237
- else
238
- desc "Compiling extension"
239
- task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
240
-
241
- file EXT_PARSER_DL => EXT_PARSER_SRC do
242
- cd EXT_PARSER_DIR do
243
- ruby 'extconf.rb'
244
- sh MAKE
245
- end
246
- cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
247
- end
248
-
249
- file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
250
- cd EXT_GENERATOR_DIR do
251
- ruby 'extconf.rb'
252
- sh MAKE
253
- end
254
- cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
255
- end
256
-
257
- desc "Testing library (extension)"
258
- task :test_ext => [ :check_env, :compile, :do_test_ext ]
259
-
260
- UndocumentedTestTask.new do |t|
261
- t.name = 'do_test_ext'
262
- t.libs << 'ext' << 'lib' << 'tests'
263
- t.test_files = FileList['tests/*_test.rb']
264
- t.verbose = true
265
- t.options = '-v'
266
- end
267
-
268
- desc "Generate parser with ragel"
269
- task :ragel => EXT_PARSER_SRC
270
-
271
- desc "Delete the ragel generated C source"
272
- task :ragel_clean do
273
- rm_rf EXT_PARSER_SRC
274
- end
275
-
276
- desc "Update the tags file"
277
- task :tags do
278
- system 'ctags', *Dir['**/*.{rb,c,h,java}']
279
- end
280
-
281
- file EXT_PARSER_SRC => RAGEL_PATH do
282
- cd EXT_PARSER_DIR do
283
- if RAGEL_CODEGEN == 'ragel'
284
- sh "ragel parser.rl -G2 -o parser.c"
285
- else
286
- sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
287
- end
288
- src = File.read("parser.c").gsub(/[ \t]+$/, '')
289
- src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};')
290
- src.gsub!(/0 <= \(\*p\) && \(\*p\) <= 31/, "0 <= (signed char)(*p) && (*p) <= 31")
291
- src[0, 0] = "/* This file is automatically generated from parser.rl by using ragel */"
292
- File.open("parser.c", "w") {|f| f.print src}
293
- end
294
- end
295
-
296
- desc "Generate diagrams of ragel parser (ps)"
297
- task :ragel_dot_ps do
298
- root = 'diagrams'
299
- specs = []
300
- File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
301
- for s in specs
302
- if RAGEL_DOTGEN == 'ragel'
303
- sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
304
- else
305
- sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
306
- end
307
- end
308
- end
309
-
310
- desc "Generate diagrams of ragel parser (png)"
311
- task :ragel_dot_png do
312
- root = 'diagrams'
313
- specs = []
314
- File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
315
- for s in specs
316
- if RAGEL_DOTGEN == 'ragel'
317
- sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
318
- else
319
- sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
320
- end
321
- end
322
- end
323
-
324
- desc "Generate diagrams of ragel parser"
325
- task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
326
-
327
- desc "Build all gems and archives for a new release of json and json_pure."
328
- task :build => [ :clean, :gemspec, :package ]
329
-
330
- task :release => :build
331
- end
332
-
333
- desc "Compile in the the source directory"
334
- task :default => [ :clean, :test ]