json_pure 1.0.0 → 1.4.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.
- data/CHANGES +155 -1
- data/COPYING +58 -0
- data/GPL +7 -7
- data/README +324 -45
- data/Rakefile +166 -124
- data/TODO +1 -1
- data/VERSION +1 -1
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/benchmarks/generator2_benchmark.rb +222 -0
- data/benchmarks/generator_benchmark.rb +224 -0
- data/benchmarks/ohai.json +1216 -0
- data/benchmarks/ohai.ruby +1 -0
- data/benchmarks/parser2_benchmark.rb +251 -0
- data/benchmarks/parser_benchmark.rb +259 -0
- data/bin/edit_json.rb +1 -3
- data/bin/prettify_json.rb +75 -0
- data/data/index.html +5 -4
- data/data/prototype.js +2764 -1095
- data/ext/json/ext/generator/extconf.rb +14 -3
- data/ext/json/ext/generator/generator.c +1022 -334
- data/ext/json/ext/generator/generator.h +197 -0
- data/ext/json/ext/parser/extconf.rb +9 -3
- data/ext/json/ext/parser/parser.c +961 -577
- data/ext/json/ext/parser/parser.h +71 -0
- data/ext/json/ext/parser/parser.rl +400 -123
- data/install.rb +0 -0
- data/lib/json/add/core.rb +148 -0
- data/lib/json/add/rails.rb +58 -0
- data/lib/json/common.rb +254 -47
- data/lib/json/editor.rb +236 -72
- data/lib/json/ext.rb +2 -0
- data/lib/json/pure/generator.rb +235 -117
- data/lib/json/pure/parser.rb +124 -25
- data/lib/json/pure.rb +5 -3
- data/lib/json/version.rb +1 -1
- data/lib/json.rb +2 -197
- data/tests/fixtures/fail18.json +1 -0
- data/tests/test_json.rb +181 -22
- data/tests/test_json_addition.rb +84 -16
- data/tests/test_json_encoding.rb +68 -0
- data/tests/test_json_fixtures.rb +9 -5
- data/tests/test_json_generate.rb +114 -14
- data/tests/test_json_rails.rb +144 -0
- data/tests/test_json_unicode.rb +35 -14
- data/tools/fuzz.rb +13 -7
- data/tools/server.rb +0 -1
- metadata +156 -122
- data/benchmarks/benchmark.txt +0 -133
- data/benchmarks/benchmark_generator.rb +0 -44
- data/benchmarks/benchmark_parser.rb +0 -22
- data/benchmarks/benchmark_rails.rb +0 -26
- data/ext/json/ext/generator/Makefile +0 -149
- data/ext/json/ext/generator/unicode.c +0 -184
- data/ext/json/ext/generator/unicode.h +0 -40
- data/ext/json/ext/parser/Makefile +0 -149
- data/ext/json/ext/parser/unicode.c +0 -156
- data/ext/json/ext/parser/unicode.h +0 -44
- data/tests/fixtures/pass18.json +0 -1
- data/tests/runner.rb +0 -24
- /data/tests/fixtures/{fail15.json → pass15.json} +0 -0
- /data/tests/fixtures/{fail16.json → pass16.json} +0 -0
- /data/tests/fixtures/{fail17.json → pass17.json} +0 -0
- /data/tests/fixtures/{fail26.json → pass26.json} +0 -0
data/Rakefile
CHANGED
|
@@ -1,33 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
require 'rake/gempackagetask'
|
|
3
|
-
|
|
1
|
+
begin
|
|
2
|
+
require 'rake/gempackagetask'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
require 'rake/extensiontask'
|
|
8
|
+
rescue LoadError
|
|
9
|
+
puts "WARNING: rake-compiler is not installed. You will not be able to build the json gem until you install it."
|
|
10
|
+
end
|
|
4
11
|
|
|
5
12
|
require 'rbconfig'
|
|
6
13
|
include Config
|
|
7
14
|
|
|
15
|
+
require 'rake/clean'
|
|
16
|
+
CLOBBER.include Dir['benchmarks/data/*.{dat,log}'], FileList['**/*.rbc']
|
|
17
|
+
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
|
|
18
|
+
FileList["ext/**/{Makefile,mkmf.log}"],
|
|
19
|
+
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"]
|
|
20
|
+
|
|
21
|
+
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
|
|
8
22
|
PKG_NAME = 'json'
|
|
23
|
+
PKG_TITLE = 'JSON Implementation for Ruby'
|
|
9
24
|
PKG_VERSION = File.read('VERSION').chomp
|
|
10
|
-
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|coverage
|
|
25
|
+
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
|
|
11
26
|
EXT_ROOT_DIR = 'ext/json/ext'
|
|
12
27
|
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
|
|
13
|
-
EXT_PARSER_DL = "#{
|
|
28
|
+
EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
|
|
14
29
|
EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
|
|
15
30
|
PKG_FILES << EXT_PARSER_SRC
|
|
16
31
|
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
|
17
|
-
EXT_GENERATOR_DL = "#{
|
|
32
|
+
EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
|
|
18
33
|
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
|
19
|
-
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd].find { |c| system(c, '-v') }
|
|
34
|
+
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
|
35
|
+
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
|
20
36
|
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
|
|
38
|
+
def myruby(*args, &block)
|
|
39
|
+
@myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
|
|
40
|
+
options = (Hash === args.last) ? args.pop : {}
|
|
41
|
+
if args.length > 1 then
|
|
42
|
+
sh(*([@myruby] + args + [options]), &block)
|
|
43
|
+
else
|
|
44
|
+
sh("#{@myruby} #{args.first}", options, &block)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
23
47
|
|
|
24
48
|
desc "Installing library (pure)"
|
|
25
49
|
task :install_pure => :version do
|
|
26
|
-
|
|
50
|
+
myruby 'install.rb'
|
|
27
51
|
end
|
|
28
52
|
|
|
29
|
-
|
|
30
|
-
task :install_ext => [ :compile, :install_pure ] do
|
|
53
|
+
task :install_ext_really do
|
|
31
54
|
sitearchdir = CONFIG["sitearchdir"]
|
|
32
55
|
cd 'ext' do
|
|
33
56
|
for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
|
|
@@ -38,23 +61,31 @@ task :install_ext => [ :compile, :install_pure ] do
|
|
|
38
61
|
end
|
|
39
62
|
end
|
|
40
63
|
|
|
41
|
-
|
|
64
|
+
desc "Installing library (extension)"
|
|
65
|
+
task :install_ext => [ :compile_ext, :install_pure, :install_ext_really ]
|
|
66
|
+
|
|
67
|
+
desc "Installing library (extension)"
|
|
68
|
+
if RUBY_PLATFORM =~ /java/
|
|
69
|
+
task :install => :install_pure
|
|
70
|
+
else
|
|
71
|
+
task :install => :install_ext
|
|
72
|
+
end
|
|
42
73
|
|
|
43
74
|
desc "Compiling extension"
|
|
44
|
-
task :
|
|
75
|
+
task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
|
|
45
76
|
|
|
46
77
|
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
|
47
78
|
cd EXT_PARSER_DIR do
|
|
48
|
-
|
|
49
|
-
sh
|
|
79
|
+
myruby 'extconf.rb'
|
|
80
|
+
sh MAKE
|
|
50
81
|
end
|
|
51
82
|
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
|
52
83
|
end
|
|
53
84
|
|
|
54
85
|
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
|
55
86
|
cd EXT_GENERATOR_DIR do
|
|
56
|
-
|
|
57
|
-
sh
|
|
87
|
+
myruby 'extconf.rb'
|
|
88
|
+
sh MAKE
|
|
58
89
|
end
|
|
59
90
|
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
|
60
91
|
end
|
|
@@ -68,18 +99,24 @@ end
|
|
|
68
99
|
|
|
69
100
|
file EXT_PARSER_SRC => RAGEL_PATH do
|
|
70
101
|
cd EXT_PARSER_DIR do
|
|
71
|
-
|
|
102
|
+
if RAGEL_CODEGEN == 'ragel'
|
|
103
|
+
sh "ragel parser.rl -G2 -o parser.c"
|
|
104
|
+
else
|
|
105
|
+
sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
|
106
|
+
end
|
|
72
107
|
end
|
|
73
108
|
end
|
|
74
109
|
|
|
75
110
|
desc "Generate diagrams of ragel parser (ps)"
|
|
76
111
|
task :ragel_dot_ps do
|
|
77
112
|
root = 'diagrams'
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
sh "ragel
|
|
113
|
+
specs = []
|
|
114
|
+
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
|
115
|
+
for s in specs
|
|
116
|
+
if RAGEL_DOTGEN == 'ragel'
|
|
117
|
+
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
|
|
118
|
+
else
|
|
119
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
|
83
120
|
end
|
|
84
121
|
end
|
|
85
122
|
end
|
|
@@ -87,11 +124,13 @@ end
|
|
|
87
124
|
desc "Generate diagrams of ragel parser (png)"
|
|
88
125
|
task :ragel_dot_png do
|
|
89
126
|
root = 'diagrams'
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
sh "ragel
|
|
127
|
+
specs = []
|
|
128
|
+
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
|
129
|
+
for s in specs
|
|
130
|
+
if RAGEL_DOTGEN == 'ragel'
|
|
131
|
+
sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
|
|
132
|
+
else
|
|
133
|
+
sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
|
95
134
|
end
|
|
96
135
|
end
|
|
97
136
|
end
|
|
@@ -101,130 +140,128 @@ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
|
|
|
101
140
|
|
|
102
141
|
desc "Testing library (pure ruby)"
|
|
103
142
|
task :test_pure => :clean do
|
|
104
|
-
|
|
143
|
+
ENV['JSON'] = 'pure'
|
|
144
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
|
145
|
+
myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
|
|
105
146
|
end
|
|
106
147
|
|
|
107
148
|
desc "Testing library (extension)"
|
|
108
|
-
task :test_ext => :
|
|
109
|
-
|
|
149
|
+
task :test_ext => :compile_ext do
|
|
150
|
+
ENV['JSON'] = 'ext'
|
|
151
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
|
152
|
+
myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
|
|
110
153
|
end
|
|
111
154
|
|
|
112
|
-
desc "
|
|
113
|
-
task :
|
|
114
|
-
ruby '-I lib benchmarks/benchmark_parser.rb'
|
|
115
|
-
end
|
|
155
|
+
desc "Testing library (pure ruby and extension)"
|
|
156
|
+
task :test => [ :test_pure, :test_ext ]
|
|
116
157
|
|
|
117
|
-
desc "Benchmarking
|
|
118
|
-
task :
|
|
119
|
-
|
|
120
|
-
|
|
158
|
+
desc "Benchmarking parser"
|
|
159
|
+
task :benchmark_parser do
|
|
160
|
+
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
|
161
|
+
myruby 'benchmarks/parser_benchmark.rb'
|
|
162
|
+
myruby 'benchmarks/parser2_benchmark.rb'
|
|
121
163
|
end
|
|
122
164
|
|
|
123
|
-
desc "Benchmarking
|
|
124
|
-
task :
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
ruby '-I ext:lib benchmarks/benchmark_parser.rb'
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
desc "Benchmarking generator (extension)"
|
|
132
|
-
task :benchmark_generator_ext => :compile do
|
|
133
|
-
ruby '-I ext:lib benchmarks/benchmark_generator.rb'
|
|
134
|
-
ruby 'benchmarks/benchmark_rails.rb'
|
|
165
|
+
desc "Benchmarking generator"
|
|
166
|
+
task :benchmark_generator do
|
|
167
|
+
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
|
168
|
+
myruby 'benchmarks/generator_benchmark.rb'
|
|
169
|
+
myruby 'benchmarks/generator2_benchmark.rb'
|
|
135
170
|
end
|
|
136
171
|
|
|
137
|
-
desc "Benchmarking library
|
|
138
|
-
task :
|
|
139
|
-
|
|
140
|
-
task :benchmark do
|
|
141
|
-
puts "Benchmarking extension variant"
|
|
142
|
-
Rake::Task[:benchmark_ext].invoke
|
|
143
|
-
puts "Benchmarking pure variant"
|
|
144
|
-
Rake::Task[:benchmark_pure].invoke
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
desc "Testing library with coverage" # XXX broken
|
|
148
|
-
task :coverage do
|
|
149
|
-
system 'RUBYOPT="" rcov -x tests -Ilib tests/runner.rb'
|
|
150
|
-
end
|
|
172
|
+
desc "Benchmarking library"
|
|
173
|
+
task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
|
151
174
|
|
|
152
175
|
desc "Create RDOC documentation"
|
|
153
176
|
task :doc => [ :version, EXT_PARSER_SRC ] do
|
|
154
|
-
sh "
|
|
177
|
+
sh "sdoc -o doc -t '#{PKG_TITLE}' -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
|
155
178
|
end
|
|
156
179
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
180
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask)
|
|
181
|
+
spec_pure = Gem::Specification.new do |s|
|
|
182
|
+
s.name = 'json_pure'
|
|
183
|
+
s.version = PKG_VERSION
|
|
184
|
+
s.summary = PKG_TITLE
|
|
185
|
+
s.description = "This is a JSON implementation in pure Ruby."
|
|
162
186
|
|
|
163
|
-
|
|
187
|
+
s.files = PKG_FILES
|
|
164
188
|
|
|
165
|
-
|
|
189
|
+
s.require_path = 'lib'
|
|
166
190
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
191
|
+
s.bindir = "bin"
|
|
192
|
+
s.executables = [ "edit_json.rb", "prettify_json.rb" ]
|
|
193
|
+
s.default_executable = "edit_json.rb"
|
|
170
194
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
195
|
+
s.has_rdoc = true
|
|
196
|
+
s.extra_rdoc_files << 'README'
|
|
197
|
+
s.rdoc_options <<
|
|
198
|
+
'--title' << 'JSON implemention for ruby' << '--main' << 'README'
|
|
199
|
+
s.test_files.concat Dir['tests/*.rb']
|
|
176
200
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
end
|
|
201
|
+
s.author = "Florian Frank"
|
|
202
|
+
s.email = "flori@ping.de"
|
|
203
|
+
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
|
204
|
+
s.rubyforge_project = "json"
|
|
205
|
+
end
|
|
182
206
|
|
|
183
|
-
Rake::GemPackageTask.new(spec_pure) do |pkg|
|
|
184
|
-
|
|
185
|
-
|
|
207
|
+
Rake::GemPackageTask.new(spec_pure) do |pkg|
|
|
208
|
+
pkg.need_tar = true
|
|
209
|
+
pkg.package_files = PKG_FILES
|
|
210
|
+
end
|
|
186
211
|
end
|
|
187
212
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
213
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
|
|
214
|
+
spec_ext = Gem::Specification.new do |s|
|
|
215
|
+
s.name = 'json'
|
|
216
|
+
s.version = PKG_VERSION
|
|
217
|
+
s.summary = PKG_TITLE
|
|
218
|
+
s.description = "This is a JSON implementation as a Ruby extension in C."
|
|
193
219
|
|
|
194
|
-
|
|
220
|
+
s.files = PKG_FILES
|
|
195
221
|
|
|
196
|
-
|
|
197
|
-
"#{EXT_PARSER_DIR}/extconf.rb" <<
|
|
198
|
-
"#{EXT_GENERATOR_DIR}/extconf.rb"
|
|
222
|
+
s.extensions = FileList['ext/**/extconf.rb']
|
|
199
223
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
s.require_path = EXT_ROOT_DIR
|
|
225
|
+
s.require_paths << 'ext'
|
|
226
|
+
s.require_paths << 'lib'
|
|
203
227
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
228
|
+
s.bindir = "bin"
|
|
229
|
+
s.executables = [ "edit_json.rb", "prettify_json.rb" ]
|
|
230
|
+
s.default_executable = "edit_json.rb"
|
|
207
231
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
232
|
+
s.has_rdoc = true
|
|
233
|
+
s.extra_rdoc_files << 'README'
|
|
234
|
+
s.rdoc_options <<
|
|
235
|
+
'--title' << 'JSON implemention for Ruby' << '--main' << 'README'
|
|
236
|
+
s.test_files.concat Dir['tests/*.rb']
|
|
213
237
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
end
|
|
238
|
+
s.author = "Florian Frank"
|
|
239
|
+
s.email = "flori@ping.de"
|
|
240
|
+
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
|
241
|
+
s.rubyforge_project = "json"
|
|
242
|
+
end
|
|
219
243
|
|
|
220
|
-
Rake::GemPackageTask.new(spec_ext) do |pkg|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
end
|
|
244
|
+
Rake::GemPackageTask.new(spec_ext) do |pkg|
|
|
245
|
+
pkg.need_tar = true
|
|
246
|
+
pkg.package_files = PKG_FILES
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
Rake::ExtensionTask.new do |ext|
|
|
250
|
+
ext.name = 'parser'
|
|
251
|
+
ext.gem_spec = spec_ext
|
|
252
|
+
ext.cross_compile = true
|
|
253
|
+
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
|
254
|
+
ext.ext_dir = 'ext/json/ext/parser'
|
|
255
|
+
ext.lib_dir = 'lib/json/ext'
|
|
256
|
+
end
|
|
224
257
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
258
|
+
Rake::ExtensionTask.new do |ext|
|
|
259
|
+
ext.name = 'generator'
|
|
260
|
+
ext.gem_spec = spec_ext
|
|
261
|
+
ext.cross_compile = true
|
|
262
|
+
ext.cross_platform = %w[i386-mswin32 i386-mingw32]
|
|
263
|
+
ext.ext_dir = 'ext/json/ext/generator'
|
|
264
|
+
ext.lib_dir = 'lib/json/ext'
|
|
228
265
|
end
|
|
229
266
|
end
|
|
230
267
|
|
|
@@ -245,6 +282,11 @@ EOT
|
|
|
245
282
|
end
|
|
246
283
|
end
|
|
247
284
|
|
|
248
|
-
|
|
285
|
+
desc "Build all gems and archives for a new release."
|
|
286
|
+
task :release => [ :clean, :version, :cross, :native, :gem ] do
|
|
287
|
+
sh "#$0 clean native gem"
|
|
288
|
+
sh "#$0 clean package"
|
|
289
|
+
end
|
|
249
290
|
|
|
250
|
-
|
|
291
|
+
desc "Compile in the the source directory"
|
|
292
|
+
task :default => [ :version, :compile_ext ]
|
data/TODO
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.4.6
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
========================== 2009-04-01T16:54:14 CEST ===========================
|
|
2
|
+
|
|
3
|
+
Comparing times (call_time_mean):
|
|
4
|
+
1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
|
|
5
|
+
547.354332608 ( real) -> 15.090x
|
|
6
|
+
0.001826970
|
|
7
|
+
2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
|
|
8
|
+
443.968212317 ( real) -> 12.240x
|
|
9
|
+
0.002252414
|
|
10
|
+
3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
|
|
11
|
+
375.104545883 ( real) -> 10.341x
|
|
12
|
+
0.002665923
|
|
13
|
+
4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
|
|
14
|
+
49.978706968 ( real) -> 1.378x
|
|
15
|
+
0.020008521
|
|
16
|
+
5 GeneratorBenchmarkRails#generator 1000 repeats:
|
|
17
|
+
38.531868759 ( real) -> 1.062x
|
|
18
|
+
0.025952543
|
|
19
|
+
6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
|
|
20
|
+
36.927649925 ( real) -> 1.018x 7 (>=3859)
|
|
21
|
+
0.027079979
|
|
22
|
+
7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
|
|
23
|
+
36.272134441 ( real) -> 1.000x 6 (>=3859)
|
|
24
|
+
0.027569373
|
|
25
|
+
calls/sec ( time) -> speed covers
|
|
26
|
+
secs/call
|
|
27
|
+
|
|
28
|
+
Comparing times (call_time_median):
|
|
29
|
+
1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
|
|
30
|
+
708.258020939 ( real) -> 16.547x
|
|
31
|
+
0.001411915
|
|
32
|
+
2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
|
|
33
|
+
569.105020353 ( real) -> 13.296x
|
|
34
|
+
0.001757145
|
|
35
|
+
3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
|
|
36
|
+
482.825371244 ( real) -> 11.280x
|
|
37
|
+
0.002071142
|
|
38
|
+
4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
|
|
39
|
+
62.717626652 ( real) -> 1.465x
|
|
40
|
+
0.015944481
|
|
41
|
+
5 GeneratorBenchmarkRails#generator 1000 repeats:
|
|
42
|
+
43.965681162 ( real) -> 1.027x
|
|
43
|
+
0.022745013
|
|
44
|
+
6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
|
|
45
|
+
43.929073409 ( real) -> 1.026x 7 (>=3859)
|
|
46
|
+
0.022763968
|
|
47
|
+
7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
|
|
48
|
+
42.802514491 ( real) -> 1.000x 6 (>=3859)
|
|
49
|
+
0.023363113
|
|
50
|
+
calls/sec ( time) -> speed covers
|
|
51
|
+
secs/call
|
|
52
|
+
===============================================================================
|