scout 5.7.3.pre.2 → 5.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +4 -0
- data/lib/scout/version.rb +1 -1
- data/vendor/json_pure/.gitignore +12 -0
- data/vendor/json_pure/.travis.yml +20 -0
- data/vendor/json_pure/CHANGES +282 -0
- data/vendor/json_pure/COPYING +58 -0
- data/vendor/json_pure/COPYING-json-jruby +57 -0
- data/vendor/json_pure/GPL +340 -0
- data/vendor/json_pure/Gemfile +11 -0
- data/vendor/json_pure/README-json-jruby.markdown +33 -0
- data/vendor/json_pure/README.rdoc +358 -0
- data/vendor/json_pure/Rakefile +412 -0
- data/vendor/json_pure/TODO +1 -0
- data/vendor/json_pure/VERSION +1 -0
- data/vendor/json_pure/data/example.json +1 -0
- data/vendor/json_pure/data/index.html +38 -0
- data/vendor/json_pure/data/prototype.js +4184 -0
- data/vendor/json_pure/diagrams/.keep +0 -0
- data/vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h +181 -0
- data/vendor/json_pure/ext/json/ext/generator/depend +1 -0
- data/vendor/json_pure/ext/json/ext/generator/extconf.rb +14 -0
- data/vendor/json_pure/ext/json/ext/generator/generator.c +1435 -0
- data/vendor/json_pure/ext/json/ext/generator/generator.h +148 -0
- data/vendor/json_pure/ext/json/ext/parser/depend +1 -0
- data/vendor/json_pure/ext/json/ext/parser/extconf.rb +13 -0
- data/vendor/json_pure/ext/json/ext/parser/parser.c +2204 -0
- data/vendor/json_pure/ext/json/ext/parser/parser.h +77 -0
- data/vendor/json_pure/ext/json/ext/parser/parser.rl +927 -0
- data/vendor/json_pure/install.rb +23 -0
- data/vendor/json_pure/java/src/json/ext/ByteListTranscoder.java +167 -0
- data/vendor/json_pure/java/src/json/ext/Generator.java +444 -0
- data/vendor/json_pure/java/src/json/ext/GeneratorMethods.java +232 -0
- data/vendor/json_pure/java/src/json/ext/GeneratorService.java +43 -0
- data/vendor/json_pure/java/src/json/ext/GeneratorState.java +543 -0
- data/vendor/json_pure/java/src/json/ext/OptionsReader.java +114 -0
- data/vendor/json_pure/java/src/json/ext/Parser.java +2644 -0
- data/vendor/json_pure/java/src/json/ext/Parser.rl +968 -0
- data/vendor/json_pure/java/src/json/ext/ParserService.java +35 -0
- data/vendor/json_pure/java/src/json/ext/RuntimeInfo.java +121 -0
- data/vendor/json_pure/java/src/json/ext/StringDecoder.java +167 -0
- data/vendor/json_pure/java/src/json/ext/StringEncoder.java +106 -0
- data/vendor/json_pure/java/src/json/ext/Utils.java +89 -0
- data/vendor/json_pure/json-java.gemspec +23 -0
- data/vendor/json_pure/json.gemspec +37 -0
- data/vendor/json_pure/json_pure.gemspec +39 -0
- data/vendor/json_pure/lib/json.rb +62 -0
- data/vendor/json_pure/lib/json/add/bigdecimal.rb +28 -0
- data/vendor/json_pure/lib/json/add/complex.rb +22 -0
- data/vendor/json_pure/lib/json/add/core.rb +11 -0
- data/vendor/json_pure/lib/json/add/date.rb +34 -0
- data/vendor/json_pure/lib/json/add/date_time.rb +50 -0
- data/vendor/json_pure/lib/json/add/exception.rb +31 -0
- data/vendor/json_pure/lib/json/add/ostruct.rb +31 -0
- data/vendor/json_pure/lib/json/add/range.rb +29 -0
- data/vendor/json_pure/lib/json/add/rational.rb +22 -0
- data/vendor/json_pure/lib/json/add/regexp.rb +30 -0
- data/vendor/json_pure/lib/json/add/struct.rb +30 -0
- data/vendor/json_pure/lib/json/add/symbol.rb +25 -0
- data/vendor/json_pure/lib/json/add/time.rb +38 -0
- data/vendor/json_pure/lib/json/common.rb +487 -0
- data/vendor/json_pure/lib/json/ext.rb +21 -0
- data/vendor/json_pure/lib/json/ext/.keep +0 -0
- data/vendor/json_pure/lib/json/generic_object.rb +70 -0
- data/vendor/json_pure/lib/json/pure.rb +21 -0
- data/vendor/json_pure/lib/json/pure/generator.rb +522 -0
- data/vendor/json_pure/lib/json/pure/parser.rb +359 -0
- data/vendor/json_pure/lib/json/version.rb +8 -0
- data/vendor/json_pure/tests/fixtures/fail1.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail10.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail11.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail12.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail13.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail14.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail18.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail19.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail2.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail20.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail21.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail22.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail23.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail24.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail25.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail27.json +2 -0
- data/vendor/json_pure/tests/fixtures/fail28.json +2 -0
- data/vendor/json_pure/tests/fixtures/fail3.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail4.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail5.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail6.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail7.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail8.json +1 -0
- data/vendor/json_pure/tests/fixtures/fail9.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass1.json +56 -0
- data/vendor/json_pure/tests/fixtures/pass15.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass16.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass17.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass2.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass26.json +1 -0
- data/vendor/json_pure/tests/fixtures/pass3.json +6 -0
- data/vendor/json_pure/tests/setup_variant.rb +11 -0
- data/vendor/json_pure/tests/test_json.rb +545 -0
- data/vendor/json_pure/tests/test_json_addition.rb +196 -0
- data/vendor/json_pure/tests/test_json_encoding.rb +65 -0
- data/vendor/json_pure/tests/test_json_fixtures.rb +35 -0
- data/vendor/json_pure/tests/test_json_generate.rb +322 -0
- data/vendor/json_pure/tests/test_json_generic_object.rb +75 -0
- data/vendor/json_pure/tests/test_json_string_matching.rb +39 -0
- data/vendor/json_pure/tests/test_json_unicode.rb +72 -0
- data/vendor/json_pure/tools/fuzz.rb +139 -0
- data/vendor/json_pure/tools/server.rb +62 -0
- metadata +111 -4
@@ -0,0 +1,75 @@
|
|
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
|
@@ -0,0 +1,39 @@
|
|
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
|
@@ -0,0 +1,72 @@
|
|
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
|
@@ -0,0 +1,139 @@
|
|
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
|
@@ -0,0 +1,62 @@
|
|
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
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
5
|
-
prerelease:
|
4
|
+
version: 5.7.4
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andre Lewis
|
@@ -129,6 +129,113 @@ files:
|
|
129
129
|
- vendor/httpclient/test/test_httpclient.rb
|
130
130
|
- vendor/httpclient/test/test_include_client.rb
|
131
131
|
- vendor/httpclient/test/test_ssl.rb
|
132
|
+
- vendor/json_pure/.gitignore
|
133
|
+
- vendor/json_pure/.travis.yml
|
134
|
+
- vendor/json_pure/CHANGES
|
135
|
+
- vendor/json_pure/COPYING
|
136
|
+
- vendor/json_pure/COPYING-json-jruby
|
137
|
+
- vendor/json_pure/GPL
|
138
|
+
- vendor/json_pure/Gemfile
|
139
|
+
- vendor/json_pure/README-json-jruby.markdown
|
140
|
+
- vendor/json_pure/README.rdoc
|
141
|
+
- vendor/json_pure/Rakefile
|
142
|
+
- vendor/json_pure/TODO
|
143
|
+
- vendor/json_pure/VERSION
|
144
|
+
- vendor/json_pure/data/example.json
|
145
|
+
- vendor/json_pure/data/index.html
|
146
|
+
- vendor/json_pure/data/prototype.js
|
147
|
+
- vendor/json_pure/diagrams/.keep
|
148
|
+
- vendor/json_pure/ext/json/ext/fbuffer/fbuffer.h
|
149
|
+
- vendor/json_pure/ext/json/ext/generator/depend
|
150
|
+
- vendor/json_pure/ext/json/ext/generator/extconf.rb
|
151
|
+
- vendor/json_pure/ext/json/ext/generator/generator.c
|
152
|
+
- vendor/json_pure/ext/json/ext/generator/generator.h
|
153
|
+
- vendor/json_pure/ext/json/ext/parser/depend
|
154
|
+
- vendor/json_pure/ext/json/ext/parser/extconf.rb
|
155
|
+
- vendor/json_pure/ext/json/ext/parser/parser.c
|
156
|
+
- vendor/json_pure/ext/json/ext/parser/parser.h
|
157
|
+
- vendor/json_pure/ext/json/ext/parser/parser.rl
|
158
|
+
- vendor/json_pure/install.rb
|
159
|
+
- vendor/json_pure/java/src/json/ext/ByteListTranscoder.java
|
160
|
+
- vendor/json_pure/java/src/json/ext/Generator.java
|
161
|
+
- vendor/json_pure/java/src/json/ext/GeneratorMethods.java
|
162
|
+
- vendor/json_pure/java/src/json/ext/GeneratorService.java
|
163
|
+
- vendor/json_pure/java/src/json/ext/GeneratorState.java
|
164
|
+
- vendor/json_pure/java/src/json/ext/OptionsReader.java
|
165
|
+
- vendor/json_pure/java/src/json/ext/Parser.java
|
166
|
+
- vendor/json_pure/java/src/json/ext/Parser.rl
|
167
|
+
- vendor/json_pure/java/src/json/ext/ParserService.java
|
168
|
+
- vendor/json_pure/java/src/json/ext/RuntimeInfo.java
|
169
|
+
- vendor/json_pure/java/src/json/ext/StringDecoder.java
|
170
|
+
- vendor/json_pure/java/src/json/ext/StringEncoder.java
|
171
|
+
- vendor/json_pure/java/src/json/ext/Utils.java
|
172
|
+
- vendor/json_pure/json-java.gemspec
|
173
|
+
- vendor/json_pure/json.gemspec
|
174
|
+
- vendor/json_pure/json_pure.gemspec
|
175
|
+
- vendor/json_pure/lib/json.rb
|
176
|
+
- vendor/json_pure/lib/json/add/bigdecimal.rb
|
177
|
+
- vendor/json_pure/lib/json/add/complex.rb
|
178
|
+
- vendor/json_pure/lib/json/add/core.rb
|
179
|
+
- vendor/json_pure/lib/json/add/date.rb
|
180
|
+
- vendor/json_pure/lib/json/add/date_time.rb
|
181
|
+
- vendor/json_pure/lib/json/add/exception.rb
|
182
|
+
- vendor/json_pure/lib/json/add/ostruct.rb
|
183
|
+
- vendor/json_pure/lib/json/add/range.rb
|
184
|
+
- vendor/json_pure/lib/json/add/rational.rb
|
185
|
+
- vendor/json_pure/lib/json/add/regexp.rb
|
186
|
+
- vendor/json_pure/lib/json/add/struct.rb
|
187
|
+
- vendor/json_pure/lib/json/add/symbol.rb
|
188
|
+
- vendor/json_pure/lib/json/add/time.rb
|
189
|
+
- vendor/json_pure/lib/json/common.rb
|
190
|
+
- vendor/json_pure/lib/json/ext.rb
|
191
|
+
- vendor/json_pure/lib/json/ext/.keep
|
192
|
+
- vendor/json_pure/lib/json/generic_object.rb
|
193
|
+
- vendor/json_pure/lib/json/pure.rb
|
194
|
+
- vendor/json_pure/lib/json/pure/generator.rb
|
195
|
+
- vendor/json_pure/lib/json/pure/parser.rb
|
196
|
+
- vendor/json_pure/lib/json/version.rb
|
197
|
+
- vendor/json_pure/tests/fixtures/fail1.json
|
198
|
+
- vendor/json_pure/tests/fixtures/fail10.json
|
199
|
+
- vendor/json_pure/tests/fixtures/fail11.json
|
200
|
+
- vendor/json_pure/tests/fixtures/fail12.json
|
201
|
+
- vendor/json_pure/tests/fixtures/fail13.json
|
202
|
+
- vendor/json_pure/tests/fixtures/fail14.json
|
203
|
+
- vendor/json_pure/tests/fixtures/fail18.json
|
204
|
+
- vendor/json_pure/tests/fixtures/fail19.json
|
205
|
+
- vendor/json_pure/tests/fixtures/fail2.json
|
206
|
+
- vendor/json_pure/tests/fixtures/fail20.json
|
207
|
+
- vendor/json_pure/tests/fixtures/fail21.json
|
208
|
+
- vendor/json_pure/tests/fixtures/fail22.json
|
209
|
+
- vendor/json_pure/tests/fixtures/fail23.json
|
210
|
+
- vendor/json_pure/tests/fixtures/fail24.json
|
211
|
+
- vendor/json_pure/tests/fixtures/fail25.json
|
212
|
+
- vendor/json_pure/tests/fixtures/fail27.json
|
213
|
+
- vendor/json_pure/tests/fixtures/fail28.json
|
214
|
+
- vendor/json_pure/tests/fixtures/fail3.json
|
215
|
+
- vendor/json_pure/tests/fixtures/fail4.json
|
216
|
+
- vendor/json_pure/tests/fixtures/fail5.json
|
217
|
+
- vendor/json_pure/tests/fixtures/fail6.json
|
218
|
+
- vendor/json_pure/tests/fixtures/fail7.json
|
219
|
+
- vendor/json_pure/tests/fixtures/fail8.json
|
220
|
+
- vendor/json_pure/tests/fixtures/fail9.json
|
221
|
+
- vendor/json_pure/tests/fixtures/pass1.json
|
222
|
+
- vendor/json_pure/tests/fixtures/pass15.json
|
223
|
+
- vendor/json_pure/tests/fixtures/pass16.json
|
224
|
+
- vendor/json_pure/tests/fixtures/pass17.json
|
225
|
+
- vendor/json_pure/tests/fixtures/pass2.json
|
226
|
+
- vendor/json_pure/tests/fixtures/pass26.json
|
227
|
+
- vendor/json_pure/tests/fixtures/pass3.json
|
228
|
+
- vendor/json_pure/tests/setup_variant.rb
|
229
|
+
- vendor/json_pure/tests/test_json.rb
|
230
|
+
- vendor/json_pure/tests/test_json_addition.rb
|
231
|
+
- vendor/json_pure/tests/test_json_encoding.rb
|
232
|
+
- vendor/json_pure/tests/test_json_fixtures.rb
|
233
|
+
- vendor/json_pure/tests/test_json_generate.rb
|
234
|
+
- vendor/json_pure/tests/test_json_generic_object.rb
|
235
|
+
- vendor/json_pure/tests/test_json_string_matching.rb
|
236
|
+
- vendor/json_pure/tests/test_json_unicode.rb
|
237
|
+
- vendor/json_pure/tools/fuzz.rb
|
238
|
+
- vendor/json_pure/tools/server.rb
|
132
239
|
- vendor/multi_json/.document
|
133
240
|
- vendor/multi_json/.rspec
|
134
241
|
- vendor/multi_json/.travis.yml
|
@@ -209,9 +316,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
317
|
none: false
|
211
318
|
requirements:
|
212
|
-
- - ! '
|
319
|
+
- - ! '>='
|
213
320
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
321
|
+
version: '0'
|
215
322
|
requirements: []
|
216
323
|
rubyforge_project: scout
|
217
324
|
rubygems_version: 1.8.25
|