ey-deploy 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/lib/ey-deploy.rb +5 -2
  2. data/lib/ey-deploy/cli.rb +2 -2
  3. data/lib/ey-deploy/deploy.rb +8 -1
  4. data/lib/ey-deploy/logged_output.rb +6 -0
  5. data/lib/ey-deploy/strategies/git.rb +5 -4
  6. data/lib/ey-deploy/version.rb +1 -1
  7. data/lib/vendor/escape/Readme +21 -0
  8. data/lib/vendor/escape/doc_include/template/qualitysmith.rb +631 -0
  9. data/lib/vendor/escape/lib/escape.rb +247 -0
  10. data/lib/vendor/json_pure/CHANGES +166 -0
  11. data/lib/vendor/json_pure/COPYING +58 -0
  12. data/lib/vendor/json_pure/GPL +340 -0
  13. data/lib/vendor/json_pure/README +358 -0
  14. data/lib/vendor/json_pure/Rakefile +292 -0
  15. data/lib/vendor/json_pure/TODO +1 -0
  16. data/lib/vendor/json_pure/VERSION +1 -0
  17. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
  18. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
  19. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
  20. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
  21. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
  22. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
  23. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
  24. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
  25. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
  26. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
  27. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
  28. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
  29. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
  30. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
  31. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
  32. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
  33. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
  34. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
  35. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
  36. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
  37. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
  38. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
  39. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
  40. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
  41. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
  42. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
  43. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
  44. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
  45. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
  46. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
  47. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
  48. data/lib/vendor/json_pure/benchmarks/generator2_benchmark.rb +222 -0
  49. data/lib/vendor/json_pure/benchmarks/generator_benchmark.rb +224 -0
  50. data/lib/vendor/json_pure/benchmarks/ohai.json +1216 -0
  51. data/lib/vendor/json_pure/benchmarks/ohai.ruby +1 -0
  52. data/lib/vendor/json_pure/benchmarks/parser2_benchmark.rb +251 -0
  53. data/lib/vendor/json_pure/benchmarks/parser_benchmark.rb +259 -0
  54. data/lib/vendor/json_pure/bin/edit_json.rb +9 -0
  55. data/lib/vendor/json_pure/bin/prettify_json.rb +75 -0
  56. data/lib/vendor/json_pure/data/example.json +1 -0
  57. data/lib/vendor/json_pure/data/index.html +38 -0
  58. data/lib/vendor/json_pure/data/prototype.js +4184 -0
  59. data/lib/vendor/json_pure/ext/json/ext/generator/extconf.rb +16 -0
  60. data/lib/vendor/json_pure/ext/json/ext/generator/generator.c +1323 -0
  61. data/lib/vendor/json_pure/ext/json/ext/generator/generator.h +170 -0
  62. data/lib/vendor/json_pure/ext/json/ext/parser/extconf.rb +15 -0
  63. data/lib/vendor/json_pure/ext/json/ext/parser/parser.c +1935 -0
  64. data/lib/vendor/json_pure/ext/json/ext/parser/parser.h +71 -0
  65. data/lib/vendor/json_pure/ext/json/ext/parser/parser.rl +792 -0
  66. data/lib/vendor/json_pure/install.rb +26 -0
  67. data/lib/vendor/json_pure/lib/json.rb +10 -0
  68. data/lib/vendor/json_pure/lib/json/Array.xpm +21 -0
  69. data/lib/vendor/json_pure/lib/json/FalseClass.xpm +21 -0
  70. data/lib/vendor/json_pure/lib/json/Hash.xpm +21 -0
  71. data/lib/vendor/json_pure/lib/json/Key.xpm +73 -0
  72. data/lib/vendor/json_pure/lib/json/NilClass.xpm +21 -0
  73. data/lib/vendor/json_pure/lib/json/Numeric.xpm +28 -0
  74. data/lib/vendor/json_pure/lib/json/String.xpm +96 -0
  75. data/lib/vendor/json_pure/lib/json/TrueClass.xpm +21 -0
  76. data/lib/vendor/json_pure/lib/json/add/core.rb +148 -0
  77. data/lib/vendor/json_pure/lib/json/add/rails.rb +58 -0
  78. data/lib/vendor/json_pure/lib/json/common.rb +397 -0
  79. data/lib/vendor/json_pure/lib/json/editor.rb +1371 -0
  80. data/lib/vendor/json_pure/lib/json/ext.rb +15 -0
  81. data/lib/vendor/json_pure/lib/json/json.xpm +1499 -0
  82. data/lib/vendor/json_pure/lib/json/pure.rb +77 -0
  83. data/lib/vendor/json_pure/lib/json/pure/generator.rb +452 -0
  84. data/lib/vendor/json_pure/lib/json/pure/parser.rb +307 -0
  85. data/lib/vendor/json_pure/lib/json/version.rb +8 -0
  86. data/lib/vendor/json_pure/tests/fixtures/fail1.json +1 -0
  87. data/lib/vendor/json_pure/tests/fixtures/fail10.json +1 -0
  88. data/lib/vendor/json_pure/tests/fixtures/fail11.json +1 -0
  89. data/lib/vendor/json_pure/tests/fixtures/fail12.json +1 -0
  90. data/lib/vendor/json_pure/tests/fixtures/fail13.json +1 -0
  91. data/lib/vendor/json_pure/tests/fixtures/fail14.json +1 -0
  92. data/lib/vendor/json_pure/tests/fixtures/fail18.json +1 -0
  93. data/lib/vendor/json_pure/tests/fixtures/fail19.json +1 -0
  94. data/lib/vendor/json_pure/tests/fixtures/fail2.json +1 -0
  95. data/lib/vendor/json_pure/tests/fixtures/fail20.json +1 -0
  96. data/lib/vendor/json_pure/tests/fixtures/fail21.json +1 -0
  97. data/lib/vendor/json_pure/tests/fixtures/fail22.json +1 -0
  98. data/lib/vendor/json_pure/tests/fixtures/fail23.json +1 -0
  99. data/lib/vendor/json_pure/tests/fixtures/fail24.json +1 -0
  100. data/lib/vendor/json_pure/tests/fixtures/fail25.json +1 -0
  101. data/lib/vendor/json_pure/tests/fixtures/fail27.json +2 -0
  102. data/lib/vendor/json_pure/tests/fixtures/fail28.json +2 -0
  103. data/lib/vendor/json_pure/tests/fixtures/fail3.json +1 -0
  104. data/lib/vendor/json_pure/tests/fixtures/fail4.json +1 -0
  105. data/lib/vendor/json_pure/tests/fixtures/fail5.json +1 -0
  106. data/lib/vendor/json_pure/tests/fixtures/fail6.json +1 -0
  107. data/lib/vendor/json_pure/tests/fixtures/fail7.json +1 -0
  108. data/lib/vendor/json_pure/tests/fixtures/fail8.json +1 -0
  109. data/lib/vendor/json_pure/tests/fixtures/fail9.json +1 -0
  110. data/lib/vendor/json_pure/tests/fixtures/pass1.json +56 -0
  111. data/lib/vendor/json_pure/tests/fixtures/pass15.json +1 -0
  112. data/lib/vendor/json_pure/tests/fixtures/pass16.json +1 -0
  113. data/lib/vendor/json_pure/tests/fixtures/pass17.json +1 -0
  114. data/lib/vendor/json_pure/tests/fixtures/pass2.json +1 -0
  115. data/lib/vendor/json_pure/tests/fixtures/pass26.json +1 -0
  116. data/lib/vendor/json_pure/tests/fixtures/pass3.json +6 -0
  117. data/lib/vendor/json_pure/tests/test_json.rb +361 -0
  118. data/lib/vendor/json_pure/tests/test_json_addition.rb +162 -0
  119. data/lib/vendor/json_pure/tests/test_json_encoding.rb +68 -0
  120. data/lib/vendor/json_pure/tests/test_json_fixtures.rb +34 -0
  121. data/lib/vendor/json_pure/tests/test_json_generate.rb +122 -0
  122. data/lib/vendor/json_pure/tests/test_json_rails.rb +144 -0
  123. data/lib/vendor/json_pure/tests/test_json_unicode.rb +76 -0
  124. data/lib/vendor/json_pure/tools/fuzz.rb +139 -0
  125. data/lib/vendor/json_pure/tools/server.rb +61 -0
  126. metadata +125 -43
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rbconfig'
4
+ require 'fileutils'
5
+ include FileUtils::Verbose
6
+
7
+ include Config
8
+
9
+ bindir = CONFIG["bindir"]
10
+ cd 'bin' do
11
+ filename = 'edit_json.rb'
12
+ #install(filename, bindir)
13
+ end
14
+ sitelibdir = CONFIG["sitelibdir"]
15
+ cd 'lib' do
16
+ install('json.rb', sitelibdir)
17
+ mkdir_p File.join(sitelibdir, 'json')
18
+ for file in Dir['json/**/*.{rb,xpm}']
19
+ d = File.join(sitelibdir, file)
20
+ mkdir_p File.dirname(d)
21
+ install(file, d)
22
+ end
23
+ install(File.join('json', 'editor.rb'), File.join(sitelibdir,'json'))
24
+ install(File.join('json', 'json.xpm'), File.join(sitelibdir,'json'))
25
+ end
26
+ warn " *** Installed PURE ruby library."
@@ -0,0 +1,10 @@
1
+ require 'json/common'
2
+ module JSON
3
+ require 'json/version'
4
+
5
+ begin
6
+ require 'json/ext'
7
+ rescue LoadError
8
+ require 'json/pure'
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ /* XPM */
2
+ static char * Array_xpm[] = {
3
+ "16 16 2 1",
4
+ " c None",
5
+ ". c #000000",
6
+ " ",
7
+ " ",
8
+ " ",
9
+ " .......... ",
10
+ " . . ",
11
+ " . . ",
12
+ " . . ",
13
+ " . . ",
14
+ " . . ",
15
+ " . . ",
16
+ " . . ",
17
+ " . . ",
18
+ " .......... ",
19
+ " ",
20
+ " ",
21
+ " "};
@@ -0,0 +1,21 @@
1
+ /* XPM */
2
+ static char * False_xpm[] = {
3
+ "16 16 2 1",
4
+ " c None",
5
+ ". c #FF0000",
6
+ " ",
7
+ " ",
8
+ " ",
9
+ " ...... ",
10
+ " . ",
11
+ " . ",
12
+ " . ",
13
+ " ...... ",
14
+ " . ",
15
+ " . ",
16
+ " . ",
17
+ " . ",
18
+ " . ",
19
+ " ",
20
+ " ",
21
+ " "};
@@ -0,0 +1,21 @@
1
+ /* XPM */
2
+ static char * Hash_xpm[] = {
3
+ "16 16 2 1",
4
+ " c None",
5
+ ". c #000000",
6
+ " ",
7
+ " ",
8
+ " ",
9
+ " . . ",
10
+ " . . ",
11
+ " . . ",
12
+ " ......... ",
13
+ " . . ",
14
+ " . . ",
15
+ " ......... ",
16
+ " . . ",
17
+ " . . ",
18
+ " . . ",
19
+ " ",
20
+ " ",
21
+ " "};
@@ -0,0 +1,73 @@
1
+ /* XPM */
2
+ static char * Key_xpm[] = {
3
+ "16 16 54 1",
4
+ " c None",
5
+ ". c #110007",
6
+ "+ c #0E0900",
7
+ "@ c #000013",
8
+ "# c #070600",
9
+ "$ c #F6F006",
10
+ "% c #ECE711",
11
+ "& c #E5EE00",
12
+ "* c #16021E",
13
+ "= c #120900",
14
+ "- c #EDF12B",
15
+ "; c #000033",
16
+ "> c #0F0000",
17
+ ", c #FFFE03",
18
+ "' c #E6E500",
19
+ ") c #16021B",
20
+ "! c #F7F502",
21
+ "~ c #000E00",
22
+ "{ c #130000",
23
+ "] c #FFF000",
24
+ "^ c #FFE711",
25
+ "/ c #140005",
26
+ "( c #190025",
27
+ "_ c #E9DD27",
28
+ ": c #E7DC04",
29
+ "< c #FFEC09",
30
+ "[ c #FFE707",
31
+ "} c #FFDE10",
32
+ "| c #150021",
33
+ "1 c #160700",
34
+ "2 c #FAF60E",
35
+ "3 c #EFE301",
36
+ "4 c #FEF300",
37
+ "5 c #E7E000",
38
+ "6 c #FFFF08",
39
+ "7 c #0E0206",
40
+ "8 c #040000",
41
+ "9 c #03052E",
42
+ "0 c #041212",
43
+ "a c #070300",
44
+ "b c #F2E713",
45
+ "c c #F9DE13",
46
+ "d c #36091E",
47
+ "e c #00001C",
48
+ "f c #1F0010",
49
+ "g c #FFF500",
50
+ "h c #DEDE00",
51
+ "i c #050A00",
52
+ "j c #FAF14A",
53
+ "k c #F5F200",
54
+ "l c #040404",
55
+ "m c #1A0D00",
56
+ "n c #EDE43D",
57
+ "o c #ECE007",
58
+ " ",
59
+ " ",
60
+ " .+@ ",
61
+ " #$%&* ",
62
+ " =-;>,') ",
63
+ " >!~{]^/ ",
64
+ " (_:<[}| ",
65
+ " 1234567 ",
66
+ " 890abcd ",
67
+ " efghi ",
68
+ " >jkl ",
69
+ " mnol ",
70
+ " >kl ",
71
+ " ll ",
72
+ " ",
73
+ " "};
@@ -0,0 +1,21 @@
1
+ /* XPM */
2
+ static char * False_xpm[] = {
3
+ "16 16 2 1",
4
+ " c None",
5
+ ". c #000000",
6
+ " ",
7
+ " ",
8
+ " ",
9
+ " ... ",
10
+ " . . ",
11
+ " . . ",
12
+ " . . ",
13
+ " . . ",
14
+ " . . ",
15
+ " . . ",
16
+ " . . ",
17
+ " . . ",
18
+ " ... ",
19
+ " ",
20
+ " ",
21
+ " "};
@@ -0,0 +1,28 @@
1
+ /* XPM */
2
+ static char * Numeric_xpm[] = {
3
+ "16 16 9 1",
4
+ " c None",
5
+ ". c #FF0000",
6
+ "+ c #0000FF",
7
+ "@ c #0023DB",
8
+ "# c #00EA14",
9
+ "$ c #00FF00",
10
+ "% c #004FAF",
11
+ "& c #0028D6",
12
+ "* c #00F20C",
13
+ " ",
14
+ " ",
15
+ " ",
16
+ " ... +++@#$$$$ ",
17
+ " .+ %& $$ ",
18
+ " . + $ ",
19
+ " . + $$ ",
20
+ " . ++$$$$ ",
21
+ " . + $$ ",
22
+ " . + $ ",
23
+ " . + $ ",
24
+ " . + $ $$ ",
25
+ " .....++++*$$ ",
26
+ " ",
27
+ " ",
28
+ " "};
@@ -0,0 +1,96 @@
1
+ /* XPM */
2
+ static char * String_xpm[] = {
3
+ "16 16 77 1",
4
+ " c None",
5
+ ". c #000000",
6
+ "+ c #040404",
7
+ "@ c #080806",
8
+ "# c #090606",
9
+ "$ c #EEEAE1",
10
+ "% c #E7E3DA",
11
+ "& c #E0DBD1",
12
+ "* c #D4B46F",
13
+ "= c #0C0906",
14
+ "- c #E3C072",
15
+ "; c #E4C072",
16
+ "> c #060505",
17
+ ", c #0B0A08",
18
+ "' c #D5B264",
19
+ ") c #D3AF5A",
20
+ "! c #080602",
21
+ "~ c #E1B863",
22
+ "{ c #DDB151",
23
+ "] c #DBAE4A",
24
+ "^ c #DDB152",
25
+ "/ c #DDB252",
26
+ "( c #070705",
27
+ "_ c #0C0A07",
28
+ ": c #D3A33B",
29
+ "< c #020201",
30
+ "[ c #DAAA41",
31
+ "} c #040302",
32
+ "| c #E4D9BF",
33
+ "1 c #0B0907",
34
+ "2 c #030201",
35
+ "3 c #020200",
36
+ "4 c #C99115",
37
+ "5 c #080704",
38
+ "6 c #DBC8A2",
39
+ "7 c #E7D7B4",
40
+ "8 c #E0CD9E",
41
+ "9 c #080601",
42
+ "0 c #040400",
43
+ "a c #010100",
44
+ "b c #0B0B08",
45
+ "c c #DCBF83",
46
+ "d c #DCBC75",
47
+ "e c #DEB559",
48
+ "f c #040301",
49
+ "g c #BC8815",
50
+ "h c #120E07",
51
+ "i c #060402",
52
+ "j c #0A0804",
53
+ "k c #D4A747",
54
+ "l c #D6A12F",
55
+ "m c #0E0C05",
56
+ "n c #C8C1B0",
57
+ "o c #1D1B15",
58
+ "p c #D7AD51",
59
+ "q c #070502",
60
+ "r c #080804",
61
+ "s c #BC953B",
62
+ "t c #C4BDAD",
63
+ "u c #0B0807",
64
+ "v c #DBAC47",
65
+ "w c #1B150A",
66
+ "x c #B78A2C",
67
+ "y c #D8A83C",
68
+ "z c #D4A338",
69
+ "A c #0F0B03",
70
+ "B c #181105",
71
+ "C c #C59325",
72
+ "D c #C18E1F",
73
+ "E c #060600",
74
+ "F c #CC992D",
75
+ "G c #B98B25",
76
+ "H c #B3831F",
77
+ "I c #C08C1C",
78
+ "J c #060500",
79
+ "K c #0E0C03",
80
+ "L c #0D0A00",
81
+ " ",
82
+ " .+@# ",
83
+ " .$%&*= ",
84
+ " .-;>,')! ",
85
+ " .~. .{]. ",
86
+ " .^/. (_:< ",
87
+ " .[.}|$12 ",
88
+ " 345678}90 ",
89
+ " a2bcdefgh ",
90
+ " ijkl.mno ",
91
+ " <pq. rstu ",
92
+ " .]v. wx= ",
93
+ " .yzABCDE ",
94
+ " .FGHIJ ",
95
+ " 0KL0 ",
96
+ " "};
@@ -0,0 +1,21 @@
1
+ /* XPM */
2
+ static char * TrueClass_xpm[] = {
3
+ "16 16 2 1",
4
+ " c None",
5
+ ". c #0BF311",
6
+ " ",
7
+ " ",
8
+ " ",
9
+ " ......... ",
10
+ " . ",
11
+ " . ",
12
+ " . ",
13
+ " . ",
14
+ " . ",
15
+ " . ",
16
+ " . ",
17
+ " . ",
18
+ " . ",
19
+ " ",
20
+ " ",
21
+ " "};
@@ -0,0 +1,148 @@
1
+ # This file contains implementations of ruby core's custom objects for
2
+ # serialisation/deserialisation.
3
+
4
+ unless Object.const_defined?(:JSON) and ::JSON.const_defined?(:JSON_LOADED) and
5
+ ::JSON::JSON_LOADED
6
+ require 'json'
7
+ end
8
+ require 'date'
9
+
10
+ class Symbol
11
+ def to_json(*a)
12
+ {
13
+ JSON.create_id => self.class.name,
14
+ 's' => to_s,
15
+ }.to_json(*a)
16
+ end
17
+
18
+ def self.json_create(o)
19
+ o['s'].to_sym
20
+ end
21
+ end
22
+
23
+ class Time
24
+ def self.json_create(object)
25
+ if usec = object.delete('u') # used to be tv_usec -> tv_nsec
26
+ object['n'] = usec * 1000
27
+ end
28
+ if respond_to?(:tv_nsec)
29
+ at(*object.values_at('s', 'n'))
30
+ else
31
+ at(object['s'], object['n'] / 1000)
32
+ end
33
+ end
34
+
35
+ def to_json(*args)
36
+ {
37
+ JSON.create_id => self.class.name,
38
+ 's' => tv_sec,
39
+ 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
40
+ }.to_json(*args)
41
+ end
42
+ end
43
+
44
+ class Date
45
+ def self.json_create(object)
46
+ civil(*object.values_at('y', 'm', 'd', 'sg'))
47
+ end
48
+
49
+ alias start sg unless method_defined?(:start)
50
+
51
+ def to_json(*args)
52
+ {
53
+ JSON.create_id => self.class.name,
54
+ 'y' => year,
55
+ 'm' => month,
56
+ 'd' => day,
57
+ 'sg' => start,
58
+ }.to_json(*args)
59
+ end
60
+ end
61
+
62
+ class DateTime
63
+ def self.json_create(object)
64
+ args = object.values_at('y', 'm', 'd', 'H', 'M', 'S')
65
+ of_a, of_b = object['of'].split('/')
66
+ if of_b and of_b != '0'
67
+ args << Rational(of_a.to_i, of_b.to_i)
68
+ else
69
+ args << of_a
70
+ end
71
+ args << object['sg']
72
+ civil(*args)
73
+ end
74
+
75
+ alias start sg unless method_defined?(:start)
76
+
77
+ def to_json(*args)
78
+ {
79
+ JSON.create_id => self.class.name,
80
+ 'y' => year,
81
+ 'm' => month,
82
+ 'd' => day,
83
+ 'H' => hour,
84
+ 'M' => min,
85
+ 'S' => sec,
86
+ 'of' => offset.to_s,
87
+ 'sg' => start,
88
+ }.to_json(*args)
89
+ end
90
+ end
91
+
92
+ class Range
93
+ def self.json_create(object)
94
+ new(*object['a'])
95
+ end
96
+
97
+ def to_json(*args)
98
+ {
99
+ JSON.create_id => self.class.name,
100
+ 'a' => [ first, last, exclude_end? ]
101
+ }.to_json(*args)
102
+ end
103
+ end
104
+
105
+ class Struct
106
+ def self.json_create(object)
107
+ new(*object['v'])
108
+ end
109
+
110
+ def to_json(*args)
111
+ klass = self.class.name
112
+ klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
113
+ {
114
+ JSON.create_id => klass,
115
+ 'v' => values,
116
+ }.to_json(*args)
117
+ end
118
+ end
119
+
120
+ class Exception
121
+ def self.json_create(object)
122
+ result = new(object['m'])
123
+ result.set_backtrace object['b']
124
+ result
125
+ end
126
+
127
+ def to_json(*args)
128
+ {
129
+ JSON.create_id => self.class.name,
130
+ 'm' => message,
131
+ 'b' => backtrace,
132
+ }.to_json(*args)
133
+ end
134
+ end
135
+
136
+ class Regexp
137
+ def self.json_create(object)
138
+ new(object['s'], object['o'])
139
+ end
140
+
141
+ def to_json(*)
142
+ {
143
+ JSON.create_id => self.class.name,
144
+ 'o' => options,
145
+ 's' => source,
146
+ }.to_json
147
+ end
148
+ end