wankel 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/LICENSE +20 -0
- data/README.md +43 -0
- data/Rakefile +63 -0
- data/benchmark/subjects/item.json +1 -0
- data/benchmark/subjects/ohai.json +1216 -0
- data/benchmark/subjects/twitter_search.json +1 -0
- data/benchmark/subjects/twitter_stream.json +430 -0
- data/ext/wankel/extconf.rb +15 -0
- data/ext/wankel/wankel.c +50 -0
- data/ext/wankel/wankel.h +17 -0
- data/ext/wankel/wankel_encoder.c +232 -0
- data/ext/wankel/wankel_encoder.h +13 -0
- data/ext/wankel/wankel_parser.c +345 -0
- data/ext/wankel/wankel_parser.h +26 -0
- data/ext/wankel/wankel_sax_encoder.c +290 -0
- data/ext/wankel/wankel_sax_encoder.h +13 -0
- data/ext/wankel/wankel_sax_parser.c +232 -0
- data/ext/wankel/wankel_sax_parser.h +23 -0
- data/ext/wankel/yajl_helpers.c +124 -0
- data/ext/wankel/yajl_helpers.h +22 -0
- data/lib/wankel/ex_sax_parser.rb +75 -0
- data/lib/wankel.rb +19 -0
- data/logo.png +0 -0
- data/test/encoding/encoding_test.rb +230 -0
- data/test/encoding/sax_encoder_test.rb +89 -0
- data/test/parsing/active_support_test.rb +66 -0
- data/test/parsing/fixtures/fail.15.json +1 -0
- data/test/parsing/fixtures/fail.16.json +1 -0
- data/test/parsing/fixtures/fail.17.json +1 -0
- data/test/parsing/fixtures/fail.26.json +1 -0
- data/test/parsing/fixtures/fail11.json +1 -0
- data/test/parsing/fixtures/fail12.json +1 -0
- data/test/parsing/fixtures/fail13.json +1 -0
- data/test/parsing/fixtures/fail14.json +1 -0
- data/test/parsing/fixtures/fail19.json +1 -0
- data/test/parsing/fixtures/fail20.json +1 -0
- data/test/parsing/fixtures/fail21.json +1 -0
- data/test/parsing/fixtures/fail22.json +1 -0
- data/test/parsing/fixtures/fail23.json +1 -0
- data/test/parsing/fixtures/fail24.json +1 -0
- data/test/parsing/fixtures/fail25.json +1 -0
- data/test/parsing/fixtures/fail27.json +2 -0
- data/test/parsing/fixtures/fail28.json +2 -0
- data/test/parsing/fixtures/fail3.json +1 -0
- data/test/parsing/fixtures/fail4.json +1 -0
- data/test/parsing/fixtures/fail5.json +1 -0
- data/test/parsing/fixtures/fail6.json +1 -0
- data/test/parsing/fixtures/fail9.json +1 -0
- data/test/parsing/fixtures/pass.array.json +6 -0
- data/test/parsing/fixtures/pass.codepoints_from_unicode_org.json +1 -0
- data/test/parsing/fixtures/pass.contacts.json +1 -0
- data/test/parsing/fixtures/pass.db100.xml.json +1 -0
- data/test/parsing/fixtures/pass.db1000.xml.json +1 -0
- data/test/parsing/fixtures/pass.dc_simple_with_comments.json +11 -0
- data/test/parsing/fixtures/pass.deep_arrays.json +1 -0
- data/test/parsing/fixtures/pass.difficult_json_c_test_case.json +1 -0
- data/test/parsing/fixtures/pass.difficult_json_c_test_case_with_comments.json +1 -0
- data/test/parsing/fixtures/pass.doubles.json +1 -0
- data/test/parsing/fixtures/pass.empty_array.json +1 -0
- data/test/parsing/fixtures/pass.empty_string.json +1 -0
- data/test/parsing/fixtures/pass.escaped_bulgarian.json +4 -0
- data/test/parsing/fixtures/pass.escaped_foobar.json +1 -0
- data/test/parsing/fixtures/pass.item.json +1 -0
- data/test/parsing/fixtures/pass.json-org-sample1.json +23 -0
- data/test/parsing/fixtures/pass.json-org-sample2.json +11 -0
- data/test/parsing/fixtures/pass.json-org-sample3.json +26 -0
- data/test/parsing/fixtures/pass.json-org-sample4-nows.json +88 -0
- data/test/parsing/fixtures/pass.json-org-sample4.json +89 -0
- data/test/parsing/fixtures/pass.json-org-sample5.json +27 -0
- data/test/parsing/fixtures/pass.map-spain.xml.json +1 -0
- data/test/parsing/fixtures/pass.ns-invoice100.xml.json +1 -0
- data/test/parsing/fixtures/pass.ns-soap.xml.json +1 -0
- data/test/parsing/fixtures/pass.numbers-fp-4k.json +6 -0
- data/test/parsing/fixtures/pass.numbers-fp-64k.json +61 -0
- data/test/parsing/fixtures/pass.numbers-int-4k.json +11 -0
- data/test/parsing/fixtures/pass.numbers-int-64k.json +154 -0
- data/test/parsing/fixtures/pass.twitter-search.json +1 -0
- data/test/parsing/fixtures/pass.twitter-search2.json +1 -0
- data/test/parsing/fixtures/pass.unicode.json +3315 -0
- data/test/parsing/fixtures/pass.yelp.json +1 -0
- data/test/parsing/fixtures/pass1.json +56 -0
- data/test/parsing/fixtures/pass2.json +1 -0
- data/test/parsing/fixtures/pass3.json +6 -0
- data/test/parsing/fixtures_test.rb +43 -0
- data/test/parsing/multiple_values_test.rb +100 -0
- data/test/parsing/one_off_test.rb +65 -0
- data/test/parsing/sax_parser_test.rb +125 -0
- data/test/performance.rb +135 -0
- data/test/test_helper.rb +36 -0
- data/test/wankel_test.rb +53 -0
- data/wankel.gemspec +23 -0
- metadata +259 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 16c5766bc7c52d73c0ab261c2b2557ce5c70a8a4
|
4
|
+
data.tar.gz: 88451d7b6edb81df276df3612507dd78158332ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e6e09d98f7bfe3684b7d47648c21c762529362ceaa02d390483b6a0c1824e28f5606169e72f7749b1a7ec2d4ed55eb82a03c87f08a8c66043df871ef17384ba
|
7
|
+
data.tar.gz: a9cdb73774d316c51a43d1550cc7ddcce2706c044eb0ec51c652e83e7f60c4257054bb8e849d096e3d3aeeabab473c2d5534a39a2b952a54c78b6a1f64cc3ce1
|
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Jonathan Bracy
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
<a href="vikingjs.org">![Wankel](/logo.png)</a>
|
2
|
+
|
3
|
+
Wankel is a Ruby gem that provides C bindings to the [YAJL 2](http://lloyd.github.io/yajl/)
|
4
|
+
C Library.
|
5
|
+
|
6
|
+
Wankel provides a gerneral parsing and encoding, but also a SAX style parser for
|
7
|
+
stream parsing and generation.
|
8
|
+
|
9
|
+
Features
|
10
|
+
--------
|
11
|
+
|
12
|
+
* SAX style JSON parsing and encoding
|
13
|
+
* JSON parsing and encoding directly to and from an IO stream (file, socket, etc)
|
14
|
+
or String.
|
15
|
+
* Parse and encode *multiple* JSON objects to and from streams or strings
|
16
|
+
continuously.
|
17
|
+
* JSON gem compatibility API - allows wankel to be used as a drop-in
|
18
|
+
replacement for the JSON gem
|
19
|
+
|
20
|
+
Dependencies
|
21
|
+
------------
|
22
|
+
|
23
|
+
Wankel only dependency is (YAJL)[http://lloyd.github.io/yajl/] version 2.
|
24
|
+
|
25
|
+
You can install it with homebrew via:
|
26
|
+
|
27
|
+
``` bash
|
28
|
+
brew install yajl
|
29
|
+
```
|
30
|
+
|
31
|
+
Installation
|
32
|
+
------------
|
33
|
+
|
34
|
+
Wankel is installed via Rubygems:
|
35
|
+
|
36
|
+
```
|
37
|
+
gem install wankel
|
38
|
+
```
|
39
|
+
|
40
|
+
Examples
|
41
|
+
--------
|
42
|
+
|
43
|
+
TODO
|
data/Rakefile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "rake/extensiontask"
|
2
|
+
require "rake/testtask"
|
3
|
+
require "rubygems/package_task"
|
4
|
+
require "rdoc/task"
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
if ENV['COVERALLS_REPO_TOKEN']
|
8
|
+
require 'simplecov'
|
9
|
+
require 'coveralls'
|
10
|
+
require 'coveralls/rake/task'
|
11
|
+
Coveralls::RakeTask.new
|
12
|
+
end
|
13
|
+
|
14
|
+
spec = Gem::Specification.load("wankel.gemspec")
|
15
|
+
|
16
|
+
# Setup compile tasks
|
17
|
+
Rake::ExtensionTask.new do |ext|
|
18
|
+
ext.gem_spec = spec
|
19
|
+
ext.name = 'wankel'
|
20
|
+
ext.ext_dir = 'ext/wankel'
|
21
|
+
ext.lib_dir = 'lib/wankel'
|
22
|
+
ext.config_options << '--coverage' if ENV['COVERALLS_REPO_TOKEN']
|
23
|
+
end
|
24
|
+
|
25
|
+
# Test Task
|
26
|
+
Rake::TestTask.new do |t|
|
27
|
+
t.libs << 'lib' << 'test'
|
28
|
+
t.test_files = FileList['test/**/*_test.rb']
|
29
|
+
# t.warning = true
|
30
|
+
# t.verbose = true
|
31
|
+
end
|
32
|
+
Rake::Task[:test].prerequisites << :compile
|
33
|
+
|
34
|
+
task :c_coverage do
|
35
|
+
out_dir = "tmp/#{RUBY_PLATFORM}/wankel/#{RUBY_VERSION}"
|
36
|
+
src_dir = 'ext/wankel'
|
37
|
+
src_files = FileList["#{src_dir}/*.c"]
|
38
|
+
FileUtils.cp(src_files, out_dir)
|
39
|
+
src_files.map! { |f| File.basename(f) }
|
40
|
+
`cd "#{out_dir}" && gcov #{src_files.join(" ")}`
|
41
|
+
raise 'gcov error' if $? != 0
|
42
|
+
|
43
|
+
data = SimpleCov::ResultMerger.resultset
|
44
|
+
|
45
|
+
src_files.each do |f|
|
46
|
+
file_data = File.read("#{out_dir}/#{f}.gcov").split("\n").map{|l| l.gsub(/\s+/,' ').split(' ') }
|
47
|
+
file_data = file_data.select{|l| l[1].sub(/:.*$/,'').to_i != 0 }
|
48
|
+
file_data.map! do |l|
|
49
|
+
case l[0]
|
50
|
+
when '-:'
|
51
|
+
nil
|
52
|
+
when '#####:'
|
53
|
+
0
|
54
|
+
else
|
55
|
+
l[0].sub(/:.*$/,'').to_i
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
data["Unit Tests"]["coverage"]["#{File.dirname(__FILE__)}/#{src_dir}/#{f}"] = file_data
|
60
|
+
|
61
|
+
SimpleCov::ResultMerger.store_result(data)
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"item": {"name": "generated", "cached_tag_list": "", "updated_at": "2009-03-24T05:25:09Z", "updated_by_id": null, "price": 1.99, "delta": false, "cost": 0.597, "account_id": 16, "unit": null, "import_tag": null, "taxable": true, "id": 1, "created_by_id": null, "description": null, "company_id": 0, "sku": "06317-0306", "created_at": "2009-03-24T05:25:09Z", "active": true}}
|