gwt_rpc 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gwt_rpc}
8
- s.version = "0.0.1"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Carpenter"]
12
- s.date = %q{2011-02-02}
12
+ s.date = %q{2011-06-15}
13
13
  s.description = %q{Spider Google Web Toolkit sites using ruby}
14
14
  s.email = %q{andrew.main@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
65
65
  s.homepage = %q{http://github.com/andrewcarpenter/gwt_rpc}
66
66
  s.licenses = ["MIT"]
67
67
  s.require_paths = ["lib"]
68
- s.rubygems_version = %q{1.4.2}
68
+ s.rubygems_version = %q{1.6.2}
69
69
  s.summary = %q{Ruby Google Web Toolkit client}
70
70
  s.test_files = [
71
71
  "spec/gwt_rpc/base_extensions/array_spec.rb",
@@ -6,7 +6,6 @@ module GwtRpc::BaseExtensions::Date
6
6
  module ClassMethods
7
7
  def gwt_deserialize(reader)
8
8
  reader.read_int
9
- reader.read_int
10
9
  end
11
10
  end
12
11
  end
@@ -12,9 +12,7 @@ module GwtRpc::BaseExtensions::Float
12
12
 
13
13
  module ClassMethods
14
14
  def gwt_deserialize(reader)
15
- ret = reader.read_int.to_f
16
- reader.read_int # FIXME: ignoring this for now...
17
- ret
15
+ reader.read_int.to_f
18
16
  end
19
17
  end
20
18
  end
@@ -13,7 +13,14 @@ class GwtRpc::Client
13
13
  @js_url
14
14
  end
15
15
 
16
- delegate :domain, :js_url, :to => "self.class"
16
+ def self.gwt_permutation(permutation = nil)
17
+ if permutation
18
+ @gwt_permutation = permutation
19
+ end
20
+ @gwt_permutation
21
+ end
22
+
23
+ delegate :domain, :js_url, :gwt_permutation, :to => "self.class"
17
24
 
18
25
  def self.map_classes(mapping)
19
26
  @class_map ||= {}
@@ -11,7 +11,11 @@ class GwtRpc::Request
11
11
  begin
12
12
  response = Typhoeus::Request.post(url,
13
13
  :body => body,
14
- :headers => {'Content-Type' => "text/x-gwt-rpc; charset=utf-8"},
14
+ :headers => {
15
+ 'Content-Type' => "text/x-gwt-rpc; charset=utf-8",
16
+ 'X-GWT-Module-Base' => @client.js_url,
17
+ 'X-GWT-Permutation' => @client.gwt_permutation,
18
+ },
15
19
  :timeout => 1000,
16
20
  :cache_timeout => 60)
17
21
  return GwtRpc::Response.new(@client, response).content
@@ -8,7 +8,7 @@ class GwtRpc::Response
8
8
  @raw_response = raw_response
9
9
 
10
10
  raise GwtRpc::Error::NoResponse.new("Error: no response to request") if @raw_response.code == 0
11
- raise GwtRpc::Error::ServerError.new("Error: status code #{@raw_response.code} not 200") if @raw_response.code != 200
11
+ raise GwtRpc::Error::ServerError.new("Error: status code #{@raw_response.code} not 200; body is #{@raw_response.body}") if @raw_response.code != 200
12
12
  raise GwtRpc::Error::ServerError.new("Error: #{@raw_response.body}") if @raw_response.body !~ /^\/\/OK/
13
13
  end
14
14
 
@@ -4,7 +4,8 @@ class GwtRpc::Response::Reader
4
4
  attr_reader :version, :string_table, :data, :objects
5
5
  def initialize(client, json_body)
6
6
  @client = client
7
- (@version, placeholder, @string_table, *@data) = JSON.parse(json_body).reverse
7
+ true_json = demangle_json_body(json_body)
8
+ (@version, placeholder, @string_table, *@data) = JSON.parse(true_json).reverse
8
9
  @max_prior_string_location = 0
9
10
  @objects = []
10
11
  end
@@ -34,6 +35,7 @@ class GwtRpc::Response::Reader
34
35
  int = read_int
35
36
 
36
37
  if int < 0
38
+ puts "reading obj reference (#{int})" if DEBUG
37
39
  obj = @objects[-1 - int]
38
40
  # if int == -11
39
41
  # puts obj.inspect
@@ -58,6 +60,7 @@ class GwtRpc::Response::Reader
58
60
  raise "unknown java class '#{java_class}'"
59
61
  end
60
62
  elsif int == 0
63
+ puts "reading obj nil (0)" if DEBUG
61
64
  obj = nil
62
65
  end
63
66
  obj
@@ -72,4 +75,16 @@ class GwtRpc::Response::Reader
72
75
 
73
76
  html
74
77
  end
78
+
79
+ def demangle_json_body(faux_json)
80
+ if faux_json.match(/^\[(.+),\[(.+)\],0,7\]$/)
81
+ data = $1
82
+ string_table = $2
83
+ data.gsub!(/'/,'"')
84
+
85
+ "[#{data},[#{string_table}],0,7]"
86
+ else
87
+ raise "can't demangle"
88
+ end
89
+ end
75
90
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gwt_rpc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
5
+ version: 0.1.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Andrew Carpenter
@@ -15,171 +10,130 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-02-02 00:00:00 -08:00
13
+ date: 2011-06-15 00:00:00 -07:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
17
  name: typhoeus
24
- type: :runtime
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
26
19
  none: false
27
20
  requirements:
28
21
  - - ">="
29
22
  - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
23
  version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
24
+ type: :runtime
36
25
  prerelease: false
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
37
28
  name: activesupport
38
- type: :runtime
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
40
30
  none: false
41
31
  requirements:
42
32
  - - ">="
43
33
  - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
34
  version: "0"
48
- requirement: *id002
49
- - !ruby/object:Gem::Dependency
35
+ type: :runtime
50
36
  prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
51
39
  name: json
52
- type: :runtime
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
54
41
  none: false
55
42
  requirements:
56
43
  - - ">="
57
44
  - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
45
  version: "0"
62
- requirement: *id003
63
- - !ruby/object:Gem::Dependency
46
+ type: :runtime
64
47
  prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
65
50
  name: rspec
66
- type: :development
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
68
52
  none: false
69
53
  requirements:
70
54
  - - ">"
71
55
  - !ruby/object:Gem::Version
72
- hash: 15
73
- segments:
74
- - 2
75
- - 0
76
- - 0
77
56
  version: 2.0.0
78
- requirement: *id004
79
- - !ruby/object:Gem::Dependency
57
+ type: :development
80
58
  prerelease: false
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
81
61
  name: bundler
82
- type: :development
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
84
63
  none: false
85
64
  requirements:
86
65
  - - ~>
87
66
  - !ruby/object:Gem::Version
88
- hash: 23
89
- segments:
90
- - 1
91
- - 0
92
- - 0
93
67
  version: 1.0.0
94
- requirement: *id005
95
- - !ruby/object:Gem::Dependency
68
+ type: :development
96
69
  prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
97
72
  name: jeweler
98
- type: :development
99
- version_requirements: &id006 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
100
74
  none: false
101
75
  requirements:
102
76
  - - ~>
103
77
  - !ruby/object:Gem::Version
104
- hash: 1
105
- segments:
106
- - 1
107
- - 5
108
- - 1
109
78
  version: 1.5.1
110
- requirement: *id006
111
- - !ruby/object:Gem::Dependency
79
+ type: :development
112
80
  prerelease: false
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
113
83
  name: rcov
114
- type: :development
115
- version_requirements: &id007 !ruby/object:Gem::Requirement
84
+ requirement: &id007 !ruby/object:Gem::Requirement
116
85
  none: false
117
86
  requirements:
118
87
  - - ">="
119
88
  - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
89
  version: "0"
124
- requirement: *id007
125
- - !ruby/object:Gem::Dependency
90
+ type: :development
126
91
  prerelease: false
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
127
94
  name: typhoeus
128
- type: :runtime
129
- version_requirements: &id008 !ruby/object:Gem::Requirement
95
+ requirement: &id008 !ruby/object:Gem::Requirement
130
96
  none: false
131
97
  requirements:
132
98
  - - ">="
133
99
  - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
136
- - 0
137
100
  version: "0"
138
- requirement: *id008
139
- - !ruby/object:Gem::Dependency
101
+ type: :runtime
140
102
  prerelease: false
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
141
105
  name: activesupport
142
- type: :runtime
143
- version_requirements: &id009 !ruby/object:Gem::Requirement
106
+ requirement: &id009 !ruby/object:Gem::Requirement
144
107
  none: false
145
108
  requirements:
146
109
  - - ">="
147
110
  - !ruby/object:Gem::Version
148
- hash: 3
149
- segments:
150
- - 0
151
111
  version: "0"
152
- requirement: *id009
153
- - !ruby/object:Gem::Dependency
112
+ type: :runtime
154
113
  prerelease: false
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
155
116
  name: json
156
- type: :runtime
157
- version_requirements: &id010 !ruby/object:Gem::Requirement
117
+ requirement: &id010 !ruby/object:Gem::Requirement
158
118
  none: false
159
119
  requirements:
160
120
  - - ">="
161
121
  - !ruby/object:Gem::Version
162
- hash: 3
163
- segments:
164
- - 0
165
122
  version: "0"
166
- requirement: *id010
167
- - !ruby/object:Gem::Dependency
123
+ type: :runtime
168
124
  prerelease: false
125
+ version_requirements: *id010
126
+ - !ruby/object:Gem::Dependency
169
127
  name: rspec
170
- type: :development
171
- version_requirements: &id011 !ruby/object:Gem::Requirement
128
+ requirement: &id011 !ruby/object:Gem::Requirement
172
129
  none: false
173
130
  requirements:
174
131
  - - ">"
175
132
  - !ruby/object:Gem::Version
176
- hash: 25
177
- segments:
178
- - 1
179
- - 2
180
- - 3
181
133
  version: 1.2.3
182
- requirement: *id011
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: *id011
183
137
  description: Spider Google Web Toolkit sites using ruby
184
138
  email: andrew.main@gmail.com
185
139
  executables: []
@@ -248,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
202
  requirements:
249
203
  - - ">="
250
204
  - !ruby/object:Gem::Version
251
- hash: 3
205
+ hash: -1042891651709601889
252
206
  segments:
253
207
  - 0
254
208
  version: "0"
@@ -257,14 +211,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
211
  requirements:
258
212
  - - ">="
259
213
  - !ruby/object:Gem::Version
260
- hash: 3
261
- segments:
262
- - 0
263
214
  version: "0"
264
215
  requirements: []
265
216
 
266
217
  rubyforge_project:
267
- rubygems_version: 1.4.2
218
+ rubygems_version: 1.6.2
268
219
  signing_key:
269
220
  specification_version: 3
270
221
  summary: Ruby Google Web Toolkit client