crazy_ivan 0.2.0
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/.gitignore +7 -0
- data/LICENSE +20 -0
- data/README.rdoc +94 -0
- data/Rakefile +92 -0
- data/TODO +33 -0
- data/VERSION +1 -0
- data/bin/crazy_ivan +114 -0
- data/crazy_ivan.gemspec +182 -0
- data/lib/crazy_ivan.rb +5 -0
- data/lib/html_asset_crush.rb +56 -0
- data/lib/report_assembler.rb +78 -0
- data/lib/test_runner.rb +71 -0
- data/templates/css/ci.css +11 -0
- data/templates/index.html +105 -0
- data/templates/javascript/json-template.js +544 -0
- data/templates/javascript/prototype.js +4917 -0
- data/test/crazy_ivan_test.rb +4 -0
- data/test/test_helper.rb +9 -0
- data/vendor/json-1.1.7/CHANGES +119 -0
- data/vendor/json-1.1.7/GPL +340 -0
- data/vendor/json-1.1.7/README +78 -0
- data/vendor/json-1.1.7/RUBY +58 -0
- data/vendor/json-1.1.7/Rakefile +270 -0
- data/vendor/json-1.1.7/TODO +1 -0
- data/vendor/json-1.1.7/VERSION +1 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/vendor/json-1.1.7/benchmarks/generator_benchmark.rb +165 -0
- data/vendor/json-1.1.7/benchmarks/parser_benchmark.rb +197 -0
- data/vendor/json-1.1.7/bin/edit_json.rb +9 -0
- data/vendor/json-1.1.7/bin/prettify_json.rb +75 -0
- data/vendor/json-1.1.7/data/example.json +1 -0
- data/vendor/json-1.1.7/data/index.html +38 -0
- data/vendor/json-1.1.7/data/prototype.js +4184 -0
- data/vendor/json-1.1.7/doc-templates/main.txt +283 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/extconf.rb +11 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/generator.c +919 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/extconf.rb +11 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/parser.c +1829 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/parser.rl +686 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json-1.1.7/install.rb +26 -0
- data/vendor/json-1.1.7/lib/json.rb +10 -0
- data/vendor/json-1.1.7/lib/json/Array.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/FalseClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Hash.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Key.xpm +73 -0
- data/vendor/json-1.1.7/lib/json/NilClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Numeric.xpm +28 -0
- data/vendor/json-1.1.7/lib/json/String.xpm +96 -0
- data/vendor/json-1.1.7/lib/json/TrueClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/add/core.rb +135 -0
- data/vendor/json-1.1.7/lib/json/add/rails.rb +58 -0
- data/vendor/json-1.1.7/lib/json/common.rb +354 -0
- data/vendor/json-1.1.7/lib/json/editor.rb +1371 -0
- data/vendor/json-1.1.7/lib/json/ext.rb +15 -0
- data/vendor/json-1.1.7/lib/json/json.xpm +1499 -0
- data/vendor/json-1.1.7/lib/json/pure.rb +77 -0
- data/vendor/json-1.1.7/lib/json/pure/generator.rb +430 -0
- data/vendor/json-1.1.7/lib/json/pure/parser.rb +269 -0
- data/vendor/json-1.1.7/lib/json/version.rb +8 -0
- data/vendor/json-1.1.7/tests/fixtures/fail1.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail10.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail11.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail12.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail13.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail14.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail18.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail19.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail2.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail20.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail21.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail22.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail23.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail24.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail25.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail27.json +2 -0
- data/vendor/json-1.1.7/tests/fixtures/fail28.json +2 -0
- data/vendor/json-1.1.7/tests/fixtures/fail3.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail4.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail5.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail6.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail7.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail8.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail9.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass1.json +56 -0
- data/vendor/json-1.1.7/tests/fixtures/pass15.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass16.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass17.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass2.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass26.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass3.json +6 -0
- data/vendor/json-1.1.7/tests/test_json.rb +312 -0
- data/vendor/json-1.1.7/tests/test_json_addition.rb +164 -0
- data/vendor/json-1.1.7/tests/test_json_fixtures.rb +34 -0
- data/vendor/json-1.1.7/tests/test_json_generate.rb +106 -0
- data/vendor/json-1.1.7/tests/test_json_rails.rb +146 -0
- data/vendor/json-1.1.7/tests/test_json_unicode.rb +62 -0
- data/vendor/json-1.1.7/tools/fuzz.rb +139 -0
- data/vendor/json-1.1.7/tools/server.rb +61 -0
- metadata +196 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
Dependencies for Building
|
2
|
+
=========================
|
3
|
+
|
4
|
+
- You need rake to build the extensions and install them.
|
5
|
+
|
6
|
+
You can get it from rubyforge:
|
7
|
+
http://rubyforge.org/projects/rake
|
8
|
+
|
9
|
+
or just type
|
10
|
+
|
11
|
+
# gem install rake
|
12
|
+
|
13
|
+
for the installation via rubygems.
|
14
|
+
|
15
|
+
- If you want to rebuild the parser.c file or draw nice graphviz images of the
|
16
|
+
state machines, you need ragel from:
|
17
|
+
http://www.cs.queensu.ca/~thurston/ragel
|
18
|
+
|
19
|
+
Installation
|
20
|
+
============
|
21
|
+
|
22
|
+
It's recommended to use the extension variant of JSON, because it's quite a bit
|
23
|
+
faster than the pure ruby variant. If you cannot build it on your system, you
|
24
|
+
can settle for the latter.
|
25
|
+
|
26
|
+
Just type into the command line as root:
|
27
|
+
|
28
|
+
# rake install
|
29
|
+
|
30
|
+
The above command will build the extensions and install them on your system.
|
31
|
+
|
32
|
+
# rake install_pure
|
33
|
+
|
34
|
+
or
|
35
|
+
|
36
|
+
# ruby install.rb
|
37
|
+
|
38
|
+
will just install the pure ruby implementation of JSON.
|
39
|
+
|
40
|
+
If you use Rubygems you can type
|
41
|
+
|
42
|
+
# gem install json
|
43
|
+
|
44
|
+
instead, to install the newest JSON version.
|
45
|
+
|
46
|
+
There is also a pure ruby json only variant of the gem, that can be installed
|
47
|
+
with:
|
48
|
+
|
49
|
+
# gem install json_pure
|
50
|
+
|
51
|
+
Testing and Examples
|
52
|
+
====================
|
53
|
+
|
54
|
+
To run the tests type:
|
55
|
+
|
56
|
+
$ rake test_ext
|
57
|
+
|
58
|
+
This will build the extensions first and then test them.
|
59
|
+
|
60
|
+
$ rake test_pure
|
61
|
+
|
62
|
+
This will test the pure ruby extensions.
|
63
|
+
|
64
|
+
There is also a small example in tools/server.rb if you want to see, how
|
65
|
+
receiving a JSON object from a webrick server in your browser with the
|
66
|
+
javasript prototype library (http://www.prototypejs.org) works.
|
67
|
+
|
68
|
+
Author
|
69
|
+
======
|
70
|
+
|
71
|
+
Florian Frank <flori@ping.de>
|
72
|
+
|
73
|
+
License
|
74
|
+
=======
|
75
|
+
|
76
|
+
Ruby License, see the RUBY file included in the source distribution. The Ruby
|
77
|
+
License includes the GNU General Public License (GPL), Version 2, so see the
|
78
|
+
file GPL as well.
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the GPL
|
3
|
+
(see COPYING.txt file), 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) rename any non-standard executables so the names do not conflict
|
21
|
+
with standard executables, which must also be provided.
|
22
|
+
|
23
|
+
d) make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or executable
|
26
|
+
form, provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a) distribute the executables 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 executables 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 this terms.
|
43
|
+
|
44
|
+
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
|
45
|
+
files under the ./missing directory. See each file for the copying
|
46
|
+
condition.
|
47
|
+
|
48
|
+
5. The scripts and library files supplied as input to or produced as
|
49
|
+
output from the software do not automatically fall under the
|
50
|
+
copyright of the software, but belong to whomever generated them,
|
51
|
+
and may be sold commercially, and may be aggregated with this
|
52
|
+
software.
|
53
|
+
|
54
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
55
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
56
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
57
|
+
PURPOSE.
|
58
|
+
|
@@ -0,0 +1,270 @@
|
|
1
|
+
begin
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
rescue LoadError
|
5
|
+
end
|
6
|
+
require 'rake/clean'
|
7
|
+
|
8
|
+
require 'rbconfig'
|
9
|
+
include Config
|
10
|
+
|
11
|
+
PKG_NAME = 'json'
|
12
|
+
PKG_VERSION = File.read('VERSION').chomp
|
13
|
+
PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile/).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
|
14
|
+
EXT_ROOT_DIR = 'ext/json/ext'
|
15
|
+
EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
|
16
|
+
EXT_PARSER_DL = "#{EXT_ROOT_DIR}/parser.#{CONFIG['DLEXT']}"
|
17
|
+
EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
|
18
|
+
PKG_FILES << EXT_PARSER_SRC
|
19
|
+
EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
|
20
|
+
EXT_GENERATOR_DL = "#{EXT_ROOT_DIR}/generator.#{CONFIG['DLEXT']}"
|
21
|
+
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
|
22
|
+
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
|
23
|
+
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
|
24
|
+
RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
|
25
|
+
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
|
26
|
+
FileList["ext/**/{Makefile,mkmf.log}"],
|
27
|
+
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"]
|
28
|
+
|
29
|
+
desc "Installing library (pure)"
|
30
|
+
task :install_pure => :version do
|
31
|
+
ruby 'install.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
task :install_ext_really do
|
35
|
+
sitearchdir = CONFIG["sitearchdir"]
|
36
|
+
cd 'ext' do
|
37
|
+
for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"]
|
38
|
+
d = File.join(sitearchdir, file)
|
39
|
+
mkdir_p File.dirname(d)
|
40
|
+
install(file, d)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Installing library (extension)"
|
46
|
+
task :install_ext => [ :compile_ext, :install_pure, :install_ext_really ]
|
47
|
+
|
48
|
+
desc "Installing library (extension)"
|
49
|
+
task :install => :install_ext
|
50
|
+
|
51
|
+
desc "Compiling extension"
|
52
|
+
task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
|
53
|
+
|
54
|
+
file EXT_PARSER_DL => EXT_PARSER_SRC do
|
55
|
+
cd EXT_PARSER_DIR do
|
56
|
+
ruby 'extconf.rb'
|
57
|
+
system 'make'
|
58
|
+
end
|
59
|
+
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
60
|
+
end
|
61
|
+
|
62
|
+
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
|
63
|
+
cd EXT_GENERATOR_DIR do
|
64
|
+
ruby 'extconf.rb'
|
65
|
+
system 'make'
|
66
|
+
end
|
67
|
+
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Generate parser with ragel"
|
71
|
+
task :ragel => EXT_PARSER_SRC
|
72
|
+
|
73
|
+
task :ragel_clean do
|
74
|
+
rm_rf EXT_PARSER_SRC
|
75
|
+
end
|
76
|
+
|
77
|
+
file EXT_PARSER_SRC => RAGEL_PATH do
|
78
|
+
cd EXT_PARSER_DIR do
|
79
|
+
if RAGEL_CODEGEN == 'ragel'
|
80
|
+
system "ragel parser.rl -G2 -o parser.c"
|
81
|
+
else
|
82
|
+
system "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Generate diagrams of ragel parser (ps)"
|
88
|
+
task :ragel_dot_ps do
|
89
|
+
root = 'diagrams'
|
90
|
+
specs = []
|
91
|
+
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
92
|
+
for s in specs
|
93
|
+
if RAGEL_DOTGEN == 'ragel'
|
94
|
+
system "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
|
95
|
+
else
|
96
|
+
system "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
desc "Generate diagrams of ragel parser (png)"
|
102
|
+
task :ragel_dot_png do
|
103
|
+
root = 'diagrams'
|
104
|
+
specs = []
|
105
|
+
File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
|
106
|
+
for s in specs
|
107
|
+
if RAGEL_DOTGEN == 'ragel'
|
108
|
+
system "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
|
109
|
+
else
|
110
|
+
system "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "Generate diagrams of ragel parser"
|
116
|
+
task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
|
117
|
+
|
118
|
+
desc "Testing library (pure ruby)"
|
119
|
+
task :test_pure => :clean do
|
120
|
+
ENV['JSON'] = 'pure'
|
121
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
122
|
+
system "testrb #{Dir['tests/*.rb'] * ' '}"
|
123
|
+
end
|
124
|
+
|
125
|
+
desc "Testing library (extension)"
|
126
|
+
task :test_ext => :compile_ext do
|
127
|
+
ENV['JSON'] = 'ext'
|
128
|
+
ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
|
129
|
+
system "testrb #{Dir['tests/*.rb'] * ' '}"
|
130
|
+
end
|
131
|
+
|
132
|
+
desc "Testing library (pure ruby and extension)"
|
133
|
+
task :test => [ :test_pure, :test_ext ]
|
134
|
+
|
135
|
+
desc "Benchmarking parser"
|
136
|
+
task :benchmark_parser do
|
137
|
+
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
138
|
+
ruby 'benchmarks/parser_benchmark.rb'
|
139
|
+
end
|
140
|
+
|
141
|
+
desc "Benchmarking generator"
|
142
|
+
task :benchmark_generator do
|
143
|
+
ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
|
144
|
+
ruby 'benchmarks/generator_benchmark.rb'
|
145
|
+
end
|
146
|
+
|
147
|
+
desc "Benchmarking library"
|
148
|
+
task :benchmark => [ :benchmark_parser, :benchmark_generator ]
|
149
|
+
|
150
|
+
desc "Clean benchmark data"
|
151
|
+
task :clean_benchmark_data do
|
152
|
+
rm_rf Dir['benchmarks/data/*.{dat,log}']
|
153
|
+
end
|
154
|
+
|
155
|
+
desc "Create RDOC documentation"
|
156
|
+
task :doc => [ :version, EXT_PARSER_SRC ] do
|
157
|
+
system "rdoc -S -o doc -m main.txt doc-templates/main.txt lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
|
158
|
+
end
|
159
|
+
|
160
|
+
if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
|
161
|
+
spec_pure = Gem::Specification.new do |s|
|
162
|
+
s.name = 'json_pure'
|
163
|
+
s.version = PKG_VERSION
|
164
|
+
s.summary = "A JSON implementation in Ruby"
|
165
|
+
s.description = "This is a JSON implementation in pure Ruby."
|
166
|
+
|
167
|
+
s.files = PKG_FILES
|
168
|
+
|
169
|
+
s.require_path = 'lib'
|
170
|
+
|
171
|
+
s.bindir = "bin"
|
172
|
+
s.executables = [ "edit_json.rb", "prettify_json.rb" ]
|
173
|
+
s.default_executable = "edit_json.rb"
|
174
|
+
|
175
|
+
s.has_rdoc = true
|
176
|
+
s.rdoc_options <<
|
177
|
+
'--title' << 'JSON -- A JSON implemention' <<
|
178
|
+
'--main' << 'JSON' << '--line-numbers'
|
179
|
+
s.test_files.concat Dir['tests/*.rb']
|
180
|
+
|
181
|
+
s.author = "Florian Frank"
|
182
|
+
s.email = "flori@ping.de"
|
183
|
+
s.homepage = "http://json.rubyforge.org"
|
184
|
+
s.rubyforge_project = "json"
|
185
|
+
end
|
186
|
+
|
187
|
+
Rake::GemPackageTask.new(spec_pure) do |pkg|
|
188
|
+
pkg.need_tar = true
|
189
|
+
pkg.package_files += PKG_FILES
|
190
|
+
end
|
191
|
+
|
192
|
+
spec_ext = Gem::Specification.new do |s|
|
193
|
+
s.name = 'json'
|
194
|
+
s.version = PKG_VERSION
|
195
|
+
s.summary = "A JSON implementation as a Ruby extension"
|
196
|
+
s.description = "This is a JSON implementation as a Ruby extension in C."
|
197
|
+
|
198
|
+
s.files = PKG_FILES
|
199
|
+
|
200
|
+
s.extensions = FileList['ext/**/extconf.rb']
|
201
|
+
|
202
|
+
s.require_path = EXT_ROOT_DIR
|
203
|
+
s.require_paths << 'ext'
|
204
|
+
s.require_paths << 'lib'
|
205
|
+
|
206
|
+
s.bindir = "bin"
|
207
|
+
s.executables = [ "edit_json.rb", "prettify_json.rb" ]
|
208
|
+
s.default_executable = "edit_json.rb"
|
209
|
+
|
210
|
+
s.has_rdoc = true
|
211
|
+
s.rdoc_options <<
|
212
|
+
'--title' << 'JSON -- A JSON implemention' <<
|
213
|
+
'--main' << 'JSON' << '--line-numbers'
|
214
|
+
s.test_files.concat Dir['tests/*.rb']
|
215
|
+
|
216
|
+
s.author = "Florian Frank"
|
217
|
+
s.email = "flori@ping.de"
|
218
|
+
s.homepage = "http://json.rubyforge.org"
|
219
|
+
s.rubyforge_project = "json"
|
220
|
+
end
|
221
|
+
|
222
|
+
Rake::GemPackageTask.new(spec_ext) do |pkg|
|
223
|
+
pkg.need_tar = true
|
224
|
+
pkg.package_files = PKG_FILES
|
225
|
+
end
|
226
|
+
|
227
|
+
Rake::ExtensionTask.new do |ext|
|
228
|
+
ext.name = 'parser'
|
229
|
+
ext.gem_spec = spec_ext
|
230
|
+
ext.cross_compile = true
|
231
|
+
ext.cross_platform = 'i386-mswin32'
|
232
|
+
ext.ext_dir = 'ext/json/ext/parser'
|
233
|
+
ext.lib_dir = 'lib/json/ext'
|
234
|
+
end
|
235
|
+
|
236
|
+
Rake::ExtensionTask.new do |ext|
|
237
|
+
ext.name = 'generator'
|
238
|
+
ext.gem_spec = spec_ext
|
239
|
+
ext.cross_compile = true
|
240
|
+
ext.cross_platform = 'i386-mswin32'
|
241
|
+
ext.ext_dir = 'ext/json/ext/generator'
|
242
|
+
ext.lib_dir = 'lib/json/ext'
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
desc m = "Writing version information for #{PKG_VERSION}"
|
247
|
+
task :version do
|
248
|
+
puts m
|
249
|
+
File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v|
|
250
|
+
v.puts <<EOT
|
251
|
+
module JSON
|
252
|
+
# JSON version
|
253
|
+
VERSION = '#{PKG_VERSION}'
|
254
|
+
VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
|
255
|
+
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
|
256
|
+
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
|
257
|
+
VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
|
258
|
+
end
|
259
|
+
EOT
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# TODO task :release => [ :version, :clean, :package_win ]
|
264
|
+
desc "Build all gems and archives for a new release."
|
265
|
+
task :release => [ :clean, :version, :cross, :native, :gem ] do
|
266
|
+
system "#$0 clean native gem"
|
267
|
+
system "#$0 clean package"
|
268
|
+
end
|
269
|
+
|
270
|
+
task :default => [ :version, :compile_ext ]
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.7
|
@@ -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
|
+
===============================================================================
|