json 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b5241427373f8f03f7faa96afdec132dcb7601f2e9cce4903ce0879c208bc3f
4
- data.tar.gz: 7e3e820aae7a8036affec28ce44f4aadeebfd74b4bea85ad2d597eb42e82b745
3
+ metadata.gz: 69d9ea2a14a3aa9fdbbe8d44b02f9b9e1968c05a9312326e5277651a242f18da
4
+ data.tar.gz: 9f5c2d99d45d8a187eacc0d2257c2402bccc535af476a5562ddd71f5fe21bbd1
5
5
  SHA512:
6
- metadata.gz: e0f403e2c458aa86f820671726a92f4798703240099417a22e5d489d140f53d48559560d6603547f2a0f07aa0595fb383c4b1b2c53e1df1b34e16df2ca4ea480
7
- data.tar.gz: 5e0f19fe6c8c086adbe499b85bb49c1b5f14697cb63ed8d7fd96d82e8504806eb0b016f8e2a556ec7eab5443beddc8109d2ef5921bd3ac54eedf45056218924b
6
+ metadata.gz: 8865e45a1d7c71030ab0ce49399c474bf451d3542acd46bdacd063082f7b8be45b8d32dcbc04867bff2d2cc15545f1284a11a5c60e5da27f53bdee7936c34add
7
+ data.tar.gz: 467b3e5615b29991d0c35889c4a7e86e69ea253c58d64a1a40d933ea5fa1bcf38b67e3d3941b109f972ce454bec4226119edafba1a3248a028c36a508cbbd4e4
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
@@ -12,18 +12,13 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb", "ext/json/extconf.rb"]
14
14
  s.extra_rdoc_files = ["README.md"]
15
- s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.md"]
15
+ s.rdoc_options = ["--title", "JSON implementation for Ruby", "--main", "README.md"]
16
16
  s.files = [
17
- ".gitignore",
18
- ".travis.yml",
19
17
  "CHANGES.md",
20
18
  "Gemfile",
21
19
  "LICENSE",
22
- "README-json-jruby.md",
23
20
  "README.md",
24
- "Rakefile",
25
21
  "VERSION",
26
- "diagrams/.keep",
27
22
  "ext/json/ext/fbuffer/fbuffer.h",
28
23
  "ext/json/ext/generator/depend",
29
24
  "ext/json/ext/generator/extconf.rb",
@@ -35,23 +30,7 @@ Gem::Specification.new do |s|
35
30
  "ext/json/ext/parser/parser.h",
36
31
  "ext/json/ext/parser/parser.rl",
37
32
  "ext/json/extconf.rb",
38
- "install.rb",
39
- "java/src/json/ext/ByteListTranscoder.java",
40
- "java/src/json/ext/Generator.java",
41
- "java/src/json/ext/GeneratorMethods.java",
42
- "java/src/json/ext/GeneratorService.java",
43
- "java/src/json/ext/GeneratorState.java",
44
- "java/src/json/ext/OptionsReader.java",
45
- "java/src/json/ext/Parser.java",
46
- "java/src/json/ext/Parser.rl",
47
- "java/src/json/ext/ParserService.java",
48
- "java/src/json/ext/RuntimeInfo.java",
49
- "java/src/json/ext/StringDecoder.java",
50
- "java/src/json/ext/StringEncoder.java",
51
- "java/src/json/ext/Utils.java",
52
- "json-java.gemspec",
53
33
  "json.gemspec",
54
- "json_pure.gemspec",
55
34
  "lib/json.rb",
56
35
  "lib/json/add/bigdecimal.rb",
57
36
  "lib/json/add/complex.rb",
@@ -75,53 +54,7 @@ Gem::Specification.new do |s|
75
54
  "lib/json/pure/generator.rb",
76
55
  "lib/json/pure/parser.rb",
77
56
  "lib/json/version.rb",
78
- "references/rfc7159.txt",
79
- "tests/fixtures/fail10.json",
80
- "tests/fixtures/fail11.json",
81
- "tests/fixtures/fail12.json",
82
- "tests/fixtures/fail13.json",
83
- "tests/fixtures/fail14.json",
84
- "tests/fixtures/fail18.json",
85
- "tests/fixtures/fail19.json",
86
- "tests/fixtures/fail2.json",
87
- "tests/fixtures/fail20.json",
88
- "tests/fixtures/fail21.json",
89
- "tests/fixtures/fail22.json",
90
- "tests/fixtures/fail23.json",
91
- "tests/fixtures/fail24.json",
92
- "tests/fixtures/fail25.json",
93
- "tests/fixtures/fail27.json",
94
- "tests/fixtures/fail28.json",
95
- "tests/fixtures/fail3.json",
96
- "tests/fixtures/fail4.json",
97
- "tests/fixtures/fail5.json",
98
- "tests/fixtures/fail6.json",
99
- "tests/fixtures/fail7.json",
100
- "tests/fixtures/fail8.json",
101
- "tests/fixtures/fail9.json",
102
- "tests/fixtures/obsolete_fail1.json",
103
- "tests/fixtures/pass1.json",
104
- "tests/fixtures/pass15.json",
105
- "tests/fixtures/pass16.json",
106
- "tests/fixtures/pass17.json",
107
- "tests/fixtures/pass2.json",
108
- "tests/fixtures/pass26.json",
109
- "tests/fixtures/pass3.json",
110
- "tests/json_addition_test.rb",
111
- "tests/json_common_interface_test.rb",
112
- "tests/json_encoding_test.rb",
113
- "tests/json_ext_parser_test.rb",
114
- "tests/json_fixtures_test.rb",
115
- "tests/json_generator_test.rb",
116
- "tests/json_generic_object_test.rb",
117
- "tests/json_parser_test.rb",
118
- "tests/json_string_matching_test.rb",
119
- "tests/test_helper.rb",
120
- "tests/test_helper.rb",
121
- "tools/diff.sh",
122
- "tools/fuzz.rb",
123
- "tools/server.rb",
124
- ]
57
+ ] + Dir["tests/**/*"]
125
58
  s.homepage = "http://flori.github.com/json"
126
59
  s.metadata = {
127
60
  'bug_tracker_uri' => 'https://github.com/flori/json/issues',
@@ -135,6 +68,6 @@ Gem::Specification.new do |s|
135
68
  s.required_ruby_version = Gem::Requirement.new(">= 2.0")
136
69
  s.test_files = ["tests/test_helper.rb"]
137
70
 
138
- s.add_development_dependency("rake", [">= 0"])
139
- s.add_development_dependency("test-unit", [">= 2.0", "< 4.0"])
71
+ s.add_development_dependency "rake"
72
+ s.add_development_dependency "test-unit"
140
73
  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
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 as a Ruby extension in C.
48
42
  email: flori@ping.de
49
43
  executables: []
@@ -54,16 +48,11 @@ extensions:
54
48
  extra_rdoc_files:
55
49
  - README.md
56
50
  files:
57
- - ".gitignore"
58
- - ".travis.yml"
59
51
  - CHANGES.md
60
52
  - Gemfile
61
53
  - LICENSE
62
- - README-json-jruby.md
63
54
  - README.md
64
- - Rakefile
65
55
  - VERSION
66
- - diagrams/.keep
67
56
  - ext/json/ext/fbuffer/fbuffer.h
68
57
  - ext/json/ext/generator/depend
69
58
  - ext/json/ext/generator/extconf.rb
@@ -75,23 +64,7 @@ files:
75
64
  - ext/json/ext/parser/parser.h
76
65
  - ext/json/ext/parser/parser.rl
77
66
  - ext/json/extconf.rb
78
- - install.rb
79
- - java/src/json/ext/ByteListTranscoder.java
80
- - java/src/json/ext/Generator.java
81
- - java/src/json/ext/GeneratorMethods.java
82
- - java/src/json/ext/GeneratorService.java
83
- - java/src/json/ext/GeneratorState.java
84
- - java/src/json/ext/OptionsReader.java
85
- - java/src/json/ext/Parser.java
86
- - java/src/json/ext/Parser.rl
87
- - java/src/json/ext/ParserService.java
88
- - java/src/json/ext/RuntimeInfo.java
89
- - java/src/json/ext/StringDecoder.java
90
- - java/src/json/ext/StringEncoder.java
91
- - java/src/json/ext/Utils.java
92
- - json-java.gemspec
93
67
  - json.gemspec
94
- - json_pure.gemspec
95
68
  - lib/json.rb
96
69
  - lib/json/add/bigdecimal.rb
97
70
  - lib/json/add/complex.rb
@@ -115,7 +88,6 @@ files:
115
88
  - lib/json/pure/generator.rb
116
89
  - lib/json/pure/parser.rb
117
90
  - lib/json/version.rb
118
- - references/rfc7159.txt
119
91
  - tests/fixtures/fail10.json
120
92
  - tests/fixtures/fail11.json
121
93
  - tests/fixtures/fail12.json
@@ -132,7 +104,11 @@ files:
132
104
  - tests/fixtures/fail25.json
133
105
  - tests/fixtures/fail27.json
134
106
  - tests/fixtures/fail28.json
107
+ - tests/fixtures/fail29.json
135
108
  - tests/fixtures/fail3.json
109
+ - tests/fixtures/fail30.json
110
+ - tests/fixtures/fail31.json
111
+ - tests/fixtures/fail32.json
136
112
  - tests/fixtures/fail4.json
137
113
  - tests/fixtures/fail5.json
138
114
  - tests/fixtures/fail6.json
@@ -157,9 +133,6 @@ files:
157
133
  - tests/json_parser_test.rb
158
134
  - tests/json_string_matching_test.rb
159
135
  - tests/test_helper.rb
160
- - tools/diff.sh
161
- - tools/fuzz.rb
162
- - tools/server.rb
163
136
  homepage: http://flori.github.com/json
164
137
  licenses:
165
138
  - Ruby
@@ -173,7 +146,7 @@ metadata:
173
146
  post_install_message:
174
147
  rdoc_options:
175
148
  - "--title"
176
- - JSON implemention for Ruby
149
+ - JSON implementation for Ruby
177
150
  - "--main"
178
151
  - README.md
179
152
  require_paths:
@@ -189,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
162
  - !ruby/object:Gem::Version
190
163
  version: '0'
191
164
  requirements: []
192
- rubygems_version: 3.1.4
165
+ rubygems_version: 3.2.1
193
166
  signing_key:
194
167
  specification_version: 4
195
168
  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 ]