scout 5.6.7 → 5.6.8.pre

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.
Files changed (125) hide show
  1. data/CHANGELOG.markdown +4 -0
  2. data/lib/scout/version.rb +1 -1
  3. data/vendor/json_pure/.gitignore +12 -0
  4. data/vendor/json_pure/.travis.yml +20 -0
  5. data/vendor/json_pure/CHANGES +120 -0
  6. data/vendor/json_pure/COPYING-json-jruby +57 -0
  7. data/vendor/json_pure/Gemfile +11 -0
  8. data/vendor/json_pure/README-json-jruby.markdown +33 -0
  9. data/vendor/json_pure/{README → README.rdoc} +7 -7
  10. data/vendor/json_pure/Rakefile +305 -185
  11. data/vendor/json_pure/VERSION +1 -1
  12. data/vendor/json_pure/diagrams/.keep +0 -0
  13. data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +181 -0
  14. data/vendor/json_pure/ext/json/ext/generator/depend +1 -0
  15. data/vendor/json_pure/ext/json/ext/generator/extconf.rb +4 -6
  16. data/vendor/json_pure/ext/json/ext/generator/generator.c +463 -369
  17. data/vendor/json_pure/ext/json/ext/generator/generator.h +44 -66
  18. data/vendor/json_pure/ext/json/ext/parser/depend +1 -0
  19. data/vendor/json_pure/ext/json/ext/parser/extconf.rb +3 -5
  20. data/vendor/json_pure/ext/json/ext/parser/parser.c +580 -311
  21. data/vendor/json_pure/ext/json/ext/parser/parser.h +14 -8
  22. data/vendor/json_pure/ext/json/ext/parser/parser.rl +242 -107
  23. data/vendor/json_pure/install.rb +8 -11
  24. data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +167 -0
  25. data/vendor/json_pure/java/src/json/ext/Generator.java +444 -0
  26. data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +232 -0
  27. data/vendor/json_pure/java/src/json/ext/GeneratorService.java +43 -0
  28. data/vendor/json_pure/java/src/json/ext/GeneratorState.java +543 -0
  29. data/vendor/json_pure/java/src/json/ext/OptionsReader.java +114 -0
  30. data/vendor/json_pure/java/src/json/ext/Parser.java +2644 -0
  31. data/vendor/json_pure/java/src/json/ext/Parser.rl +968 -0
  32. data/vendor/json_pure/java/src/json/ext/ParserService.java +35 -0
  33. data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +121 -0
  34. data/vendor/json_pure/java/src/json/ext/StringDecoder.java +167 -0
  35. data/vendor/json_pure/java/src/json/ext/StringEncoder.java +106 -0
  36. data/vendor/json_pure/java/src/json/ext/Utils.java +89 -0
  37. data/vendor/json_pure/json-java.gemspec +23 -0
  38. data/vendor/json_pure/json.gemspec +37 -0
  39. data/vendor/json_pure/json_pure.gemspec +39 -0
  40. data/vendor/json_pure/lib/json.rb +52 -0
  41. data/vendor/json_pure/lib/json/add/bigdecimal.rb +28 -0
  42. data/vendor/json_pure/lib/json/add/complex.rb +22 -0
  43. data/vendor/json_pure/lib/json/add/core.rb +9 -146
  44. data/vendor/json_pure/lib/json/add/date.rb +34 -0
  45. data/vendor/json_pure/lib/json/add/date_time.rb +50 -0
  46. data/vendor/json_pure/lib/json/add/exception.rb +31 -0
  47. data/vendor/json_pure/lib/json/add/ostruct.rb +31 -0
  48. data/vendor/json_pure/lib/json/add/range.rb +29 -0
  49. data/vendor/json_pure/lib/json/add/rational.rb +22 -0
  50. data/vendor/json_pure/lib/json/add/regexp.rb +30 -0
  51. data/vendor/json_pure/lib/json/add/struct.rb +30 -0
  52. data/vendor/json_pure/lib/json/add/symbol.rb +25 -0
  53. data/vendor/json_pure/lib/json/add/time.rb +38 -0
  54. data/vendor/json_pure/lib/json/common.rb +157 -67
  55. data/vendor/json_pure/lib/json/ext.rb +8 -2
  56. data/vendor/json_pure/lib/json/ext/.keep +0 -0
  57. data/vendor/json_pure/lib/json/generic_object.rb +70 -0
  58. data/vendor/json_pure/lib/json/pure.rb +8 -64
  59. data/vendor/json_pure/lib/json/pure/generator.rb +183 -113
  60. data/vendor/json_pure/lib/json/pure/parser.rb +118 -66
  61. data/vendor/json_pure/lib/json/version.rb +1 -1
  62. data/vendor/json_pure/tests/fixtures/fail18.json +1 -1
  63. data/vendor/json_pure/tests/setup_variant.rb +11 -0
  64. data/vendor/json_pure/tests/test_json.rb +233 -28
  65. data/vendor/json_pure/tests/test_json_addition.rb +68 -34
  66. data/vendor/json_pure/tests/test_json_encoding.rb +11 -14
  67. data/vendor/json_pure/tests/test_json_fixtures.rb +11 -10
  68. data/vendor/json_pure/tests/test_json_generate.rb +207 -7
  69. data/vendor/json_pure/tests/test_json_generic_object.rb +75 -0
  70. data/vendor/json_pure/tests/test_json_string_matching.rb +39 -0
  71. data/vendor/json_pure/tests/test_json_unicode.rb +3 -7
  72. data/vendor/json_pure/tools/fuzz.rb +1 -1
  73. data/vendor/json_pure/tools/server.rb +1 -0
  74. metadata +87 -94
  75. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
  76. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
  77. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
  78. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
  79. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
  80. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
  81. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
  82. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
  83. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
  84. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
  85. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
  86. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
  87. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
  88. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
  89. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
  90. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
  91. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
  92. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
  93. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
  94. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
  95. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
  96. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
  97. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
  98. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
  99. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
  100. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
  101. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
  102. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
  103. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
  104. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
  105. data/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
  106. data/vendor/json_pure/benchmarks/generator2_benchmark.rb +0 -222
  107. data/vendor/json_pure/benchmarks/generator_benchmark.rb +0 -224
  108. data/vendor/json_pure/benchmarks/ohai.json +0 -1216
  109. data/vendor/json_pure/benchmarks/ohai.ruby +0 -1
  110. data/vendor/json_pure/benchmarks/parser2_benchmark.rb +0 -251
  111. data/vendor/json_pure/benchmarks/parser_benchmark.rb +0 -259
  112. data/vendor/json_pure/bin/edit_json.rb +0 -9
  113. data/vendor/json_pure/bin/prettify_json.rb +0 -75
  114. data/vendor/json_pure/lib/json/Array.xpm +0 -21
  115. data/vendor/json_pure/lib/json/FalseClass.xpm +0 -21
  116. data/vendor/json_pure/lib/json/Hash.xpm +0 -21
  117. data/vendor/json_pure/lib/json/Key.xpm +0 -73
  118. data/vendor/json_pure/lib/json/NilClass.xpm +0 -21
  119. data/vendor/json_pure/lib/json/Numeric.xpm +0 -28
  120. data/vendor/json_pure/lib/json/String.xpm +0 -96
  121. data/vendor/json_pure/lib/json/TrueClass.xpm +0 -21
  122. data/vendor/json_pure/lib/json/add/rails.rb +0 -58
  123. data/vendor/json_pure/lib/json/editor.rb +0 -1371
  124. data/vendor/json_pure/lib/json/json.xpm +0 -1499
  125. data/vendor/json_pure/tests/test_json_rails.rb +0 -144
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 5.6.8
2
+
3
+ * Updated JSON to 1.8.0
4
+
1
5
  # 5.6.7
2
6
 
3
7
  * changed fqdn override to hostname override. We no longer send fqdn.
data/lib/scout/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scout
2
- VERSION = "5.6.7"
2
+ VERSION = "5.6.8.pre"
3
3
  end
@@ -0,0 +1,12 @@
1
+ .*.sw[pon]
2
+ coverage
3
+ tags
4
+ pkg
5
+ .nfs.*
6
+ .idea
7
+ java/Json.iml
8
+ Gemfile.lock
9
+ .rvmrc
10
+ *.rbc
11
+ .rbx
12
+ .AppleDouble
@@ -0,0 +1,20 @@
1
+ # Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
2
+ bundler_args: --binstubs
3
+
4
+ # Specify which ruby versions you wish to run your tests on, each version will be used
5
+ rvm:
6
+ - 1.8.7
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - 2.0.0
10
+ - ree
11
+ - rbx-18mode
12
+ - rbx-19mode
13
+ - jruby-18mode
14
+ - jruby-19mode
15
+ - ruby-head
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: rbx-18mode
19
+ - rvm: rbx-19mode
20
+ script: "bundle exec rake"
@@ -1,3 +1,123 @@
1
+ 2013-05-13 (1.8.0)
2
+ * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre
3
+ Lafortune <github_rocks@marc-andre.ca>. Thanks!
4
+ * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress warning with
5
+ -Wchar-subscripts and better validate UTF-8 strings.
6
+ * Applied patch by ginriki@github to remove unnecessary if.
7
+ * Add load/dump interface to JSON::GenericObject to make
8
+ serialize :some_attribute, JSON::GenericObject
9
+ work in Rails active models for convenient SomeModel#some_attribute.foo.bar
10
+ access to serialised JSON data.
11
+ 2013-02-04 (1.7.7)
12
+ * Security fix for JSON create_additions default value and
13
+ JSON::GenericObject. It should not be possible to create additions unless
14
+ explicitely requested by setting the create_additions argument to true or
15
+ using the JSON.load/dump interface. If JSON::GenericObject is supposed to
16
+ be automatically deserialised, this has to be explicitely enabled by
17
+ setting
18
+ JSON::GenericObject.json_creatable = true
19
+ as well.
20
+ * Remove useless assert in fbuffer implementation.
21
+ * Apply patch attached to https://github.com/flori/json/issues#issue/155
22
+ provided by John Shahid <jvshahid@gmail.com>, Thx!
23
+ * Add license information to rubygems spec data, reported by Jordi Massaguer Pla <jmassaguerpla@suse.de>.
24
+ * Improve documentation, thx to Zachary Scott <zachary@zacharyscott.net>.
25
+ 2012-11-29 (1.7.6)
26
+ * Add GeneratorState#merge alias for JRuby, fix state accessor methods. Thx to
27
+ jvshahid@github.
28
+ * Increase hash likeness of state objects.
29
+ 2012-08-17 (1.7.5)
30
+ * Fix compilation of extension on older rubies.
31
+ 2012-07-26 (1.7.4)
32
+ * Fix compilation problem on AIX, see https://github.com/flori/json/issues/142
33
+ 2012-05-12 (1.7.3)
34
+ * Work around Rubinius encoding issues using iconv for conversion instead.
35
+ 2012-05-11 (1.7.2)
36
+ * Fix some encoding issues, that cause problems for the pure and the
37
+ extension variant in jruby 1.9 mode.
38
+ 2012-04-28 (1.7.1)
39
+ * Some small fixes for building
40
+ 2012-04-28 (1.7.0)
41
+ * Add JSON::GenericObject for method access to objects transmitted via JSON.
42
+ 2012-04-27 (1.6.7)
43
+ * Fix possible crash when trying to parse nil value.
44
+ 2012-02-11 (1.6.6)
45
+ * Propagate src encoding to values made from it (fixes 1.9 mode converting
46
+ everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo
47
+ <tom.enebo@gmail.com>), should fix
48
+ https://github.com/flori/json/issues#issue/119.
49
+ * Fix https://github.com/flori/json/issues#issue/124 Thx to Jason Hutchens.
50
+ * Fix https://github.com/flori/json/issues#issue/117
51
+ 2012-01-15 (1.6.5)
52
+ * Vit Ondruch <v.ondruch@tiscali.cz> reported a bug that shows up when using
53
+ optimisation under GCC 4.7. Thx to him, Bohuslav Kabrda
54
+ <bkabrda@redhat.com> and Yui NARUSE <naruse@airemix.jp> for debugging and
55
+ developing a patch fix.
56
+ 2011-12-24 (1.6.4)
57
+ * Patches that improve speed on JRuby contributed by Charles Oliver Nutter
58
+ <headius@headius.com>.
59
+ * Support object_class/array_class with duck typed hash/array.
60
+ 2011-12-01 (1.6.3)
61
+ * Let JSON.load('') return nil as well to make mysql text columns (default to
62
+ '') work better for serialization.
63
+ 2011-11-21 (1.6.2)
64
+ * Add support for OpenStruct and BigDecimal.
65
+ * Fix bug when parsing nil in quirks_mode.
66
+ * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize
67
+ method. Just use: serialize :value, JSON
68
+ * Fix bug with time serialization concerning nanoseconds. Thanks for the
69
+ patch go to Josh Partlow (jpartlow@github).
70
+ * Improve parsing speed for JSON numbers (integers and floats) in a similar way to
71
+ what Evan Phoenix <evan@phx.io> suggested in:
72
+ https://github.com/flori/json/pull/103
73
+ 2011-09-18 (1.6.1)
74
+ * Using -target 1.5 to force Java bits to compile with 1.5.
75
+ 2011-09-12 (1.6.0)
76
+ * Extract utilities (prettifier and GUI-editor) in its own gem json-utils.
77
+ * Split json/add/core into different files for classes to be serialised.
78
+ 2011-08-31 (1.5.4)
79
+ * Fix memory leak when used from multiple JRuby. (Patch by
80
+ jfirebaugh@github).
81
+ * Apply patch by Eric Wong <nocode@yhbt.net> that fixes garbage collection problem
82
+ reported in https://github.com/flori/json/issues/46.
83
+ * Add :quirks_mode option to parser and generator.
84
+ * Add support for Rational and Complex number additions via json/add/complex
85
+ and json/add/rational requires.
86
+ 2011-06-20 (1.5.3)
87
+ * Alias State#configure method as State#merge to increase duck type synonymy with Hash.
88
+ * Add as_json methods in json/add/core, so rails can create its json objects
89
+ the new way.
90
+ 2011-05-11 (1.5.2)
91
+ * Apply documentation patch by Cory Monty <cory.monty@gmail.com>.
92
+ * Add gemspecs for json and json_pure.
93
+ * Fix bug in jruby pretty printing.
94
+ * Fix bug in object_class and array_class when inheriting from Hash or Array.
95
+ 2011-01-24 (1.5.1)
96
+ * Made rake-compiler build a fat binary gem. This should fix issue
97
+ https://github.com/flori/json/issues#issue/54.
98
+ 2011-01-22 (1.5.0)
99
+ * Included Java source codes for the Jruby extension made by Daniel Luz
100
+ <dev@mernen.com>.
101
+ * Output full exception message of deep_const_get to aid debugging.
102
+ * Fixed an issue with ruby 1.9 Module#const_defined? method, that was
103
+ reported by Riley Goodside.
104
+ 2010-08-09 (1.4.6)
105
+ * Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23,
106
+ always create a new object from the state prototype.
107
+ * Made pure and ext api more similar again.
108
+ 2010-08-07 (1.4.5)
109
+ * Manage data structure nesting depth in state object during generation. This
110
+ should reduce problems with to_json method definіtions that only have one
111
+ argument.
112
+ * Some fixes in the state objects and additional tests.
113
+ 2010-08-06 (1.4.4)
114
+ * Fixes build problem for rubinius under OS X, http://github.com/flori/json/issues/closed#issue/25
115
+ * Fixes crashes described in http://github.com/flori/json/issues/closed#issue/21 and
116
+ http://github.com/flori/json/issues/closed#issue/23
117
+ 2010-05-05 (1.4.3)
118
+ * Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu.
119
+ * Fixed issue http://github.com/flori/json/issues/#issue/20 reported by
120
+ electronicwhisper@github. Thx!
1
121
  2010-04-26 (1.4.2)
2
122
  * Applied patch from naruse Yui NARUSE <naruse@airemix.com> to make building with
3
123
  Microsoft Visual C possible again.
@@ -0,0 +1,57 @@
1
+ JSON-JRuby is copyrighted free software by Daniel Luz <mernen at gmail dot com>,
2
+ and is a derivative work of Florian Frank's json library <flori at ping dot de>.
3
+ You can redistribute it and/or modify it under either the terms of the GPL
4
+ version 2 (see the file GPL), or the conditions below:
5
+
6
+ 1. You may make and give away verbatim copies of the source form of the
7
+ software without restriction, provided that you duplicate all of the
8
+ original copyright notices and associated disclaimers.
9
+
10
+ 2. You may modify your copy of the software in any way, provided that
11
+ you do at least ONE of the following:
12
+
13
+ a) place your modifications in the Public Domain or otherwise
14
+ make them Freely Available, such as by posting said
15
+ modifications to Usenet or an equivalent medium, or by allowing
16
+ the author to include your modifications in the software.
17
+
18
+ b) use the modified software only within your corporation or
19
+ organization.
20
+
21
+ c) give non-standard binaries non-standard names, with
22
+ instructions on where to get the original software distribution.
23
+
24
+ d) make other distribution arrangements with the author.
25
+
26
+ 3. You may distribute the software in object code or binary form,
27
+ provided that you do at least ONE of the following:
28
+
29
+ a) distribute the binaries and library files of the software,
30
+ together with instructions (in the manual page or equivalent)
31
+ on where to get the original distribution.
32
+
33
+ b) accompany the distribution with the machine-readable source of
34
+ the software.
35
+
36
+ c) give non-standard binaries non-standard names, with
37
+ instructions on where to get the original software distribution.
38
+
39
+ d) make other distribution arrangements with the author.
40
+
41
+ 4. You may modify and include the part of the software into any other
42
+ software (possibly commercial). But some files in the distribution
43
+ are not written by the author, so that they are not under these terms.
44
+
45
+ For the list of those files and their copying conditions, see the
46
+ file LEGAL.
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.
@@ -0,0 +1,11 @@
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'
8
+
9
+ gem 'utils'
10
+ gem 'test-unit'
11
+ gem 'debugger', :platform => :mri_19
@@ -0,0 +1,33 @@
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`.
@@ -1,3 +1,5 @@
1
+ = JSON implementation for Ruby {<img src="https://secure.travis-ci.org/flori/json.png" />}[http://travis-ci.org/flori/json]
2
+
1
3
  == Description
2
4
 
3
5
  This is a implementation of the JSON specification according to RFC 4627
@@ -11,13 +13,11 @@ will be two variants available:
11
13
  generated by the ragel state machine compiler
12
14
  http://www.cs.queensu.ca/~thurston/ragel .
13
15
 
14
- Both variants of the JSON generator escape all non-ASCII and control characters
15
- with \uXXXX escape sequences, and support UTF-16 surrogate pairs in order to be
16
- able to generate the whole range of unicode code points. This means that
17
- generated JSON document is encoded as UTF-8 (because ASCII is a subset of
18
- UTF-8) and at the same time avoids decoding problems for receiving endpoints,
19
- that don't expect UTF-8 encoded texts. On the negative side this may lead to a
20
- bit longer strings than necessarry.
16
+ Both variants of the JSON generator generate UTF-8 character sequences by
17
+ default. If an :ascii_only option with a true value is given, they escape all
18
+ non-ASCII and control characters with \uXXXX escape sequences, and support
19
+ UTF-16 surrogate pairs in order to be able to generate the whole range of
20
+ unicode code points.
21
21
 
22
22
  All strings, that are to be encoded as JSON strings, should be UTF-8 byte
23
23
  sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8
@@ -1,53 +1,62 @@
1
1
  begin
2
- require 'rake/gempackagetask'
2
+ require 'rubygems/package_task'
3
3
  rescue LoadError
4
4
  end
5
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
11
-
12
6
  require 'rbconfig'
13
- include Config
7
+ include\
8
+ begin
9
+ RbConfig
10
+ rescue NameError
11
+ Config
12
+ end
14
13
 
15
14
  require 'rake/clean'
16
- CLOBBER.include Dir['benchmarks/data/*.{dat,log}'], FileList['**/*.rbc']
15
+ CLOBBER.include 'doc', 'Gemfile.lock'
17
16
  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}"]
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
+ def skip_sdoc(src)
27
+ src.gsub(/^.*sdoc.*/) { |s| s + ' if RUBY_VERSION > "1.8.6"' }
28
+ end
20
29
 
21
- MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
30
+ MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
31
+ BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
22
32
  PKG_NAME = 'json'
23
33
  PKG_TITLE = 'JSON Implementation for Ruby'
24
34
  PKG_VERSION = File.read('VERSION').chomp
25
- PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/)
35
+ PKG_FILES = FileList[`git ls-files`.split(/\n/)]
36
+
26
37
  EXT_ROOT_DIR = 'ext/json/ext'
27
38
  EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
28
39
  EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
40
+ RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
29
41
  EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
30
- PKG_FILES << EXT_PARSER_SRC
31
42
  EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
32
43
  EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
33
44
  EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
45
+
46
+ JAVA_DIR = "java/src/json/ext"
47
+ JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl"
48
+ JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
49
+ JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
50
+ JAVA_CLASSES = []
51
+ JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
52
+ JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
53
+
34
54
  RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
35
55
  RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
36
- RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
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
47
56
 
48
57
  desc "Installing library (pure)"
49
58
  task :install_pure => :version do
50
- myruby 'install.rb'
59
+ ruby 'install.rb'
51
60
  end
52
61
 
53
62
  task :install_ext_really do
@@ -58,126 +67,17 @@ task :install_ext_really do
58
67
  mkdir_p File.dirname(d)
59
68
  install(file, d)
60
69
  end
70
+ warn " *** Installed EXT ruby library."
61
71
  end
62
72
  end
63
73
 
64
74
  desc "Installing library (extension)"
65
- task :install_ext => [ :compile_ext, :install_pure, :install_ext_really ]
75
+ task :install_ext => [ :compile, :install_pure, :install_ext_really ]
66
76
 
67
77
  desc "Installing library (extension)"
68
- if RUBY_PLATFORM =~ /java/
69
- task :install => :install_pure
70
- else
71
- task :install => :install_ext
72
- end
73
-
74
- desc "Compiling extension"
75
- task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
76
-
77
- file EXT_PARSER_DL => EXT_PARSER_SRC do
78
- cd EXT_PARSER_DIR do
79
- myruby 'extconf.rb'
80
- sh MAKE
81
- end
82
- cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
83
- end
84
-
85
- file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
86
- cd EXT_GENERATOR_DIR do
87
- myruby 'extconf.rb'
88
- sh MAKE
89
- end
90
- cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
91
- end
92
-
93
- desc "Generate parser with ragel"
94
- task :ragel => EXT_PARSER_SRC
95
-
96
- task :ragel_clean do
97
- rm_rf EXT_PARSER_SRC
98
- end
99
-
100
- file EXT_PARSER_SRC => RAGEL_PATH do
101
- cd EXT_PARSER_DIR do
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
107
- end
108
- end
78
+ task :install => :install_ext
109
79
 
110
- desc "Generate diagrams of ragel parser (ps)"
111
- task :ragel_dot_ps do
112
- root = 'diagrams'
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"
120
- end
121
- end
122
- end
123
-
124
- desc "Generate diagrams of ragel parser (png)"
125
- task :ragel_dot_png do
126
- root = 'diagrams'
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"
134
- end
135
- end
136
- end
137
-
138
- desc "Generate diagrams of ragel parser"
139
- task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
140
-
141
- desc "Testing library (pure ruby)"
142
- task :test_pure => :clean do
143
- ENV['JSON'] = 'pure'
144
- ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
145
- myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}"
146
- end
147
-
148
- desc "Testing library (extension)"
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'] * ' '}"
153
- end
154
-
155
- desc "Testing library (pure ruby and extension)"
156
- task :test => [ :test_pure, :test_ext ]
157
-
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'
163
- end
164
-
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'
170
- end
171
-
172
- desc "Benchmarking library"
173
- task :benchmark => [ :benchmark_parser, :benchmark_generator ]
174
-
175
- desc "Create RDOC documentation"
176
- task :doc => [ :version, EXT_PARSER_SRC ] do
177
- sh "rdoc -o doc -t '#{PKG_TITLE}' -m README README lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
178
- end
179
-
180
- if defined?(Gem) and defined?(Rake::GemPackageTask)
80
+ if defined?(Gem) and defined?(Gem::PackageTask)
181
81
  spec_pure = Gem::Specification.new do |s|
182
82
  s.name = 'json_pure'
183
83
  s.version = PKG_VERSION
@@ -187,30 +87,33 @@ if defined?(Gem) and defined?(Rake::GemPackageTask)
187
87
  s.files = PKG_FILES
188
88
 
189
89
  s.require_path = 'lib'
90
+ s.add_development_dependency 'permutation'
91
+ s.add_development_dependency 'sdoc', '~>0.3.16'
92
+ s.add_development_dependency 'rake', '~>0.9.2'
190
93
 
191
- s.bindir = "bin"
192
- s.executables = [ "edit_json.rb", "prettify_json.rb" ]
193
- s.default_executable = "edit_json.rb"
194
-
195
- s.has_rdoc = true
196
- s.extra_rdoc_files << 'README'
94
+ s.extra_rdoc_files << 'README.rdoc'
197
95
  s.rdoc_options <<
198
- '--title' << 'JSON implemention for ruby' << '--main' << 'README'
199
- s.test_files.concat Dir['tests/*.rb']
96
+ '--title' << 'JSON implemention for ruby' << '--main' << 'README.rdoc'
97
+ s.test_files.concat Dir['./tests/test_*.rb']
200
98
 
201
99
  s.author = "Florian Frank"
202
100
  s.email = "flori@ping.de"
203
101
  s.homepage = "http://flori.github.com/#{PKG_NAME}"
204
- s.rubyforge_project = "json"
102
+ s.license = 'Ruby'
205
103
  end
206
104
 
207
- Rake::GemPackageTask.new(spec_pure) do |pkg|
105
+ desc 'Creates a json_pure.gemspec file'
106
+ task :gemspec_pure => :version do
107
+ File.open('json_pure.gemspec', 'w') do |gemspec|
108
+ gemspec.write skip_sdoc(spec_pure.to_ruby)
109
+ end
110
+ end
111
+
112
+ Gem::PackageTask.new(spec_pure) do |pkg|
208
113
  pkg.need_tar = true
209
114
  pkg.package_files = PKG_FILES
210
115
  end
211
- end
212
116
 
213
- if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::ExtensionTask)
214
117
  spec_ext = Gem::Specification.new do |s|
215
118
  s.name = 'json'
216
119
  s.version = PKG_VERSION
@@ -221,48 +124,36 @@ if defined?(Gem) and defined?(Rake::GemPackageTask) and defined?(Rake::Extension
221
124
 
222
125
  s.extensions = FileList['ext/**/extconf.rb']
223
126
 
224
- s.require_path = EXT_ROOT_DIR
225
- s.require_paths << 'ext'
226
- s.require_paths << 'lib'
227
-
228
- s.bindir = "bin"
229
- s.executables = [ "edit_json.rb", "prettify_json.rb" ]
230
- s.default_executable = "edit_json.rb"
127
+ s.require_path = 'lib'
128
+ s.add_development_dependency 'permutation'
129
+ s.add_development_dependency 'sdoc', '~>0.3.16'
231
130
 
232
- s.has_rdoc = true
233
- s.extra_rdoc_files << 'README'
131
+ s.extra_rdoc_files << 'README.rdoc'
234
132
  s.rdoc_options <<
235
- '--title' << 'JSON implemention for Ruby' << '--main' << 'README'
236
- s.test_files.concat Dir['tests/*.rb']
133
+ '--title' << 'JSON implemention for Ruby' << '--main' << 'README.rdoc'
134
+ s.test_files.concat Dir['./tests/test_*.rb']
237
135
 
238
136
  s.author = "Florian Frank"
239
137
  s.email = "flori@ping.de"
240
138
  s.homepage = "http://flori.github.com/#{PKG_NAME}"
241
- s.rubyforge_project = "json"
139
+ s.license = 'Ruby'
242
140
  end
243
141
 
244
- Rake::GemPackageTask.new(spec_ext) do |pkg|
142
+ desc 'Creates a json.gemspec file'
143
+ task :gemspec_ext => :version do
144
+ File.open('json.gemspec', 'w') do |gemspec|
145
+ gemspec.write skip_sdoc(spec_ext.to_ruby)
146
+ end
147
+ end
148
+
149
+ Gem::PackageTask.new(spec_ext) do |pkg|
245
150
  pkg.need_tar = true
246
151
  pkg.package_files = PKG_FILES
247
152
  end
248
153
 
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
257
154
 
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'
265
- end
155
+ desc 'Create all gemspec files'
156
+ task :gemspec => [ :gemspec_pure, :gemspec_ext ]
266
157
  end
267
158
 
268
159
  desc m = "Writing version information for #{PKG_VERSION}"
@@ -282,11 +173,240 @@ EOT
282
173
  end
283
174
  end
284
175
 
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"
176
+ desc "Testing library (pure ruby)"
177
+ task :test_pure => [ :clean, :do_test_pure ]
178
+
179
+ UndocumentedTestTask.new do |t|
180
+ t.name = 'do_test_pure'
181
+ t.libs << 'lib'
182
+ t.test_files = FileList['tests/test_*.rb']
183
+ t.verbose = true
184
+ t.options = '-v'
185
+ end
186
+
187
+ desc "Testing library (pure ruby and extension)"
188
+ task :test do
189
+ sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
190
+ sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
191
+ end
192
+
193
+ namespace :gems do
194
+ desc 'Install all development gems'
195
+ task :install do
196
+ sh "#{BUNDLE}"
197
+ end
198
+ end
199
+
200
+ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
201
+ if ENV.key?('JAVA_HOME')
202
+ warn " *** JAVA_HOME was set to #{ENV['JAVA_HOME'].inspect}"
203
+ elsif File.directory?(local_java = '/usr/local/java/jdk') ||
204
+ File.directory?(local_java = '/usr/lib/jvm/java-6-openjdk')
205
+ then
206
+ ENV['JAVA_HOME'] = local_java
207
+ end
208
+ if ENV['JAVA_HOME']
209
+ warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}"
210
+ ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':'
211
+ warn " *** java binaries are assumed to be in #{java_path.inspect}"
212
+ else
213
+ warn " *** JAVA_HOME was not set or could not be guessed!"
214
+ exit 1
215
+ end
216
+
217
+ file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do
218
+ cd JAVA_DIR do
219
+ if RAGEL_CODEGEN == 'ragel'
220
+ sh "ragel Parser.rl -J -o Parser.java"
221
+ else
222
+ sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
223
+ end
224
+ end
225
+ end
226
+
227
+ desc "Generate parser for java with ragel"
228
+ task :ragel => JAVA_PARSER_SRC
229
+
230
+ desc "Delete the ragel generated Java source"
231
+ task :ragel_clean do
232
+ rm_rf JAVA_PARSER_SRC
233
+ end
234
+
235
+ JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar")
236
+ if File.exist?(JRUBY_JAR)
237
+ JAVA_SOURCES.each do |src|
238
+ classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':'
239
+ obj = src.sub(/\.java\Z/, '.class')
240
+ file obj => src do
241
+ sh 'javac', '-classpath', classpath, '-source', '1.5', '-target', '1.5', src
242
+ end
243
+ JAVA_CLASSES << obj
244
+ end
245
+ else
246
+ warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!"
247
+ end
248
+
249
+ desc "Compiling jruby extension"
250
+ task :compile => JAVA_CLASSES
251
+
252
+ desc "Package the jruby gem"
253
+ task :jruby_gem => :create_jar do
254
+ sh 'gem build json-java.gemspec'
255
+ mkdir_p 'pkg'
256
+ mv "json-#{PKG_VERSION}-java.gem", 'pkg'
257
+ end
258
+
259
+ desc "Testing library (jruby)"
260
+ task :test_ext => [ :create_jar, :do_test_ext ]
261
+
262
+ UndocumentedTestTask.new do |t|
263
+ t.name = 'do_test_ext'
264
+ t.libs << 'lib'
265
+ t.test_files = FileList['tests/test_*.rb']
266
+ t.verbose = true
267
+ t.options = '-v'
268
+ end
269
+
270
+ file JRUBY_PARSER_JAR => :compile do
271
+ cd 'java/src' do
272
+ parser_classes = FileList[
273
+ "json/ext/ByteListTranscoder*.class",
274
+ "json/ext/OptionsReader*.class",
275
+ "json/ext/Parser*.class",
276
+ "json/ext/RuntimeInfo*.class",
277
+ "json/ext/StringDecoder*.class",
278
+ "json/ext/Utils*.class"
279
+ ]
280
+ sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes
281
+ mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR)
282
+ end
283
+ end
284
+
285
+ desc "Create parser jar"
286
+ task :create_parser_jar => JRUBY_PARSER_JAR
287
+
288
+ file JRUBY_GENERATOR_JAR => :compile do
289
+ cd 'java/src' do
290
+ generator_classes = FileList[
291
+ "json/ext/ByteListTranscoder*.class",
292
+ "json/ext/OptionsReader*.class",
293
+ "json/ext/Generator*.class",
294
+ "json/ext/RuntimeInfo*.class",
295
+ "json/ext/StringEncoder*.class",
296
+ "json/ext/Utils*.class"
297
+ ]
298
+ sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes
299
+ mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR)
300
+ end
301
+ end
302
+
303
+ desc "Create generator jar"
304
+ task :create_generator_jar => JRUBY_GENERATOR_JAR
305
+
306
+ desc "Create parser and generator jars"
307
+ task :create_jar => [ :create_parser_jar, :create_generator_jar ]
308
+
309
+ desc "Build all gems and archives for a new release of the jruby extension."
310
+ task :build => [ :clean, :version, :jruby_gem ]
311
+
312
+ task :release => :build
313
+ else
314
+ desc "Compiling extension"
315
+ task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ]
316
+
317
+ file EXT_PARSER_DL => EXT_PARSER_SRC do
318
+ cd EXT_PARSER_DIR do
319
+ ruby 'extconf.rb'
320
+ sh MAKE
321
+ end
322
+ cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
323
+ end
324
+
325
+ file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
326
+ cd EXT_GENERATOR_DIR do
327
+ ruby 'extconf.rb'
328
+ sh MAKE
329
+ end
330
+ cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
331
+ end
332
+
333
+ desc "Testing library (extension)"
334
+ task :test_ext => [ :compile, :do_test_ext ]
335
+
336
+ UndocumentedTestTask.new do |t|
337
+ t.name = 'do_test_ext'
338
+ t.libs << 'ext' << 'lib'
339
+ t.test_files = FileList['tests/test_*.rb']
340
+ t.verbose = true
341
+ t.options = '-v'
342
+ end
343
+
344
+ desc "Create RDOC documentation"
345
+ task :doc => [ :version, EXT_PARSER_SRC ] do
346
+ sh "sdoc -o doc -t '#{PKG_TITLE}' -m README.rdoc README.rdoc lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
347
+ end
348
+
349
+ desc "Generate parser with ragel"
350
+ task :ragel => EXT_PARSER_SRC
351
+
352
+ desc "Delete the ragel generated C source"
353
+ task :ragel_clean do
354
+ rm_rf EXT_PARSER_SRC
355
+ end
356
+
357
+ desc "Update the tags file"
358
+ task :tags do
359
+ system 'ctags', *Dir['**/*.{rb,c,h,java}']
360
+ end
361
+
362
+ file EXT_PARSER_SRC => RAGEL_PATH do
363
+ cd EXT_PARSER_DIR do
364
+ if RAGEL_CODEGEN == 'ragel'
365
+ sh "ragel parser.rl -G2 -o parser.c"
366
+ else
367
+ sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2"
368
+ end
369
+ src = File.read("parser.c").gsub(/[ \t]+$/, '')
370
+ File.open("parser.c", "w") {|f| f.print src}
371
+ end
372
+ end
373
+
374
+ desc "Generate diagrams of ragel parser (ps)"
375
+ task :ragel_dot_ps do
376
+ root = 'diagrams'
377
+ specs = []
378
+ File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
379
+ for s in specs
380
+ if RAGEL_DOTGEN == 'ragel'
381
+ sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps"
382
+ else
383
+ sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps"
384
+ end
385
+ end
386
+ end
387
+
388
+ desc "Generate diagrams of ragel parser (png)"
389
+ task :ragel_dot_png do
390
+ root = 'diagrams'
391
+ specs = []
392
+ File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 }
393
+ for s in specs
394
+ if RAGEL_DOTGEN == 'ragel'
395
+ sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png"
396
+ else
397
+ sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png"
398
+ end
399
+ end
400
+ end
401
+
402
+ desc "Generate diagrams of ragel parser"
403
+ task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ]
404
+
405
+ desc "Build all gems and archives for a new release of json and json_pure."
406
+ task :build => [ :clean, :gemspec, :package ]
407
+
408
+ task :release => :build
289
409
  end
290
410
 
291
411
  desc "Compile in the the source directory"
292
- task :default => [ :version, :compile_ext ]
412
+ task :default => [ :clean, :gemspec, :test ]