json 1.8.6 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +5 -5
  2. data/{CHANGES → CHANGES.md} +292 -96
  3. data/LICENSE +56 -0
  4. data/README.md +185 -114
  5. data/ext/json/ext/fbuffer/fbuffer.h +0 -3
  6. data/ext/json/ext/generator/generator.c +328 -117
  7. data/ext/json/ext/generator/generator.h +8 -8
  8. data/ext/json/ext/parser/extconf.rb +29 -0
  9. data/ext/json/ext/parser/parser.c +540 -569
  10. data/ext/json/ext/parser/parser.h +10 -6
  11. data/ext/json/ext/parser/parser.rl +269 -261
  12. data/ext/json/extconf.rb +1 -1
  13. data/json.gemspec +0 -0
  14. data/lib/json/add/bigdecimal.rb +40 -10
  15. data/lib/json/add/complex.rb +32 -9
  16. data/lib/json/add/core.rb +1 -0
  17. data/lib/json/add/date.rb +27 -7
  18. data/lib/json/add/date_time.rb +26 -9
  19. data/lib/json/add/exception.rb +25 -7
  20. data/lib/json/add/ostruct.rb +32 -9
  21. data/lib/json/add/range.rb +33 -8
  22. data/lib/json/add/rational.rb +30 -8
  23. data/lib/json/add/regexp.rb +28 -10
  24. data/lib/json/add/set.rb +48 -0
  25. data/lib/json/add/struct.rb +29 -7
  26. data/lib/json/add/symbol.rb +28 -5
  27. data/lib/json/add/time.rb +27 -6
  28. data/lib/json/common.rb +402 -188
  29. data/lib/json/ext.rb +0 -6
  30. data/lib/json/generic_object.rb +11 -6
  31. data/lib/json/pure/generator.rb +120 -137
  32. data/lib/json/pure/parser.rb +64 -86
  33. data/lib/json/pure.rb +2 -8
  34. data/lib/json/version.rb +2 -1
  35. data/lib/json.rb +559 -29
  36. metadata +18 -129
  37. data/.gitignore +0 -17
  38. data/.travis.yml +0 -18
  39. data/Gemfile +0 -7
  40. data/README-json-jruby.markdown +0 -33
  41. data/Rakefile +0 -402
  42. data/TODO +0 -1
  43. data/VERSION +0 -1
  44. data/data/example.json +0 -1
  45. data/data/index.html +0 -38
  46. data/data/prototype.js +0 -4184
  47. data/diagrams/.keep +0 -0
  48. data/install.rb +0 -23
  49. data/java/src/json/ext/ByteListTranscoder.java +0 -166
  50. data/java/src/json/ext/Generator.java +0 -446
  51. data/java/src/json/ext/GeneratorMethods.java +0 -231
  52. data/java/src/json/ext/GeneratorService.java +0 -42
  53. data/java/src/json/ext/GeneratorState.java +0 -542
  54. data/java/src/json/ext/OptionsReader.java +0 -113
  55. data/java/src/json/ext/Parser.java +0 -2644
  56. data/java/src/json/ext/Parser.rl +0 -968
  57. data/java/src/json/ext/ParserService.java +0 -34
  58. data/java/src/json/ext/RuntimeInfo.java +0 -120
  59. data/java/src/json/ext/StringDecoder.java +0 -166
  60. data/java/src/json/ext/StringEncoder.java +0 -111
  61. data/java/src/json/ext/Utils.java +0 -88
  62. data/json-java.gemspec +0 -38
  63. data/json_pure.gemspec +0 -37
  64. data/lib/json/ext/.keep +0 -0
  65. data/tests/fixtures/fail1.json +0 -1
  66. data/tests/fixtures/fail10.json +0 -1
  67. data/tests/fixtures/fail11.json +0 -1
  68. data/tests/fixtures/fail12.json +0 -1
  69. data/tests/fixtures/fail13.json +0 -1
  70. data/tests/fixtures/fail14.json +0 -1
  71. data/tests/fixtures/fail18.json +0 -1
  72. data/tests/fixtures/fail19.json +0 -1
  73. data/tests/fixtures/fail2.json +0 -1
  74. data/tests/fixtures/fail20.json +0 -1
  75. data/tests/fixtures/fail21.json +0 -1
  76. data/tests/fixtures/fail22.json +0 -1
  77. data/tests/fixtures/fail23.json +0 -1
  78. data/tests/fixtures/fail24.json +0 -1
  79. data/tests/fixtures/fail25.json +0 -1
  80. data/tests/fixtures/fail27.json +0 -2
  81. data/tests/fixtures/fail28.json +0 -2
  82. data/tests/fixtures/fail3.json +0 -1
  83. data/tests/fixtures/fail4.json +0 -1
  84. data/tests/fixtures/fail5.json +0 -1
  85. data/tests/fixtures/fail6.json +0 -1
  86. data/tests/fixtures/fail7.json +0 -1
  87. data/tests/fixtures/fail8.json +0 -1
  88. data/tests/fixtures/fail9.json +0 -1
  89. data/tests/fixtures/pass1.json +0 -56
  90. data/tests/fixtures/pass15.json +0 -1
  91. data/tests/fixtures/pass16.json +0 -1
  92. data/tests/fixtures/pass17.json +0 -1
  93. data/tests/fixtures/pass2.json +0 -1
  94. data/tests/fixtures/pass26.json +0 -1
  95. data/tests/fixtures/pass3.json +0 -6
  96. data/tests/setup_variant.rb +0 -11
  97. data/tests/test_json.rb +0 -519
  98. data/tests/test_json_addition.rb +0 -196
  99. data/tests/test_json_encoding.rb +0 -65
  100. data/tests/test_json_fixtures.rb +0 -35
  101. data/tests/test_json_generate.rb +0 -348
  102. data/tests/test_json_generic_object.rb +0 -75
  103. data/tests/test_json_string_matching.rb +0 -39
  104. data/tests/test_json_unicode.rb +0 -72
  105. data/tools/diff.sh +0 -18
  106. data/tools/fuzz.rb +0 -139
  107. data/tools/server.rb +0 -62
metadata CHANGED
@@ -1,43 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2017-01-13 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: test-unit
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
10
+ date: 2024-04-04 00:00:00.000000000 Z
11
+ dependencies: []
41
12
  description: This is a JSON implementation as a Ruby extension in C.
42
13
  email: flori@ping.de
43
14
  executables: []
@@ -48,27 +19,9 @@ extensions:
48
19
  extra_rdoc_files:
49
20
  - README.md
50
21
  files:
51
- - "./tests/test_json.rb"
52
- - "./tests/test_json_addition.rb"
53
- - "./tests/test_json_encoding.rb"
54
- - "./tests/test_json_fixtures.rb"
55
- - "./tests/test_json_generate.rb"
56
- - "./tests/test_json_generic_object.rb"
57
- - "./tests/test_json_string_matching.rb"
58
- - "./tests/test_json_unicode.rb"
59
- - ".gitignore"
60
- - ".travis.yml"
61
- - CHANGES
62
- - Gemfile
63
- - README-json-jruby.markdown
22
+ - CHANGES.md
23
+ - LICENSE
64
24
  - README.md
65
- - Rakefile
66
- - TODO
67
- - VERSION
68
- - data/example.json
69
- - data/index.html
70
- - data/prototype.js
71
- - diagrams/.keep
72
25
  - ext/json/ext/fbuffer/fbuffer.h
73
26
  - ext/json/ext/generator/depend
74
27
  - ext/json/ext/generator/extconf.rb
@@ -80,23 +33,7 @@ files:
80
33
  - ext/json/ext/parser/parser.h
81
34
  - ext/json/ext/parser/parser.rl
82
35
  - ext/json/extconf.rb
83
- - install.rb
84
- - java/src/json/ext/ByteListTranscoder.java
85
- - java/src/json/ext/Generator.java
86
- - java/src/json/ext/GeneratorMethods.java
87
- - java/src/json/ext/GeneratorService.java
88
- - java/src/json/ext/GeneratorState.java
89
- - java/src/json/ext/OptionsReader.java
90
- - java/src/json/ext/Parser.java
91
- - java/src/json/ext/Parser.rl
92
- - java/src/json/ext/ParserService.java
93
- - java/src/json/ext/RuntimeInfo.java
94
- - java/src/json/ext/StringDecoder.java
95
- - java/src/json/ext/StringEncoder.java
96
- - java/src/json/ext/Utils.java
97
- - json-java.gemspec
98
36
  - json.gemspec
99
- - json_pure.gemspec
100
37
  - lib/json.rb
101
38
  - lib/json/add/bigdecimal.rb
102
39
  - lib/json/add/complex.rb
@@ -108,68 +45,30 @@ files:
108
45
  - lib/json/add/range.rb
109
46
  - lib/json/add/rational.rb
110
47
  - lib/json/add/regexp.rb
48
+ - lib/json/add/set.rb
111
49
  - lib/json/add/struct.rb
112
50
  - lib/json/add/symbol.rb
113
51
  - lib/json/add/time.rb
114
52
  - lib/json/common.rb
115
53
  - lib/json/ext.rb
116
- - lib/json/ext/.keep
117
54
  - lib/json/generic_object.rb
118
55
  - lib/json/pure.rb
119
56
  - lib/json/pure/generator.rb
120
57
  - lib/json/pure/parser.rb
121
58
  - lib/json/version.rb
122
- - tests/fixtures/fail1.json
123
- - tests/fixtures/fail10.json
124
- - tests/fixtures/fail11.json
125
- - tests/fixtures/fail12.json
126
- - tests/fixtures/fail13.json
127
- - tests/fixtures/fail14.json
128
- - tests/fixtures/fail18.json
129
- - tests/fixtures/fail19.json
130
- - tests/fixtures/fail2.json
131
- - tests/fixtures/fail20.json
132
- - tests/fixtures/fail21.json
133
- - tests/fixtures/fail22.json
134
- - tests/fixtures/fail23.json
135
- - tests/fixtures/fail24.json
136
- - tests/fixtures/fail25.json
137
- - tests/fixtures/fail27.json
138
- - tests/fixtures/fail28.json
139
- - tests/fixtures/fail3.json
140
- - tests/fixtures/fail4.json
141
- - tests/fixtures/fail5.json
142
- - tests/fixtures/fail6.json
143
- - tests/fixtures/fail7.json
144
- - tests/fixtures/fail8.json
145
- - tests/fixtures/fail9.json
146
- - tests/fixtures/pass1.json
147
- - tests/fixtures/pass15.json
148
- - tests/fixtures/pass16.json
149
- - tests/fixtures/pass17.json
150
- - tests/fixtures/pass2.json
151
- - tests/fixtures/pass26.json
152
- - tests/fixtures/pass3.json
153
- - tests/setup_variant.rb
154
- - tests/test_json.rb
155
- - tests/test_json_addition.rb
156
- - tests/test_json_encoding.rb
157
- - tests/test_json_fixtures.rb
158
- - tests/test_json_generate.rb
159
- - tests/test_json_generic_object.rb
160
- - tests/test_json_string_matching.rb
161
- - tests/test_json_unicode.rb
162
- - tools/diff.sh
163
- - tools/fuzz.rb
164
- - tools/server.rb
165
- homepage: http://flori.github.com/json
59
+ homepage: https://flori.github.io/json
166
60
  licenses:
167
61
  - Ruby
168
- metadata: {}
169
- post_install_message:
62
+ metadata:
63
+ bug_tracker_uri: https://github.com/flori/json/issues
64
+ changelog_uri: https://github.com/flori/json/blob/master/CHANGES.md
65
+ documentation_uri: https://flori.github.io/json/doc/index.html
66
+ homepage_uri: https://flori.github.io/json
67
+ source_code_uri: https://github.com/flori/json
68
+ wiki_uri: https://github.com/flori/json/wiki
170
69
  rdoc_options:
171
70
  - "--title"
172
- - JSON implemention for Ruby
71
+ - JSON implementation for Ruby
173
72
  - "--main"
174
73
  - README.md
175
74
  require_paths:
@@ -178,24 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
77
  requirements:
179
78
  - - ">="
180
79
  - !ruby/object:Gem::Version
181
- version: '0'
80
+ version: '2.3'
182
81
  required_rubygems_version: !ruby/object:Gem::Requirement
183
82
  requirements:
184
83
  - - ">="
185
84
  - !ruby/object:Gem::Version
186
85
  version: '0'
187
86
  requirements: []
188
- rubyforge_project:
189
- rubygems_version: 2.6.8
190
- signing_key:
87
+ rubygems_version: 3.6.0.dev
191
88
  specification_version: 4
192
89
  summary: JSON Implementation for Ruby
193
- test_files:
194
- - "./tests/test_json.rb"
195
- - "./tests/test_json_addition.rb"
196
- - "./tests/test_json_encoding.rb"
197
- - "./tests/test_json_fixtures.rb"
198
- - "./tests/test_json_generate.rb"
199
- - "./tests/test_json_generic_object.rb"
200
- - "./tests/test_json_string_matching.rb"
201
- - "./tests/test_json_unicode.rb"
90
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +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
data/.travis.yml DELETED
@@ -1,18 +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
- - 1.9.3
8
- - 2.0.0
9
- - 2.1
10
- - 2.2
11
- - 2.3.3
12
- - 2.4.0
13
- matrix:
14
- include:
15
- - rvm: jruby
16
- env: JRUBY_OPTS="--2.0"
17
- script: "bundle exec rake"
18
- sudo: false
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- # vim: set ft=ruby:
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec :name => 'json'
6
- gemspec :name => 'json_pure'
7
- #gemspec :name => 'json-java'
@@ -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,402 +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
- MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
27
- BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
28
- PKG_NAME = 'json'
29
- PKG_TITLE = 'JSON Implementation for Ruby'
30
- PKG_VERSION = File.read('VERSION').chomp
31
- PKG_FILES = FileList[`git ls-files`.split(/\n/)]
32
-
33
- EXT_ROOT_DIR = 'ext/json/ext'
34
- EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
35
- EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
36
- RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
37
- EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
38
- EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
39
- EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
40
- EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
41
-
42
- JAVA_DIR = "java/src/json/ext"
43
- JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl"
44
- JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
45
- JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
46
- JAVA_CLASSES = []
47
- JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
48
- JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
49
-
50
- RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
51
- RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
52
-
53
- desc "Installing library (pure)"
54
- task :install_pure => :version do
55
- ruby 'install.rb'
56
- end
57
-
58
- task :install_ext_really do
59
- sitearchdir = CONFIG["sitearchdir"]
60
- cd 'ext' do
61
- for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
62
- d = File.join(sitearchdir, file)
63
- mkdir_p File.dirname(d)
64
- install(file, d)
65
- end
66
- warn " *** Installed EXT ruby library."
67
- end
68
- end
69
-
70
- desc "Installing library (extension)"
71
- task :install_ext => [ :compile, :install_pure, :install_ext_really ]
72
-
73
- desc "Installing library (extension)"
74
- task :install => :install_ext
75
-
76
- if defined?(Gem) and defined?(Gem::PackageTask)
77
- spec_pure = Gem::Specification.new do |s|
78
- s.name = 'json_pure'
79
- s.version = PKG_VERSION
80
- s.summary = PKG_TITLE
81
- s.description = "This is a JSON implementation in pure Ruby."
82
-
83
- s.files = PKG_FILES
84
-
85
- s.require_path = 'lib'
86
- s.add_development_dependency 'rake'
87
- s.add_development_dependency 'test-unit', '~> 2.0'
88
-
89
- s.extra_rdoc_files << 'README.md'
90
- s.rdoc_options <<
91
- '--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
92
- s.test_files.concat Dir['./tests/test_*.rb']
93
-
94
- s.author = "Florian Frank"
95
- s.email = "flori@ping.de"
96
- s.homepage = "http://flori.github.com/#{PKG_NAME}"
97
- s.license = 'Ruby'
98
- end
99
-
100
- desc 'Creates a json_pure.gemspec file'
101
- task :gemspec_pure => :version do
102
- File.open('json_pure.gemspec', 'w') do |gemspec|
103
- gemspec.write spec_pure.to_ruby
104
- end
105
- end
106
-
107
- Gem::PackageTask.new(spec_pure) do |pkg|
108
- pkg.need_tar = true
109
- pkg.package_files = PKG_FILES
110
- end
111
-
112
- spec_ext = Gem::Specification.new do |s|
113
- s.name = 'json'
114
- s.version = PKG_VERSION
115
- s.summary = PKG_TITLE
116
- s.description = "This is a JSON implementation as a Ruby extension in C."
117
-
118
- s.files = PKG_FILES
119
-
120
- s.extensions = FileList['ext/**/extconf.rb']
121
-
122
- s.require_path = 'lib'
123
- s.add_development_dependency 'rake'
124
- s.add_development_dependency 'test-unit', '~> 2.0'
125
-
126
- s.extra_rdoc_files << 'README.md'
127
- s.rdoc_options <<
128
- '--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
129
- s.test_files.concat Dir['./tests/test_*.rb']
130
-
131
- s.author = "Florian Frank"
132
- s.email = "flori@ping.de"
133
- s.homepage = "http://flori.github.com/#{PKG_NAME}"
134
- s.license = 'Ruby'
135
- end
136
-
137
- desc 'Creates a json.gemspec file'
138
- task :gemspec_ext => :version do
139
- File.open('json.gemspec', 'w') do |gemspec|
140
- gemspec.write spec_ext.to_ruby
141
- end
142
- end
143
-
144
- Gem::PackageTask.new(spec_ext) do |pkg|
145
- pkg.need_tar = true
146
- pkg.package_files = PKG_FILES
147
- end
148
-
149
-
150
- desc 'Create all gemspec files'
151
- task :gemspec => [ :gemspec_pure, :gemspec_ext ]
152
- end
153
-
154
- desc m = "Writing version information for #{PKG_VERSION}"
155
- task :version do
156
- puts m
157
- File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v|
158
- v.puts <<EOT
159
- module JSON
160
- # JSON version
161
- VERSION = '#{PKG_VERSION}'
162
- VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
163
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
164
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
165
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
166
- end
167
- EOT
168
- end
169
- end
170
-
171
- desc "Testing library (pure ruby)"
172
- task :test_pure => [ :clean, :do_test_pure ]
173
-
174
- UndocumentedTestTask.new do |t|
175
- t.name = 'do_test_pure'
176
- t.libs << 'lib'
177
- t.test_files = FileList['tests/test_*.rb']
178
- t.verbose = true
179
- t.options = '-v'
180
- end
181
-
182
- desc "Testing library (pure ruby and extension)"
183
- task :test do
184
- sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
185
- sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
186
- end
187
-
188
- namespace :gems do
189
- desc 'Install all development gems'
190
- task :install do
191
- sh "#{BUNDLE}"
192
- end
193
- end
194
-
195
- if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
196
- if ENV.key?('JAVA_HOME')
197
- warn " *** JAVA_HOME was set to #{ENV['JAVA_HOME'].inspect}"
198
- elsif File.directory?(local_java = '/usr/local/java/jdk') ||
199
- File.directory?(local_java = '/usr/lib/jvm/java-6-openjdk')
200
- then
201
- ENV['JAVA_HOME'] = local_java
202
- end
203
- if ENV['JAVA_HOME']
204
- warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}"
205
- ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':'
206
- warn " *** java binaries are assumed to be in #{java_path.inspect}"
207
- else
208
- warn " *** JAVA_HOME was not set or could not be guessed!"
209
- exit 1
210
- end
211
-
212
- file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do
213
- cd JAVA_DIR do
214
- if RAGEL_CODEGEN == 'ragel'
215
- sh "ragel Parser.rl -J -o Parser.java"
216
- else
217
- sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
218
- end
219
- end
220
- end
221
-
222
- desc "Generate parser for java with ragel"
223
- task :ragel => JAVA_PARSER_SRC
224
-
225
- desc "Delete the ragel generated Java source"
226
- task :ragel_clean do
227
- rm_rf JAVA_PARSER_SRC
228
- end
229
-
230
- JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar")
231
- if File.exist?(JRUBY_JAR)
232
- JAVA_SOURCES.each do |src|
233
- classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
234
- obj = src.sub(/\.java\Z/, '.class')
235
- file obj => src do
236
- sh 'javac', '-classpath', classpath, '-source', '1.5', '-target', '1.5', src
237
- end
238
- JAVA_CLASSES << obj
239
- end
240
- else
241
- warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!"
242
- end
243
-
244
- desc "Compiling jruby extension"
245
- task :compile => JAVA_CLASSES
246
-
247
- desc "Package the jruby gem"
248
- task :jruby_gem => :create_jar do
249
- sh 'gem build json-java.gemspec'
250
- mkdir_p 'pkg'
251
- mv "json-#{PKG_VERSION}-java.gem", 'pkg'
252
- end
253
-
254
- desc "Testing library (jruby)"
255
- task :test_ext => [ :create_jar, :do_test_ext ]
256
-
257
- UndocumentedTestTask.new do |t|
258
- t.name = 'do_test_ext'
259
- t.libs << 'lib'
260
- t.test_files = FileList['tests/test_*.rb']
261
- t.verbose = true
262
- t.options = '-v'
263
- end
264
-
265
- file JRUBY_PARSER_JAR => :compile do
266
- cd 'java/src' do
267
- parser_classes = FileList[
268
- "json/ext/ByteListTranscoder*.class",
269
- "json/ext/OptionsReader*.class",
270
- "json/ext/Parser*.class",
271
- "json/ext/RuntimeInfo*.class",
272
- "json/ext/StringDecoder*.class",
273
- "json/ext/Utils*.class"
274
- ]
275
- sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes
276
- mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR)
277
- end
278
- end
279
-
280
- desc "Create parser jar"
281
- task :create_parser_jar => JRUBY_PARSER_JAR
282
-
283
- file JRUBY_GENERATOR_JAR => :compile do
284
- cd 'java/src' do
285
- generator_classes = FileList[
286
- "json/ext/ByteListTranscoder*.class",
287
- "json/ext/OptionsReader*.class",
288
- "json/ext/Generator*.class",
289
- "json/ext/RuntimeInfo*.class",
290
- "json/ext/StringEncoder*.class",
291
- "json/ext/Utils*.class"
292
- ]
293
- sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes
294
- mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR)
295
- end
296
- end
297
-
298
- desc "Create generator jar"
299
- task :create_generator_jar => JRUBY_GENERATOR_JAR
300
-
301
- desc "Create parser and generator jars"
302
- task :create_jar => [ :create_parser_jar, :create_generator_jar ]
303
-
304
- desc "Build all gems and archives for a new release of the jruby extension."
305
- task :build => [ :clean, :version, :jruby_gem ]
306
-
307
- task :release => :build
308
- else
309
- desc "Compiling extension"
310
- task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
311
-
312
- file EXT_PARSER_DL => EXT_PARSER_SRC do
313
- cd EXT_PARSER_DIR do
314
- ruby 'extconf.rb'
315
- sh MAKE
316
- end
317
- cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
318
- end
319
-
320
- file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
321
- cd EXT_GENERATOR_DIR do
322
- ruby 'extconf.rb'
323
- sh MAKE
324
- end
325
- cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
326
- end
327
-
328
- desc "Testing library (extension)"
329
- task :test_ext => [ :compile, :do_test_ext ]
330
-
331
- UndocumentedTestTask.new do |t|
332
- t.name = 'do_test_ext'
333
- t.libs << 'ext' << 'lib'
334
- t.test_files = FileList['tests/test_*.rb']
335
- t.verbose = true
336
- t.options = '-v'
337
- end
338
-
339
- desc "Generate parser with ragel"
340
- task :ragel => EXT_PARSER_SRC
341
-
342
- desc "Delete the ragel generated C source"
343
- task :ragel_clean do
344
- rm_rf EXT_PARSER_SRC
345
- end
346
-
347
- desc "Update the tags file"
348
- task :tags do
349
- system 'ctags', *Dir['**/*.{rb,c,h,java}']
350
- end
351
-
352
- file EXT_PARSER_SRC => RAGEL_PATH do
353
- cd EXT_PARSER_DIR do
354
- if RAGEL_CODEGEN == 'ragel'
355
- sh "ragel parser.rl -G2 -o parser.c"
356
- else
357
- sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
358
- end
359
- src = File.read("parser.c").gsub(/[ \t]+$/, '')
360
- File.open("parser.c", "w") {|f| f.print src}
361
- end
362
- end
363
-
364
- desc "Generate diagrams of ragel parser (ps)"
365
- task :ragel_dot_ps do
366
- root = 'diagrams'
367
- specs = []
368
- File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
369
- for s in specs
370
- if RAGEL_DOTGEN == 'ragel'
371
- sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
372
- else
373
- sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
374
- end
375
- end
376
- end
377
-
378
- desc "Generate diagrams of ragel parser (png)"
379
- task :ragel_dot_png do
380
- root = 'diagrams'
381
- specs = []
382
- File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
383
- for s in specs
384
- if RAGEL_DOTGEN == 'ragel'
385
- sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
386
- else
387
- sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
388
- end
389
- end
390
- end
391
-
392
- desc "Generate diagrams of ragel parser"
393
- task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
394
-
395
- desc "Build all gems and archives for a new release of json and json_pure."
396
- task :build => [ :clean, :gemspec, :package ]
397
-
398
- task :release => :build
399
- end
400
-
401
- desc "Compile in the the source directory"
402
- task :default => [ :clean, :gemspec, :test ]
data/TODO DELETED
@@ -1 +0,0 @@
1
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.8.6
data/data/example.json DELETED
@@ -1 +0,0 @@
1
- {"a":2,"b":3.141,"TIME":"2007-03-14T11:52:40","c":"c","d":[1,"b",3.14],"COUNT":666,"e":{"foo":"bar"},"foo":"B\u00e4r","g":"\u677e\u672c\u884c\u5f18","h":1000.0,"bar":"\u00a9 \u2260 \u20ac!","i":0.001,"j":"\ud840\udc01"}