Skip to content

Commit 24b3425

Browse files
authored
Merge branch 'master' into jruby-ci
2 parents 9bd6b71 + ee70abf commit 24b3425

33 files changed

+751
-4536
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Gemfile.lock
1515
*/**/Makefile
1616
*/**/*.o
1717
.byebug_history
18+
*.log

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ language: ruby
44

55
# Specify which ruby versions you wish to run your tests on, each version will be used
66
rvm:
7-
- 1.9.3
87
- 2.0.0
98
- 2.1
109
- 2.2
1110
- 2.3
1211
- 2.4
1312
- 2.5
13+
- 2.6
14+
- 2.7.0-preview3
1415
- ruby-head
15-
- jruby-1.7 # Ruby 1.9.3
1616
- jruby-9.1 # Ruby 2.3
1717
- jruby-9.2 # Ruby 2.5
18-
before_install:
19-
- rvm @global @default do gem uninstall bundler -a -x --silent || true
20-
- gem install bundler -v '<2'
18+
- truffleruby
2119
matrix:
2220
allow_failures:
23-
- rvm: 1.9.3
2421
- rvm: ruby-head
22+
- rvm: jruby-9.1
23+
- rvm: jruby-9.2
24+
- rvm: truffleruby
2525
script: "bundle exec rake"
2626
sudo: false

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changes
22

3+
## 2019-02-21 (2.2.0)
4+
* Adds support for 2.6 BigDecimal and ruby standard library Set datetype.
5+
36
## 2017-04-18 (2.1.0)
47
* Allow passing of `decimal_class` option to specify a class as which to parse
58
JSON float numbers.

LICENSE

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Ruby is copyrighted free software by Yukihiro Matsumoto <[email protected]>.
2+
You can redistribute it and/or modify it under either the terms of the
3+
2-clause BSDL (see the file BSDL), or the conditions below:
4+
5+
1. You may make and give away verbatim copies of the source form of the
6+
software without restriction, provided that you duplicate all of the
7+
original copyright notices and associated disclaimers.
8+
9+
2. You may modify your copy of the software in any way, provided that
10+
you do at least ONE of the following:
11+
12+
a) place your modifications in the Public Domain or otherwise
13+
make them Freely Available, such as by posting said
14+
modifications to Usenet or an equivalent medium, or by allowing
15+
the author to include your modifications in the software.
16+
17+
b) use the modified software only within your corporation or
18+
organization.
19+
20+
c) give non-standard binaries non-standard names, with
21+
instructions on where to get the original software distribution.
22+
23+
d) make other distribution arrangements with the author.
24+
25+
3. You may distribute the software in object code or binary form,
26+
provided that you do at least ONE of the following:
27+
28+
a) distribute the binaries and library files of the software,
29+
together with instructions (in the manual page or equivalent)
30+
on where to get the original distribution.
31+
32+
b) accompany the distribution with the machine-readable source of
33+
the software.
34+
35+
c) give non-standard binaries non-standard names, with
36+
instructions on where to get the original software distribution.
37+
38+
d) make other distribution arrangements with the author.
39+
40+
4. You may modify and include the part of the software into any other
41+
software (possibly commercial). But some files in the distribution
42+
are not written by the author, so that they are not under these terms.
43+
44+
For the list of those files and their copying conditions, see the
45+
file LEGAL.
46+
47+
5. The scripts and library files supplied as input to or produced as
48+
output from the software do not automatically fall under the
49+
copyright of the software, but belong to whomever generated them,
50+
and may be sold commercially, and may be aggregated with this
51+
software.
52+
53+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56+
PURPOSE.

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ not been required yet.
156156
The JSON module doesn't extend `Exception` by default. If you convert an `Exception`
157157
object to JSON, it will by default only include the exception message.
158158

159-
To include the full details, you must either load the load the `json/add/core` mentioned
159+
To include the full details, you must either load the `json/add/core` mentioned
160160
above, or specifically load the exception addition:
161161

162162
```ruby
@@ -207,7 +207,7 @@ JSON representation later. In this case it's `Range`, but any namespace of
207207
the form `A::B` or `::A::B` will do. All other keys are arbitrary and can be
208208
used to store the necessary data to configure the object to be deserialised.
209209

210-
If a the key `json_class` is found in a JSON object, the JSON parser checks
210+
If the key `json_class` is found in a JSON object, the JSON parser checks
211211
if the given class responds to the `json_create` class method. If so, it is
212212
called with the JSON object converted to a Ruby hash. So a range can
213213
be deserialised by implementing `Range.json_create` like this:
@@ -390,6 +390,22 @@ Here are the median comparisons for completeness' sake:
390390
secs/call
391391
```
392392

393+
## Development
394+
395+
### Release
396+
397+
Update the json.gemspec and json-java.gemspec.
398+
399+
```
400+
rbenv shell 2.6.5
401+
rake build
402+
gem push pkg/json-2.3.0.gem
403+
404+
rbenv shell jruby-9.2.9.0
405+
rake build
406+
gem push pkg/json-2.3.0-java.gem
407+
```
408+
393409
## Author
394410

395411
Florian Frank <mailto:[email protected]>
@@ -406,4 +422,4 @@ The latest version of this library can be downloaded at
406422

407423
Online Documentation should be located at
408424

409-
* http://json.rubyforge.org
425+
* https://www.rubydoc.info/gems/json

Rakefile

Lines changed: 25 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ class UndocumentedTestTask < Rake::TestTask
2323
def desc(*) end
2424
end
2525

26-
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
27-
BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
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)
2833
PKG_NAME = 'json'
2934
PKG_TITLE = 'JSON Implementation for Ruby'
3035
PKG_VERSION = File.read('VERSION').chomp
@@ -47,8 +52,8 @@ JAVA_CLASSES = []
4752
JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
4853
JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
4954

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') }
55+
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find(&which)
56+
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find(&which)
5257

5358
desc "Installing library (pure)"
5459
task :install_pure => :version do
@@ -84,7 +89,7 @@ if defined?(Gem) and defined?(Gem::PackageTask)
8489

8590
s.require_path = 'lib'
8691
s.add_development_dependency 'rake'
87-
s.add_development_dependency 'test-unit', '~> 2.0'
92+
s.add_development_dependency 'test-unit', '>= 2.0', '< 4.0'
8893

8994
s.extra_rdoc_files << 'README.md'
9095
s.rdoc_options <<
@@ -95,13 +100,16 @@ if defined?(Gem) and defined?(Gem::PackageTask)
95100
s.email = "[email protected]"
96101
s.homepage = "http://flori.github.com/#{PKG_NAME}"
97102
s.license = 'Ruby'
98-
s.required_ruby_version = '>= 1.9'
103+
s.required_ruby_version = '>= 2.0'
99104
end
100105

101106
desc 'Creates a json_pure.gemspec file'
102107
task :gemspec_pure => :version do
103108
File.open('json_pure.gemspec', 'w') do |gemspec|
104-
gemspec.write spec_pure.to_ruby
109+
src = spec_pure.to_ruby
110+
src.gsub!(/# stub:.*/, "# This gemspec is generated automatically using `rake gemspec`.\n" \
111+
"# Do not modify directly.")
112+
gemspec.write src
105113
end
106114
end
107115

@@ -110,47 +118,8 @@ if defined?(Gem) and defined?(Gem::PackageTask)
110118
pkg.package_files = PKG_FILES
111119
end
112120

113-
spec_ext = Gem::Specification.new do |s|
114-
s.name = 'json'
115-
s.version = PKG_VERSION
116-
s.summary = PKG_TITLE
117-
s.description = "This is a JSON implementation as a Ruby extension in C."
118-
119-
s.files = PKG_FILES
120-
121-
s.extensions = FileList['ext/**/extconf.rb']
122-
123-
s.require_path = 'lib'
124-
s.add_development_dependency 'rake'
125-
s.add_development_dependency 'test-unit', '~> 2.0'
126-
127-
s.extra_rdoc_files << 'README.md'
128-
s.rdoc_options <<
129-
'--title' << 'JSON implemention for Ruby' << '--main' << 'README.md'
130-
s.test_files.concat Dir['./tests/test_*.rb']
131-
132-
s.author = "Florian Frank"
133-
s.email = "[email protected]"
134-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
135-
s.license = 'Ruby'
136-
s.required_ruby_version = '>= 1.9'
137-
end
138-
139-
desc 'Creates a json.gemspec file'
140-
task :gemspec_ext => :version do
141-
File.open('json.gemspec', 'w') do |gemspec|
142-
gemspec.write spec_ext.to_ruby
143-
end
144-
end
145-
146-
Gem::PackageTask.new(spec_ext) do |pkg|
147-
pkg.need_tar = true
148-
pkg.package_files = PKG_FILES
149-
end
150-
151-
152-
desc 'Create all gemspec files'
153-
task :gemspec => [ :gemspec_pure, :gemspec_ext ]
121+
desc 'Alias for gemspec_pure'
122+
task :gemspec => [ :gemspec_pure ]
154123
end
155124

156125
desc m = "Writing version information for #{PKG_VERSION}"
@@ -176,7 +145,8 @@ task :check_env do
176145
end
177146

178147
desc "Testing library (pure ruby)"
179-
task :test_pure => [ :clean, :check_env, :do_test_pure ]
148+
task :test_pure => [ :set_env_pure, :check_env, :do_test_pure ]
149+
task(:set_env_pure) { ENV['JSON'] = 'pure' }
180150

181151
UndocumentedTestTask.new do |t|
182152
t.name = 'do_test_pure'
@@ -187,10 +157,7 @@ UndocumentedTestTask.new do |t|
187157
end
188158

189159
desc "Testing library (pure ruby and extension)"
190-
task :test do
191-
sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
192-
sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
193-
end
160+
task :test => [ :test_pure, :test_ext ]
194161

195162
namespace :gems do
196163
desc 'Install all development gems'
@@ -238,7 +205,7 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
238205
classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
239206
obj = src.sub(/\.java\Z/, '.class')
240207
file obj => src do
241-
sh 'javac', '-classpath', classpath, '-source', '1.5', '-target', '1.5', src
208+
sh 'javac', '-classpath', classpath, '-source', '1.6', '-target', '1.6', src
242209
end
243210
JAVA_CLASSES << obj
244211
end
@@ -257,7 +224,8 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
257224
end
258225

259226
desc "Testing library (jruby)"
260-
task :test_ext => [ :check_env, :create_jar, :do_test_ext ]
227+
task :test_ext => [ :set_env_ext, :create_jar, :check_env, :do_test_ext ]
228+
task(:set_env_ext) { ENV['JSON'] = 'ext' }
261229

262230
UndocumentedTestTask.new do |t|
263231
t.name = 'do_test_ext'
@@ -363,6 +331,8 @@ else
363331
end
364332
src = File.read("parser.c").gsub(/[ \t]+$/, '')
365333
src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};')
334+
src.gsub!(/0 <= \(\*p\) && \(\*p\) <= 31/, "0 <= (signed char)(*p) && (*p) <= 31")
335+
src[0, 0] = "/* This file is automatically generated from parser.rl by using ragel */"
366336
File.open("parser.c", "w") {|f| f.print src}
367337
end
368338
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.3.0

data/example.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

data/index.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)