brianmario-yajl-ruby 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +25 -23
- data/Rakefile +11 -1
- data/VERSION.yml +2 -2
- data/benchmark/encode.rb +1 -1
- data/benchmark/encode_json_and_marshal.rb +1 -1
- data/benchmark/encode_json_and_yaml.rb +1 -1
- data/benchmark/parse.rb +1 -1
- data/benchmark/parse_json_and_marshal.rb +1 -1
- data/benchmark/parse_json_and_yaml.rb +1 -1
- data/benchmark/subjects/unicode.json +1 -3315
- data/ext/api/yajl_common.h +85 -0
- data/ext/api/yajl_gen.h +123 -0
- data/ext/api/yajl_parse.h +179 -0
- data/ext/extconf.rb +2 -8
- data/ext/yajl.c +128 -260
- data/ext/yajl_alloc.c +65 -0
- data/ext/yajl_alloc.h +50 -0
- data/ext/yajl_buf.c +119 -0
- data/ext/yajl_buf.h +73 -0
- data/ext/yajl_bytestack.h +85 -0
- data/ext/yajl_encode.c +179 -0
- data/ext/yajl_encode.h +44 -0
- data/ext/yajl_ext.c +283 -0
- data/ext/{yajl.h → yajl_ext.h} +2 -2
- data/ext/yajl_gen.c +295 -0
- data/ext/yajl_lex.c +737 -0
- data/ext/yajl_lex.h +133 -0
- data/ext/yajl_parser.c +445 -0
- data/ext/yajl_parser.h +79 -0
- data/lib/yajl/bzip2.rb +1 -1
- data/lib/yajl/deflate.rb +1 -1
- data/lib/yajl/gzip.rb +1 -1
- data/lib/yajl/http_stream.rb +1 -1
- data/lib/yajl.rb +1 -1
- data/spec/encoding/encoding_spec.rb +23 -0
- data/spec/http/{http.bzip2.dump → fixtures/http.bzip2.dump} +0 -0
- data/spec/http/{http.deflate.dump → fixtures/http.deflate.dump} +0 -0
- data/spec/http/{http.gzip.dump → fixtures/http.gzip.dump} +0 -0
- data/spec/http/{http.raw.dump → fixtures/http.raw.dump} +0 -0
- data/spec/http/http_spec.rb +98 -0
- data/spec/{active_support_spec.rb → parsing/active_support_spec.rb} +1 -1
- data/spec/{fixtures → parsing/fixtures}/fail.15.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail.16.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail.17.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail.26.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail11.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail12.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail13.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail14.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail19.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail20.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail21.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail22.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail23.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail24.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail25.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail27.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail28.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail3.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail4.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail5.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail6.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/fail9.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.array.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.codepoints_from_unicode_org.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.contacts.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.db100.xml.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.db1000.xml.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.dc_simple_with_comments.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.deep_arrays.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.difficult_json_c_test_case.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.difficult_json_c_test_case_with_comments.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.doubles.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.empty_array.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.empty_string.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.escaped_bulgarian.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.escaped_foobar.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.item.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample1.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample2.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample3.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample4-nows.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample4.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.json-org-sample5.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.map-spain.xml.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.ns-invoice100.xml.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.ns-soap.xml.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.numbers-fp-4k.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.numbers-fp-64k.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.numbers-int-4k.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.numbers-int-64k.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.twitter-search.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.twitter-search2.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.unicode.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass.yelp.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass1.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass2.json +0 -0
- data/spec/{fixtures → parsing/fixtures}/pass3.json +0 -0
- data/spec/{fixtures_spec.rb → parsing/fixtures_spec.rb} +1 -1
- data/spec/{one_off_spec.rb → parsing/one_off_spec.rb} +1 -1
- data/yajl-ruby.gemspec +91 -72
- metadata +91 -71
- data/benchmark/subjects/yelp.json +0 -1
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
0.4.7 (May 18th, 2009)
|
4
|
+
* Bundling Yajl sources to remove the need to install them (and CMake) separately (Thank you Lloyd!!!)
|
5
|
+
This means you can now simply install the gem and be off and running
|
6
|
+
* Added some spec tests for Yajl::HttpStream
|
7
|
+
* Added some spec tests for Yajl::Stream.encode
|
8
|
+
* added some more thank you's, where credit's due - in the readme
|
9
|
+
* updated the unicode.json file to reflect a "real-life" JSON response
|
10
|
+
* reorganized spec tests into their functional areas
|
11
|
+
* added an rcov rake task to generate code coverage output
|
12
|
+
|
3
13
|
0.4.6 (May 17th, 2009)
|
4
14
|
* Applied a patch from benburkert (http://github.com/benburkert) to fix HTTP Basic Auth in
|
5
15
|
Yajl::HttpStream.get
|
data/README.rdoc
CHANGED
@@ -4,11 +4,19 @@ This gem (although not in gem form just yet) is a C binding to the excellent YAJ
|
|
4
4
|
|
5
5
|
You can read more info at the projects website http://lloydforge.org/projects/yajl or check out it's codes at http://github.com/lloyd/yajl.
|
6
6
|
|
7
|
+
== How to install
|
8
|
+
|
9
|
+
Install it like any other gem hosted at the Githubs like so:
|
10
|
+
|
11
|
+
(more instructions here: http://gems.github.com)
|
12
|
+
|
13
|
+
sudo gem install brianmario-yajl-ruby
|
14
|
+
|
7
15
|
== Example of use
|
8
16
|
|
9
|
-
First, you're probably gonna want to
|
17
|
+
First, you're probably gonna want to require it:
|
10
18
|
|
11
|
-
|
19
|
+
require 'yajl'
|
12
20
|
|
13
21
|
=== Parsing
|
14
22
|
|
@@ -16,12 +24,12 @@ Then maybe parse some JSON from:
|
|
16
24
|
|
17
25
|
a File IO
|
18
26
|
|
19
|
-
|
27
|
+
json = File.new('test.json', 'r')
|
20
28
|
hash = Yajl::Stream.parse(json)
|
21
29
|
|
22
30
|
or maybe a StringIO
|
23
31
|
|
24
|
-
|
32
|
+
json = StringIO.new
|
25
33
|
hash = Yajl::Stream.parse(json)
|
26
34
|
|
27
35
|
or maybe STDIN
|
@@ -104,25 +112,14 @@ There are a lot more possibilities, some of which I'm going to write other gems/
|
|
104
112
|
|
105
113
|
Some ideas are:
|
106
114
|
* parsing logs in JSON format
|
107
|
-
*
|
115
|
+
* a Rails plugin (http://github.com/technoweenie/yajl-rails)
|
116
|
+
* builtin Rails 3 support?
|
108
117
|
* Rack middleware (ideally the JSON body could be handed to the parser while it's still being received)
|
109
118
|
* use with ohai
|
110
119
|
* JSON API clients
|
111
120
|
* Patch Marshal#load and Marshal#dump to use JSON? ;)
|
112
121
|
* etc...
|
113
122
|
|
114
|
-
== How to install
|
115
|
-
|
116
|
-
First, Yajl uses CMake to build itself (yes, the author realizes this isn't the norm for open source and is willing and ready to accept patches, fork away kids!) so you'll need to grab it first from http://www.cmake.org.
|
117
|
-
|
118
|
-
After you've got that, grab the latest version (I suggest at least 1.0.4 as it contains fixes for Unicode parsing) of Yajl itself from the Githubs at http://github.com/lloyd/yajl.
|
119
|
-
|
120
|
-
After you have that installed, you should be able to install it like any other gem hosted here like so:
|
121
|
-
|
122
|
-
(more instructions here: http://gems.github.com)
|
123
|
-
|
124
|
-
sudo gem install brianmario-yajl-ruby
|
125
|
-
|
126
123
|
== Benchmarks
|
127
124
|
|
128
125
|
After I finished implementation - this library performs close to the same as the current JSON.parse (C gem) does on small/medium files.
|
@@ -176,13 +173,18 @@ NOTE: I converted the 2.4MB JSON file to YAML for this test.
|
|
176
173
|
* JSON#to_json: 6.6s
|
177
174
|
* YAML.dump(obj, io): 1309.93s
|
178
175
|
|
176
|
+
== Third Party Sources Bundled
|
177
|
+
|
178
|
+
This project includes code from the BSD licensed yajl project, copyright 2007-2009 Lloyd Hilaiel
|
179
|
+
|
179
180
|
== Special Thanks
|
180
181
|
|
181
182
|
I've had a lot of inspiration, and a lot of help. Thanks to everyone who's been a part of this and those to come!
|
182
183
|
|
183
|
-
* Lloyd Hilaiel
|
184
|
-
* Josh Ferguson
|
185
|
-
* Jonathan Novak
|
186
|
-
* Tom Smith
|
187
|
-
* Rick
|
188
|
-
* The entire Github Crew - my inspiration, time spent writing this, finding Yajl, So many-MANY other things wouldn't have been possible without this awesome service. I owe you guys some whiskey at Kilowatt.
|
184
|
+
* Lloyd Hilaiel - http://github.com/lloyd - for writing Yajl!!
|
185
|
+
* Josh Ferguson - http://github.com/besquared - for peer-pressuring me into getting back into C; it worked ;) Also tons of support over IM
|
186
|
+
* Jonathan Novak - http://github.com/cypriss - pointer-hacking help
|
187
|
+
* Tom Smith - http://github.com/rtomsmith - pointer-hacking help
|
188
|
+
* Rick http://github.com/technoweenie - for making an ActiveSupport patch with support for this library and teasing me that it might go into Rails 3. You sure lit a fire under my ass and I got a ton of work done because of it! :)
|
189
|
+
* The entire Github Crew - http://github.com/ - my inspiration, time spent writing this, finding Yajl, So many-MANY other things wouldn't have been possible without this awesome service. I owe you guys some whiskey at Kilowatt.
|
190
|
+
* benburkert - http://github.com/benburkert
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
gem.summary = "Ruby C bindings to the excellent Yajl JSON stream-based parser library."
|
7
7
|
gem.email = "seniorlopez@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/brianmario/yajl-ruby"
|
9
|
-
gem.authors = ["Brian Lopez"]
|
9
|
+
gem.authors = ["Brian Lopez", "Lloyd Hilaiel"]
|
10
10
|
gem.require_paths = ["lib", "ext"]
|
11
11
|
gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
@@ -16,4 +16,14 @@ begin
|
|
16
16
|
end
|
17
17
|
rescue LoadError
|
18
18
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake'
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
|
24
|
+
desc "Run all examples with RCov"
|
25
|
+
Spec::Rake::SpecTask.new('spec_with_rcov') do |t|
|
26
|
+
t.spec_files = FileList['spec/']
|
27
|
+
t.rcov = true
|
28
|
+
t.rcov_opts = ['--exclude', 'spec', '--spec-only']
|
19
29
|
end
|
data/VERSION.yml
CHANGED
data/benchmark/encode.rb
CHANGED
data/benchmark/parse.rb
CHANGED