scout 5.7.1 → 5.7.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +5 -0
- data/lib/scout/command/run.rb +1 -1
- data/lib/scout/server.rb +2 -1
- data/lib/scout/streamer.rb +3 -2
- data/lib/scout/streamer_daemon.rb +4 -4
- data/lib/scout/version.rb +1 -1
- data/test/scout_test.rb +7 -8
- data/vendor/httpclient/README.txt +759 -0
- data/vendor/httpclient/bin/httpclient +65 -0
- data/vendor/httpclient/lib/hexdump.rb +50 -0
- data/vendor/httpclient/lib/http-access2.rb +55 -0
- data/vendor/httpclient/lib/http-access2/cookie.rb +1 -0
- data/vendor/httpclient/lib/http-access2/http.rb +1 -0
- data/vendor/httpclient/lib/httpclient.rb +1156 -0
- data/vendor/httpclient/lib/httpclient/auth.rb +899 -0
- data/vendor/httpclient/lib/httpclient/cacert.p7s +1912 -0
- data/vendor/httpclient/lib/httpclient/connection.rb +88 -0
- data/vendor/httpclient/lib/httpclient/cookie.rb +438 -0
- data/vendor/httpclient/lib/httpclient/http.rb +1046 -0
- data/vendor/httpclient/lib/httpclient/include_client.rb +83 -0
- data/vendor/httpclient/lib/httpclient/session.rb +1025 -0
- data/vendor/httpclient/lib/httpclient/ssl_config.rb +403 -0
- data/vendor/httpclient/lib/httpclient/timeout.rb +140 -0
- data/vendor/httpclient/lib/httpclient/util.rb +178 -0
- data/vendor/httpclient/lib/httpclient/version.rb +3 -0
- data/vendor/httpclient/lib/oauthclient.rb +110 -0
- data/vendor/httpclient/sample/async.rb +8 -0
- data/vendor/httpclient/sample/auth.rb +11 -0
- data/vendor/httpclient/sample/cookie.rb +18 -0
- data/vendor/httpclient/sample/dav.rb +103 -0
- data/vendor/httpclient/sample/howto.rb +49 -0
- data/vendor/httpclient/sample/oauth_buzz.rb +57 -0
- data/vendor/httpclient/sample/oauth_friendfeed.rb +59 -0
- data/vendor/httpclient/sample/oauth_salesforce_10.rb +63 -0
- data/vendor/httpclient/sample/oauth_twitter.rb +61 -0
- data/vendor/httpclient/sample/ssl/0cert.pem +22 -0
- data/vendor/httpclient/sample/ssl/0key.pem +30 -0
- data/vendor/httpclient/sample/ssl/1000cert.pem +19 -0
- data/vendor/httpclient/sample/ssl/1000key.pem +18 -0
- data/vendor/httpclient/sample/ssl/htdocs/index.html +10 -0
- data/vendor/httpclient/sample/ssl/ssl_client.rb +22 -0
- data/vendor/httpclient/sample/ssl/webrick_httpsd.rb +29 -0
- data/vendor/httpclient/sample/stream.rb +21 -0
- data/vendor/httpclient/sample/thread.rb +27 -0
- data/vendor/httpclient/sample/wcat.rb +21 -0
- data/vendor/httpclient/test/ca-chain.cert +44 -0
- data/vendor/httpclient/test/ca.cert +23 -0
- data/vendor/httpclient/test/client.cert +19 -0
- data/vendor/httpclient/test/client.key +15 -0
- data/vendor/httpclient/test/helper.rb +129 -0
- data/vendor/httpclient/test/htdigest +1 -0
- data/vendor/httpclient/test/htpasswd +2 -0
- data/vendor/httpclient/test/runner.rb +2 -0
- data/vendor/httpclient/test/server.cert +19 -0
- data/vendor/httpclient/test/server.key +15 -0
- data/vendor/httpclient/test/sslsvr.rb +65 -0
- data/vendor/httpclient/test/subca.cert +21 -0
- data/vendor/httpclient/test/test_auth.rb +321 -0
- data/vendor/httpclient/test/test_cookie.rb +391 -0
- data/vendor/httpclient/test/test_hexdump.rb +14 -0
- data/vendor/httpclient/test/test_http-access2.rb +507 -0
- data/vendor/httpclient/test/test_httpclient.rb +1783 -0
- data/vendor/httpclient/test/test_include_client.rb +52 -0
- data/vendor/httpclient/test/test_ssl.rb +235 -0
- data/vendor/multi_json/.document +5 -0
- data/vendor/multi_json/.rspec +3 -0
- data/vendor/multi_json/.travis.yml +11 -0
- data/vendor/multi_json/.yardopts +6 -0
- data/vendor/multi_json/CHANGELOG.md +169 -0
- data/vendor/multi_json/CONTRIBUTING.md +46 -0
- data/vendor/multi_json/Gemfile +31 -0
- data/vendor/multi_json/LICENSE.md +20 -0
- data/vendor/multi_json/README.md +109 -0
- data/vendor/multi_json/Rakefile +12 -0
- data/vendor/multi_json/lib/multi_json.rb +157 -0
- data/vendor/multi_json/lib/multi_json/adapter.rb +48 -0
- data/vendor/multi_json/lib/multi_json/adapters/gson.rb +19 -0
- data/vendor/multi_json/lib/multi_json/adapters/jr_jackson.rb +19 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_common.rb +25 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_gem.rb +11 -0
- data/vendor/multi_json/lib/multi_json/adapters/json_pure.rb +11 -0
- data/vendor/multi_json/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
- data/vendor/multi_json/lib/multi_json/adapters/oj.rb +24 -0
- data/vendor/multi_json/lib/multi_json/adapters/ok_json.rb +22 -0
- data/vendor/multi_json/lib/multi_json/adapters/yajl.rb +19 -0
- data/vendor/multi_json/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/vendor/multi_json/lib/multi_json/load_error.rb +11 -0
- data/vendor/multi_json/lib/multi_json/options.rb +48 -0
- data/vendor/multi_json/lib/multi_json/vendor/okjson.rb +606 -0
- data/vendor/multi_json/lib/multi_json/version.rb +20 -0
- data/vendor/multi_json/multi_json.gemspec +22 -0
- data/vendor/multi_json/spec/adapter_shared_example.rb +235 -0
- data/vendor/multi_json/spec/has_options.rb +119 -0
- data/vendor/multi_json/spec/helper.rb +35 -0
- data/vendor/multi_json/spec/json_common_shared_example.rb +30 -0
- data/vendor/multi_json/spec/multi_json_spec.rb +226 -0
- data/vendor/{signature → pusher}/.document +0 -0
- data/vendor/{json_pure/diagrams/.keep → pusher/.gemtest} +0 -0
- data/vendor/pusher/.gitignore +23 -0
- data/vendor/pusher/.travis.yml +15 -0
- data/vendor/pusher/Gemfile +2 -0
- data/vendor/{pusher-gem → pusher}/LICENSE +1 -1
- data/vendor/pusher/README.md +186 -0
- data/vendor/{pusher-gem → pusher}/Rakefile +0 -0
- data/vendor/{pusher-gem → pusher}/examples/async_message.rb +0 -0
- data/vendor/pusher/lib/pusher.rb +60 -0
- data/vendor/{pusher-gem → pusher}/lib/pusher/channel.rb +47 -54
- data/vendor/pusher/lib/pusher/client.rb +306 -0
- data/vendor/pusher/lib/pusher/request.rb +107 -0
- data/vendor/pusher/lib/pusher/resource.rb +36 -0
- data/vendor/pusher/lib/pusher/webhook.rb +110 -0
- data/vendor/{pusher-gem → pusher}/pusher.gemspec +6 -5
- data/vendor/pusher/spec/channel_spec.rb +127 -0
- data/vendor/pusher/spec/client_spec.rb +464 -0
- data/vendor/{pusher-gem → pusher}/spec/spec_helper.rb +12 -0
- data/vendor/pusher/spec/web_hook_spec.rb +117 -0
- data/vendor/signature/.travis.yml +15 -0
- data/vendor/signature/Gemfile +1 -1
- data/vendor/signature/README.md +38 -28
- data/vendor/signature/lib/signature.rb +97 -15
- data/vendor/signature/lib/signature/query_encoder.rb +47 -0
- data/vendor/signature/lib/signature/version.rb +1 -1
- data/vendor/signature/signature.gemspec +3 -2
- data/vendor/signature/spec/signature_spec.rb +164 -55
- data/vendor/signature/spec/spec_helper.rb +2 -3
- metadata +120 -145
- data/vendor/json_pure/.gitignore +0 -12
- data/vendor/json_pure/.travis.yml +0 -20
- data/vendor/json_pure/CHANGES +0 -282
- data/vendor/json_pure/COPYING +0 -58
- data/vendor/json_pure/COPYING-json-jruby +0 -57
- data/vendor/json_pure/GPL +0 -340
- data/vendor/json_pure/Gemfile +0 -11
- data/vendor/json_pure/README-json-jruby.markdown +0 -33
- data/vendor/json_pure/README.rdoc +0 -358
- data/vendor/json_pure/Rakefile +0 -412
- data/vendor/json_pure/TODO +0 -1
- data/vendor/json_pure/VERSION +0 -1
- data/vendor/json_pure/data/example.json +0 -1
- data/vendor/json_pure/data/index.html +0 -38
- data/vendor/json_pure/data/prototype.js +0 -4184
- data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +0 -181
- data/vendor/json_pure/ext/json/ext/generator/depend +0 -1
- data/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -14
- data/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1435
- data/vendor/json_pure/ext/json/ext/generator/generator.h +0 -148
- data/vendor/json_pure/ext/json/ext/parser/depend +0 -1
- data/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -13
- data/vendor/json_pure/ext/json/ext/parser/parser.c +0 -2204
- data/vendor/json_pure/ext/json/ext/parser/parser.h +0 -77
- data/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -927
- data/vendor/json_pure/install.rb +0 -23
- data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +0 -167
- data/vendor/json_pure/java/src/json/ext/Generator.java +0 -444
- data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +0 -232
- data/vendor/json_pure/java/src/json/ext/GeneratorService.java +0 -43
- data/vendor/json_pure/java/src/json/ext/GeneratorState.java +0 -543
- data/vendor/json_pure/java/src/json/ext/OptionsReader.java +0 -114
- data/vendor/json_pure/java/src/json/ext/Parser.java +0 -2644
- data/vendor/json_pure/java/src/json/ext/Parser.rl +0 -968
- data/vendor/json_pure/java/src/json/ext/ParserService.java +0 -35
- data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +0 -121
- data/vendor/json_pure/java/src/json/ext/StringDecoder.java +0 -167
- data/vendor/json_pure/java/src/json/ext/StringEncoder.java +0 -106
- data/vendor/json_pure/java/src/json/ext/Utils.java +0 -89
- data/vendor/json_pure/json-java.gemspec +0 -23
- data/vendor/json_pure/json.gemspec +0 -37
- data/vendor/json_pure/json_pure.gemspec +0 -39
- data/vendor/json_pure/lib/json.rb +0 -62
- data/vendor/json_pure/lib/json/add/bigdecimal.rb +0 -28
- data/vendor/json_pure/lib/json/add/complex.rb +0 -22
- data/vendor/json_pure/lib/json/add/core.rb +0 -11
- data/vendor/json_pure/lib/json/add/date.rb +0 -34
- data/vendor/json_pure/lib/json/add/date_time.rb +0 -50
- data/vendor/json_pure/lib/json/add/exception.rb +0 -31
- data/vendor/json_pure/lib/json/add/ostruct.rb +0 -31
- data/vendor/json_pure/lib/json/add/range.rb +0 -29
- data/vendor/json_pure/lib/json/add/rational.rb +0 -22
- data/vendor/json_pure/lib/json/add/regexp.rb +0 -30
- data/vendor/json_pure/lib/json/add/struct.rb +0 -30
- data/vendor/json_pure/lib/json/add/symbol.rb +0 -25
- data/vendor/json_pure/lib/json/add/time.rb +0 -38
- data/vendor/json_pure/lib/json/common.rb +0 -487
- data/vendor/json_pure/lib/json/ext.rb +0 -21
- data/vendor/json_pure/lib/json/ext/.keep +0 -0
- data/vendor/json_pure/lib/json/generic_object.rb +0 -70
- data/vendor/json_pure/lib/json/pure.rb +0 -21
- data/vendor/json_pure/lib/json/pure/generator.rb +0 -522
- data/vendor/json_pure/lib/json/pure/parser.rb +0 -359
- data/vendor/json_pure/lib/json/version.rb +0 -8
- data/vendor/json_pure/tests/fixtures/fail1.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail10.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail11.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail12.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail13.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail14.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail18.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail19.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail2.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail20.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail21.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail22.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail23.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail24.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail25.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail27.json +0 -2
- data/vendor/json_pure/tests/fixtures/fail28.json +0 -2
- data/vendor/json_pure/tests/fixtures/fail3.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail4.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail5.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail6.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail7.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail8.json +0 -1
- data/vendor/json_pure/tests/fixtures/fail9.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass1.json +0 -56
- data/vendor/json_pure/tests/fixtures/pass15.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass16.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass17.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass2.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass26.json +0 -1
- data/vendor/json_pure/tests/fixtures/pass3.json +0 -6
- data/vendor/json_pure/tests/setup_variant.rb +0 -11
- data/vendor/json_pure/tests/test_json.rb +0 -545
- data/vendor/json_pure/tests/test_json_addition.rb +0 -196
- data/vendor/json_pure/tests/test_json_encoding.rb +0 -65
- data/vendor/json_pure/tests/test_json_fixtures.rb +0 -35
- data/vendor/json_pure/tests/test_json_generate.rb +0 -322
- data/vendor/json_pure/tests/test_json_generic_object.rb +0 -75
- data/vendor/json_pure/tests/test_json_string_matching.rb +0 -39
- data/vendor/json_pure/tests/test_json_unicode.rb +0 -72
- data/vendor/json_pure/tools/fuzz.rb +0 -139
- data/vendor/json_pure/tools/server.rb +0 -62
- data/vendor/pusher-gem/Gemfile +0 -2
- data/vendor/pusher-gem/README.md +0 -80
- data/vendor/pusher-gem/lib/pusher.rb +0 -107
- data/vendor/pusher-gem/lib/pusher/request.rb +0 -107
- data/vendor/pusher-gem/spec/channel_spec.rb +0 -274
- data/vendor/pusher-gem/spec/pusher_spec.rb +0 -87
- data/vendor/ruby-hmac/History.txt +0 -15
- data/vendor/ruby-hmac/Manifest.txt +0 -11
- data/vendor/ruby-hmac/README.md +0 -41
- data/vendor/ruby-hmac/Rakefile +0 -23
- data/vendor/ruby-hmac/lib/hmac-md5.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-rmd160.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-sha1.rb +0 -11
- data/vendor/ruby-hmac/lib/hmac-sha2.rb +0 -25
- data/vendor/ruby-hmac/lib/hmac.rb +0 -118
- data/vendor/ruby-hmac/lib/ruby_hmac.rb +0 -2
- data/vendor/ruby-hmac/ruby-hmac.gemspec +0 -33
- data/vendor/ruby-hmac/test/test_hmac.rb +0 -89
- data/vendor/signature/VERSION +0 -1
@@ -1,75 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require File.join(File.dirname(__FILE__), 'setup_variant')
|
6
|
-
class TestJSONGenericObject < Test::Unit::TestCase
|
7
|
-
include JSON
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@go = GenericObject[ :a => 1, :b => 2 ]
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_attributes
|
14
|
-
assert_equal 1, @go.a
|
15
|
-
assert_equal 1, @go[:a]
|
16
|
-
assert_equal 2, @go.b
|
17
|
-
assert_equal 2, @go[:b]
|
18
|
-
assert_nil @go.c
|
19
|
-
assert_nil @go[:c]
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_generate_json
|
23
|
-
switch_json_creatable do
|
24
|
-
assert_equal @go, JSON(JSON(@go), :create_additions => true)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_parse_json
|
29
|
-
assert_kind_of Hash, JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
|
30
|
-
switch_json_creatable do
|
31
|
-
assert_equal @go, l = JSON('{ "json_class": "JSON::GenericObject", "a": 1, "b": 2 }', :create_additions => true)
|
32
|
-
assert_equal 1, l.a
|
33
|
-
assert_equal @go, l = JSON('{ "a": 1, "b": 2 }', :object_class => GenericObject)
|
34
|
-
assert_equal 1, l.a
|
35
|
-
assert_equal GenericObject[:a => GenericObject[:b => 2]],
|
36
|
-
l = JSON('{ "a": { "b": 2 } }', :object_class => GenericObject)
|
37
|
-
assert_equal 2, l.a.b
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_from_hash
|
42
|
-
result = GenericObject.from_hash(
|
43
|
-
:foo => { :bar => { :baz => true }, :quux => [ { :foobar => true } ] })
|
44
|
-
assert_kind_of GenericObject, result.foo
|
45
|
-
assert_kind_of GenericObject, result.foo.bar
|
46
|
-
assert_equal true, result.foo.bar.baz
|
47
|
-
assert_kind_of GenericObject, result.foo.quux.first
|
48
|
-
assert_equal true, result.foo.quux.first.foobar
|
49
|
-
assert_equal true, GenericObject.from_hash(true)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_json_generic_object_load
|
53
|
-
empty = JSON::GenericObject.load(nil)
|
54
|
-
assert_kind_of JSON::GenericObject, empty
|
55
|
-
simple_json = '{"json_class":"JSON::GenericObject","hello":"world"}'
|
56
|
-
simple = JSON::GenericObject.load(simple_json)
|
57
|
-
assert_kind_of JSON::GenericObject, simple
|
58
|
-
assert_equal "world", simple.hello
|
59
|
-
converting = JSON::GenericObject.load('{ "hello": "world" }')
|
60
|
-
assert_kind_of JSON::GenericObject, converting
|
61
|
-
assert_equal "world", converting.hello
|
62
|
-
|
63
|
-
json = JSON::GenericObject.dump(JSON::GenericObject[:hello => 'world'])
|
64
|
-
assert_equal JSON(json), JSON('{"json_class":"JSON::GenericObject","hello":"world"}')
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def switch_json_creatable
|
70
|
-
JSON::GenericObject.json_creatable = true
|
71
|
-
yield
|
72
|
-
ensure
|
73
|
-
JSON::GenericObject.json_creatable = false
|
74
|
-
end
|
75
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require File.join(File.dirname(__FILE__), 'setup_variant')
|
6
|
-
require 'stringio'
|
7
|
-
require 'time'
|
8
|
-
|
9
|
-
class TestJSONStringMatching < Test::Unit::TestCase
|
10
|
-
include JSON
|
11
|
-
|
12
|
-
class TestTime < ::Time
|
13
|
-
def self.json_create(string)
|
14
|
-
Time.parse(string)
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_json(*)
|
18
|
-
%{"#{strftime('%FT%T%z')}"}
|
19
|
-
end
|
20
|
-
|
21
|
-
def ==(other)
|
22
|
-
to_i == other.to_i
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_match_date
|
27
|
-
t = TestTime.new
|
28
|
-
t_json = [ t ].to_json
|
29
|
-
assert_equal [ t ],
|
30
|
-
JSON.parse(t_json, :create_additions => true,
|
31
|
-
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
|
32
|
-
assert_equal [ t.strftime('%FT%T%z') ],
|
33
|
-
JSON.parse(t_json, :create_additions => true,
|
34
|
-
:match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
|
35
|
-
assert_equal [ t.strftime('%FT%T%z') ],
|
36
|
-
JSON.parse(t_json,
|
37
|
-
:match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
|
38
|
-
end
|
39
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require File.join(File.dirname(__FILE__), 'setup_variant')
|
6
|
-
|
7
|
-
class TestJSONUnicode < Test::Unit::TestCase
|
8
|
-
include JSON
|
9
|
-
|
10
|
-
def test_unicode
|
11
|
-
assert_equal '""', ''.to_json
|
12
|
-
assert_equal '"\\b"', "\b".to_json
|
13
|
-
assert_equal '"\u0001"', 0x1.chr.to_json
|
14
|
-
assert_equal '"\u001f"', 0x1f.chr.to_json
|
15
|
-
assert_equal '" "', ' '.to_json
|
16
|
-
assert_equal "\"#{0x7f.chr}\"", 0x7f.chr.to_json
|
17
|
-
utf8 = [ "© ≠ €! \01" ]
|
18
|
-
json = '["© ≠ €! \u0001"]'
|
19
|
-
assert_equal json, utf8.to_json(:ascii_only => false)
|
20
|
-
assert_equal utf8, parse(json)
|
21
|
-
json = '["\u00a9 \u2260 \u20ac! \u0001"]'
|
22
|
-
assert_equal json, utf8.to_json(:ascii_only => true)
|
23
|
-
assert_equal utf8, parse(json)
|
24
|
-
utf8 = ["\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212"]
|
25
|
-
json = "[\"\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212\"]"
|
26
|
-
assert_equal utf8, parse(json)
|
27
|
-
assert_equal json, utf8.to_json(:ascii_only => false)
|
28
|
-
utf8 = ["\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212"]
|
29
|
-
assert_equal utf8, parse(json)
|
30
|
-
json = "[\"\\u3042\\u3044\\u3046\\u3048\\u304a\"]"
|
31
|
-
assert_equal json, utf8.to_json(:ascii_only => true)
|
32
|
-
assert_equal utf8, parse(json)
|
33
|
-
utf8 = ['საქართველო']
|
34
|
-
json = '["საქართველო"]'
|
35
|
-
assert_equal json, utf8.to_json(:ascii_only => false)
|
36
|
-
json = "[\"\\u10e1\\u10d0\\u10e5\\u10d0\\u10e0\\u10d7\\u10d5\\u10d4\\u10da\\u10dd\"]"
|
37
|
-
assert_equal json, utf8.to_json(:ascii_only => true)
|
38
|
-
assert_equal utf8, parse(json)
|
39
|
-
assert_equal '["Ã"]', JSON.generate(["Ã"], :ascii_only => false)
|
40
|
-
assert_equal '["\\u00c3"]', JSON.generate(["Ã"], :ascii_only => true)
|
41
|
-
assert_equal ["€"], JSON.parse('["\u20ac"]')
|
42
|
-
utf8 = ["\xf0\xa0\x80\x81"]
|
43
|
-
json = "[\"\xf0\xa0\x80\x81\"]"
|
44
|
-
assert_equal json, JSON.generate(utf8, :ascii_only => false)
|
45
|
-
assert_equal utf8, JSON.parse(json)
|
46
|
-
json = '["\ud840\udc01"]'
|
47
|
-
assert_equal json, JSON.generate(utf8, :ascii_only => true)
|
48
|
-
assert_equal utf8, JSON.parse(json)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_chars
|
52
|
-
(0..0x7f).each do |i|
|
53
|
-
json = '["\u%04x"]' % i
|
54
|
-
if RUBY_VERSION >= "1.9."
|
55
|
-
i = i.chr
|
56
|
-
end
|
57
|
-
assert_equal i, JSON.parse(json).first[0]
|
58
|
-
if i == ?\b
|
59
|
-
generated = JSON.generate(["" << i])
|
60
|
-
assert '["\b"]' == generated || '["\10"]' == generated
|
61
|
-
elsif [?\n, ?\r, ?\t, ?\f].include?(i)
|
62
|
-
assert_equal '[' << ('' << i).dump << ']', JSON.generate(["" << i])
|
63
|
-
elsif i.chr < 0x20.chr
|
64
|
-
assert_equal json, JSON.generate(["" << i])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
assert_raise(JSON::GeneratorError) do
|
68
|
-
JSON.generate(["\x80"], :ascii_only => true)
|
69
|
-
end
|
70
|
-
assert_equal "\302\200", JSON.parse('["\u0080"]').first
|
71
|
-
end
|
72
|
-
end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
require 'iconv'
|
4
|
-
ISO_8859_1_TO_UTF8 = Iconv.new('utf-8', 'iso-8859-15')
|
5
|
-
class ::String
|
6
|
-
def to_utf8
|
7
|
-
ISO_8859_1_TO_UTF8.iconv self
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Fuzzer
|
12
|
-
def initialize(n, freqs = {})
|
13
|
-
sum = freqs.inject(0.0) { |s, x| s + x.last }
|
14
|
-
freqs.each_key { |x| freqs[x] /= sum }
|
15
|
-
s = 0.0
|
16
|
-
freqs.each_key do |x|
|
17
|
-
freqs[x] = s .. (s + t = freqs[x])
|
18
|
-
s += t
|
19
|
-
end
|
20
|
-
@freqs = freqs
|
21
|
-
@n = n
|
22
|
-
@alpha = (0..0xff).to_a
|
23
|
-
end
|
24
|
-
|
25
|
-
def random_string
|
26
|
-
s = ''
|
27
|
-
30.times { s << @alpha[rand(@alpha.size)] }
|
28
|
-
s.to_utf8
|
29
|
-
end
|
30
|
-
|
31
|
-
def pick
|
32
|
-
r = rand
|
33
|
-
found = @freqs.find { |k, f| f.include? rand }
|
34
|
-
found && found.first
|
35
|
-
end
|
36
|
-
|
37
|
-
def make_pick
|
38
|
-
k = pick
|
39
|
-
case
|
40
|
-
when k == Hash, k == Array
|
41
|
-
k.new
|
42
|
-
when k == true, k == false, k == nil
|
43
|
-
k
|
44
|
-
when k == String
|
45
|
-
random_string
|
46
|
-
when k == Fixnum
|
47
|
-
rand(2 ** 30) - 2 ** 29
|
48
|
-
when k == Bignum
|
49
|
-
rand(2 ** 70) - 2 ** 69
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def fuzz(current = nil)
|
54
|
-
if @n > 0
|
55
|
-
case current
|
56
|
-
when nil
|
57
|
-
@n -= 1
|
58
|
-
current = fuzz [ Hash, Array ][rand(2)].new
|
59
|
-
when Array
|
60
|
-
while @n > 0
|
61
|
-
@n -= 1
|
62
|
-
current << case p = make_pick
|
63
|
-
when Array, Hash
|
64
|
-
fuzz(p)
|
65
|
-
else
|
66
|
-
p
|
67
|
-
end
|
68
|
-
end
|
69
|
-
when Hash
|
70
|
-
while @n > 0
|
71
|
-
@n -= 1
|
72
|
-
current[random_string] = case p = make_pick
|
73
|
-
when Array, Hash
|
74
|
-
fuzz(p)
|
75
|
-
else
|
76
|
-
p
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
current
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
class MyState < JSON.state
|
86
|
-
WS = " \r\t\n"
|
87
|
-
|
88
|
-
def initialize
|
89
|
-
super(
|
90
|
-
:indent => make_spaces,
|
91
|
-
:space => make_spaces,
|
92
|
-
:space_before => make_spaces,
|
93
|
-
:object_nl => make_spaces,
|
94
|
-
:array_nl => make_spaces,
|
95
|
-
:max_nesting => false
|
96
|
-
)
|
97
|
-
end
|
98
|
-
|
99
|
-
def make_spaces
|
100
|
-
s = ''
|
101
|
-
rand(1).times { s << WS[rand(WS.size)] }
|
102
|
-
s
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
n = (ARGV.shift || 500).to_i
|
107
|
-
loop do
|
108
|
-
fuzzer = Fuzzer.new(n,
|
109
|
-
Hash => 25,
|
110
|
-
Array => 25,
|
111
|
-
String => 10,
|
112
|
-
Fixnum => 10,
|
113
|
-
Bignum => 10,
|
114
|
-
nil => 5,
|
115
|
-
true => 5,
|
116
|
-
false => 5
|
117
|
-
)
|
118
|
-
o1 = fuzzer.fuzz
|
119
|
-
json = JSON.generate o1, MyState.new
|
120
|
-
if $DEBUG
|
121
|
-
puts "-" * 80
|
122
|
-
puts json, json.size
|
123
|
-
else
|
124
|
-
puts json.size
|
125
|
-
end
|
126
|
-
begin
|
127
|
-
o2 = JSON.parse(json, :max_nesting => false)
|
128
|
-
rescue JSON::ParserError => e
|
129
|
-
puts "Caught #{e.class}: #{e.message}\n#{e.backtrace * "\n"}"
|
130
|
-
puts "o1 = #{o1.inspect}", "json = #{json}", "json_str = #{json.inspect}"
|
131
|
-
puts "locals = #{local_variables.inspect}"
|
132
|
-
exit
|
133
|
-
end
|
134
|
-
if o1 != o2
|
135
|
-
puts "mismatch", "o1 = #{o1.inspect}", "o2 = #{o2.inspect}",
|
136
|
-
"json = #{json}", "json_str = #{json.inspect}"
|
137
|
-
puts "locals = #{local_variables.inspect}"
|
138
|
-
end
|
139
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require 'webrick'
|
5
|
-
include WEBrick
|
6
|
-
$:.unshift 'ext'
|
7
|
-
$:.unshift 'lib'
|
8
|
-
require 'json'
|
9
|
-
|
10
|
-
class JSONServlet < HTTPServlet::AbstractServlet
|
11
|
-
@@count = 1
|
12
|
-
|
13
|
-
def do_GET(req, res)
|
14
|
-
obj = {
|
15
|
-
"TIME" => Time.now.strftime("%FT%T"),
|
16
|
-
"foo" => "Bär",
|
17
|
-
"bar" => "© ≠ €!",
|
18
|
-
'a' => 2,
|
19
|
-
'b' => 3.141,
|
20
|
-
'COUNT' => @@count += 1,
|
21
|
-
'c' => 'c',
|
22
|
-
'd' => [ 1, "b", 3.14 ],
|
23
|
-
'e' => { 'foo' => 'bar' },
|
24
|
-
'g' => "松本行弘",
|
25
|
-
'h' => 1000.0,
|
26
|
-
'i' => 0.001,
|
27
|
-
'j' => "\xf0\xa0\x80\x81",
|
28
|
-
}
|
29
|
-
res.body = JSON.generate obj
|
30
|
-
res['Content-Type'] = "application/json"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def create_server(err, dir, port)
|
35
|
-
dir = File.expand_path(dir)
|
36
|
-
err.puts "Surf to:", "http://#{Socket.gethostname}:#{port}"
|
37
|
-
|
38
|
-
s = HTTPServer.new(
|
39
|
-
:Port => port,
|
40
|
-
:DocumentRoot => dir,
|
41
|
-
:Logger => WEBrick::Log.new(err),
|
42
|
-
:AccessLog => [
|
43
|
-
[ err, WEBrick::AccessLog::COMMON_LOG_FORMAT ],
|
44
|
-
[ err, WEBrick::AccessLog::REFERER_LOG_FORMAT ],
|
45
|
-
[ err, WEBrick::AccessLog::AGENT_LOG_FORMAT ]
|
46
|
-
]
|
47
|
-
)
|
48
|
-
s.mount("/json", JSONServlet)
|
49
|
-
s
|
50
|
-
end
|
51
|
-
|
52
|
-
default_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'data'))
|
53
|
-
dir = ARGV.shift || default_dir
|
54
|
-
port = (ARGV.shift || 6666).to_i
|
55
|
-
s = create_server(STDERR, dir, 6666)
|
56
|
-
t = Thread.new { s.start }
|
57
|
-
trap(:INT) do
|
58
|
-
s.shutdown
|
59
|
-
t.join
|
60
|
-
exit
|
61
|
-
end
|
62
|
-
sleep
|
data/vendor/pusher-gem/Gemfile
DELETED
data/vendor/pusher-gem/README.md
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
Pusher gem
|
2
|
-
==========
|
3
|
-
|
4
|
-
Getting started
|
5
|
-
---------------
|
6
|
-
|
7
|
-
After registering at <http://pusher.com> configure your app with the security credentials
|
8
|
-
|
9
|
-
Pusher.app_id = 'your-pusher-app-id'
|
10
|
-
Pusher.key = 'your-pusher-key'
|
11
|
-
Pusher.secret = 'your-pusher-secret'
|
12
|
-
|
13
|
-
Trigger an event with {Pusher::Channel#trigger!}
|
14
|
-
|
15
|
-
Pusher['a_channel'].trigger!('an_event', {:some => 'data'})
|
16
|
-
|
17
|
-
Handle errors by rescuing `Pusher::Error` (all Pusher errors are descendants of this error)
|
18
|
-
|
19
|
-
begin
|
20
|
-
Pusher['a_channel'].trigger!('an_event', {:some => 'data'})
|
21
|
-
rescue Pusher::Error => e
|
22
|
-
# (Pusher::AuthenticationError, Pusher::HTTPError, or Pusher::Error)
|
23
|
-
end
|
24
|
-
|
25
|
-
Optionally a socket id may be provided. This will exclude the event from being triggered on this socket id (see <http://pusher.com/docs/publisher_api_guide/publisher_excluding_recipients> for more info).
|
26
|
-
|
27
|
-
Pusher['a_channel'].trigger!('an_event', {:some => 'data'}, socket_id)
|
28
|
-
|
29
|
-
If you don't need to handle failure cases, then you can simply use the {Pusher::Channel#trigger} method, which will rescue and log any errors for you
|
30
|
-
|
31
|
-
Pusher['a_channel'].trigger('an_event', {:some => 'data'})
|
32
|
-
|
33
|
-
Logging
|
34
|
-
-------
|
35
|
-
|
36
|
-
Errors are logged to `Pusher.logger`. It will by default use `Logger` from stdlib, however you can assign any logger:
|
37
|
-
|
38
|
-
Pusher.logger = Rails.logger
|
39
|
-
|
40
|
-
Asynchronous triggering
|
41
|
-
-----------------------
|
42
|
-
|
43
|
-
To avoid blocking in a typical web application, you may wish to use the {Pusher::Channel#trigger_async} method which makes asynchronous API requests. `trigger_async` returns a deferrable which you can optionally bind to with success and failure callbacks.
|
44
|
-
|
45
|
-
You need to be running eventmachine to make use of this functionality. This is already the case if, for example, you're deploying to Heroku or using the Thin web server. You will also need to add `em-http-request` to your Gemfile.
|
46
|
-
|
47
|
-
$ gem install em-http-request
|
48
|
-
|
49
|
-
deferrable = Pusher['a_channel'].trigger_async('an_event', {
|
50
|
-
:some => 'data'
|
51
|
-
}, socket_id)
|
52
|
-
deferrable.callback {
|
53
|
-
# Do something on success
|
54
|
-
}
|
55
|
-
deferrable.errback { |error|
|
56
|
-
# error is a instance of Pusher::Error
|
57
|
-
}
|
58
|
-
|
59
|
-
Private channels
|
60
|
-
----------------
|
61
|
-
|
62
|
-
The Pusher Gem also deals with signing requests for authenticated private channels. A quick Rails controller example:
|
63
|
-
|
64
|
-
reponse = Pusher['private-my_channel'].authenticate(params[:socket_id])
|
65
|
-
render :json => response
|
66
|
-
|
67
|
-
Read more about private channels in [the docs](http://pusher.com/docs/client_api_guide/client_channels#subscribe-private-channels) and under {Pusher::Channel#authenticate}.
|
68
|
-
|
69
|
-
Developing
|
70
|
-
----------
|
71
|
-
|
72
|
-
Use bundler in order to run specs with the correct dependencies.
|
73
|
-
|
74
|
-
bundle
|
75
|
-
bundle exec rspec spec/*_spec.rb
|
76
|
-
|
77
|
-
Copyright
|
78
|
-
---------
|
79
|
-
|
80
|
-
Copyright (c) 2010 New Bamboo. See LICENSE for details.
|