asir 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,10 +1,11 @@
1
1
  2012-12-29 Kurt A. Stephens <ks.github@kurtstephens.com>
2
2
 
3
- * v1.2.0: New version: API changes.
3
+ * v1.2.1: New version: API changes.
4
4
  * Message::State: internal object encapsulates state between #send_message, #receive_message, #send_result, #receive_result.
5
5
  * Callbacks: most callbacks take a MessageResult object instead of Message and/or Result objects.
6
6
  * UUID: Added new_uuid, process_uuid, counter_uuid, thread_uuid as mixin methods.
7
7
  * Identity: Removed deprecated #client, #server attributes, use additional_data.
8
+ * JSON: Moved ASIR::Coder::JSON to gem asir_json.
8
9
 
9
10
  2012-12-28 Kurt A. Stephens <ks.github@kurtstephens.com>
10
11
  * v1.1.12: New version.
@@ -38,7 +38,7 @@ h3. Features
38
38
  * Support for multiple encodings:
39
39
  ** Marshal.
40
40
  ** XML. (gem asir_xml)
41
- ** JSON.
41
+ ** JSON. (gem asir_json)
42
42
  ** YAML.
43
43
  ** Base64.
44
44
  ** ZLib.
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
28
28
  end
29
29
  s.add_dependency "httpclient", "~> 2.3.0"
30
30
  s.add_dependency "rack", "~> 1.4.1"
31
- s.add_dependency "json", ">= 1.5.3"
32
31
 
33
32
  s.add_development_dependency 'rake', '>= 0.9.0'
34
33
  s.add_development_dependency 'rspec', '~> 2.12.0'
@@ -1,3 +1,3 @@
1
1
  module ASIR
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -1,9 +1,3 @@
1
1
  require 'rubygems'
2
- case (RUBY_PLATFORM rescue 'UNKNOWN')
3
- when /java/
4
- gem 'json_pure'
5
- else
6
- gem 'json'
7
- gem 'simplecov'
8
- end
2
+ gem 'simplecov'
9
3
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asir
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,22 +59,6 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.4.1
62
- - !ruby/object:Gem::Dependency
63
- name: json
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: 1.5.3
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: 1.5.3
78
62
  - !ruby/object:Gem::Dependency
79
63
  name: rake
80
64
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +186,6 @@ files:
202
186
  - lib/asir/coder/chain.rb
203
187
  - lib/asir/coder/database.rb
204
188
  - lib/asir/coder/identity.rb
205
- - lib/asir/coder/json.rb
206
189
  - lib/asir/coder/marshal.rb
207
190
  - lib/asir/coder/null.rb
208
191
  - lib/asir/coder/proc.rb
@@ -258,7 +241,6 @@ files:
258
241
  - spec/debug_helper.rb
259
242
  - spec/demux_spec.rb
260
243
  - spec/example_spec.rb
261
- - spec/json_spec.rb
262
244
  - spec/message_spec.rb
263
245
  - spec/performance_spec.rb
264
246
  - spec/spec_helper.rb
@@ -298,7 +280,6 @@ test_files:
298
280
  - spec/debug_helper.rb
299
281
  - spec/demux_spec.rb
300
282
  - spec/example_spec.rb
301
- - spec/json_spec.rb
302
283
  - spec/message_spec.rb
303
284
  - spec/performance_spec.rb
304
285
  - spec/spec_helper.rb
@@ -1,29 +0,0 @@
1
- require 'asir'
2
-
3
- module ASIR
4
- class Coder
5
- # !SLIDE
6
- # JSON Coder
7
- #
8
- # Note: Symbols are not handled.
9
- # The actual JSON expression is wrapped with an Array.
10
- class JSON < self
11
- def _encode obj
12
- [ obj ].to_json
13
- end
14
-
15
- def _decode obj
16
- ::JSON.parser.new(obj).
17
- parse.first
18
- end
19
- end
20
- # !SLIDE END
21
- end
22
- end
23
-
24
- if RUBY_PLATFORM =~ /java/
25
- require 'json'
26
- else
27
- require 'json/ext'
28
- end
29
-
@@ -1,140 +0,0 @@
1
- require File.expand_path('../spec_helper', __FILE__)
2
- require 'asir/coder/json'
3
-
4
- describe "ASIR::Coder::JSON" do
5
- before(:each) do
6
- @enc = ASIR::Coder::JSON.new
7
- @dec = @enc.dup
8
- end
9
-
10
- basic_objs = [ ]
11
-
12
- [
13
- [ nil, 'null' ],
14
- true,
15
- false,
16
- ].each do | x |
17
- x, str = *x
18
- str ||= x.inspect
19
- str = "[#{str}]"
20
- basic_objs << [ x, str ]
21
- it "should handle #{x.inspect}" do
22
- out = @enc.prepare.encode(x)
23
- out.should == str
24
- @dec.prepare.decode(out).should == x
25
- end
26
- end
27
-
28
- [
29
- 1234,
30
- 1.234,
31
- [ :symbol, '"symbol"' ],
32
- ].each do | x |
33
- x, str = *x
34
- str ||= x.inspect
35
- str = "[#{str}]"
36
- basic_objs << [ x, str ]
37
- it "should handle #{x.inspect}" do
38
- out = @enc.prepare.encode(x)
39
- out.should == str
40
- y = @dec.prepare.decode(out)
41
- y = y.to_sym if Symbol === x
42
- y.should == x
43
- end
44
- end
45
-
46
- [
47
- 'String',
48
- ].each do | x |
49
- x, str = *x
50
- str ||= x.inspect
51
- str = "[#{str}]"
52
- basic_objs << [ x, str ]
53
- it "should handle #{x.inspect}" do
54
- out = @enc.prepare.encode(x)
55
- out.should == str
56
- y = @dec.prepare.decode(out)
57
- y.should == x
58
- end
59
- end
60
-
61
- it "should handle empty Array" do
62
- x = [ ]
63
- out = @enc.prepare.encode(x)
64
- out.should == "[[]]"
65
- @dec.prepare.decode(out).should == x
66
- end
67
-
68
- it "should handle Array" do
69
- x = basic_objs.map{|e| e[0]}
70
- out = @enc.encode(x)
71
- out.should == "[[null,true,false,1234,1.234,\"symbol\",\"String\"]]"
72
- y = @dec.decode(out)
73
- y.should == x.map{|e| Symbol === e ? e.to_s : e }
74
- end
75
-
76
- it "should handle empty Hash" do
77
- x = { }
78
- out = @enc.encode(x)
79
- out.should == "[{}]"
80
- @dec.decode(out).should == x
81
- end
82
-
83
- it "should handle Hash" do
84
- x = Hash[ *basic_objs.flatten.reverse ]
85
- out = @enc.prepare.encode(x)
86
- out.should =~ %r{\A\[\{}
87
- out.should =~ %r{\}\]\Z}
88
- basic_objs.each do | v, str |
89
- # out.should =~ %r{#{k.inspect}:}
90
- out.should =~ %r{#{str}}
91
- end
92
- y = @dec.prepare.decode(out)
93
- y.should == x.inject({}){|h, (k, v)| h[k] = Symbol === v ? v.to_s : v; h }
94
- end
95
-
96
- module ASIR::Coder::Test
97
- class Object
98
- attr_accessor :a, :h, :o
99
- end
100
- end
101
-
102
- it "should handle deep objects" do
103
- x = ASIR::Coder::Test::Object.new
104
- x.a = [ *basic_objs.map{|a| a[0]} ]
105
- x.h = Hash[ *basic_objs.flatten.reverse ]
106
- x.o = ASIR::Coder::Test::Object.new
107
- x.o.a = 123
108
- out = @enc.prepare.encode(x)
109
- if out =~ %r{#<ASIR::Coder::Test::Object}
110
- out.should =~ %r{\A\[\"#<ASIR::Coder::Test::Object:[^>]+>\"\]\Z}
111
- else
112
- out.should =~ %r{"a":\[null,true,false,1234,1.234,"symbol","String"\]}
113
- out.should =~ %r{"h":\{}
114
- out.should =~ %r{"\[1234\]":1234}
115
- out.should =~ %r{"\[1.234\]":1.234}
116
- out.should =~ %r{"\[null\]":null}
117
- out.should =~ %r{"\[\\"String\\"\]":"String"}
118
- out.should =~ %r{"\[\\"symbol\\"\]":"symbol"}
119
- out.should =~ %r{"\[null\]":null}
120
- out.should =~ %r{"\[true\]":true}
121
- out.should =~ %r{"\[null\]":null}
122
- end
123
-
124
- # FIXME:
125
- #out.should =~ %r{<#{x.class.name.gsub('::', '.')} id=\"#{x.object_id}\" >}
126
- #out.should =~ %r{</#{x.class.name.gsub('::', '.')}>}
127
- y = @dec.prepare.decode(out)
128
- (String === y).should == true
129
- =begin
130
- FIXME:
131
- y.a.should == x.a
132
- y.h.should == x.h
133
- y.o.class.should == ASIR::Coder::Test::Object
134
- y.o.a.should == x.o.a
135
- x.instance_variables.sort { | a, b | a.to_s <=> b.to_s }.should ==
136
- y.instance_variables.sort { | a, b | a.to_s <=> b.to_s }
137
- =end
138
- end
139
- end
140
-