rhosync 2.1.7 → 2.1.10
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 +12 -0
- data/Rakefile +1 -1
- data/lib/rhosync/api/delete_user.rb +4 -0
- data/lib/rhosync/client_sync.rb +17 -8
- data/lib/rhosync/license.rb +2 -1
- data/lib/rhosync/ping/android.rb +31 -13
- data/lib/rhosync/read_state.rb +5 -0
- data/lib/rhosync/source.rb +19 -1
- data/lib/rhosync/source_sync.rb +18 -10
- data/lib/rhosync/version.rb +1 -1
- data/spec/api/delete_user_spec.rb +29 -10
- data/spec/client_sync_spec.rb +16 -4
- data/spec/doc/doc_spec.rb +5 -0
- data/spec/ping/android_spec.rb +45 -17
- data/spec/read_state_spec.rb +9 -0
- data/spec/source_sync_spec.rb +8 -4
- metadata +11 -82
- data/examples/simple/application.rb +0 -27
- data/examples/simple/sources/sample_adapter.rb +0 -5
- data/examples/simple/sources/simple_adapter.rb +0 -5
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 2.1.10
|
2
|
+
* #16001227 - raise exceptions on c2dm errors
|
3
|
+
* #1018 - delete read state for user as well
|
4
|
+
|
5
|
+
## 2.1.9
|
6
|
+
* #15143911 - Fix for incident schema changed message
|
7
|
+
|
8
|
+
## 2.1.8
|
9
|
+
* #1018 - added functionality to delete user source data on user delete
|
10
|
+
* updated to rake 0.9.2
|
11
|
+
* #14911833 - Add support for rolling back updates on sync errors
|
12
|
+
|
1
13
|
## 2.1.7
|
2
14
|
* #14021681 - check for client on client_sync class methods
|
3
15
|
* #14082861 - expose Store.lock timeout to high-level functions
|
data/Rakefile
CHANGED
@@ -73,7 +73,7 @@ begin
|
|
73
73
|
gemspec.add_dependency "rest-client", "~>1.6.1"
|
74
74
|
gemspec.add_dependency "sinatra", "~>1.2"
|
75
75
|
gemspec.add_dependency "templater", "~>1.0.0"
|
76
|
-
gemspec.add_dependency "rake", "~>0.
|
76
|
+
gemspec.add_dependency "rake", "~>0.9.2"
|
77
77
|
gemspec.add_development_dependency "log4r", "~>1.1.7"
|
78
78
|
gemspec.add_development_dependency "jeweler", ">=1.4.0"
|
79
79
|
gemspec.add_development_dependency "rspec", ">=1.3.0"
|
@@ -1,5 +1,9 @@
|
|
1
1
|
Server.api :delete_user do |params,user|
|
2
2
|
User.load(params[:user_id]).delete
|
3
3
|
App.load(APP_NAME).users.delete(params[:user_id])
|
4
|
+
params = {:app_id => APP_NAME,:user_id => params[:user_id]}
|
5
|
+
App.load(APP_NAME).sources.members.each{ |source|
|
6
|
+
Source.load(source, params).flash_store_data
|
7
|
+
}
|
4
8
|
"User deleted"
|
5
9
|
end
|
data/lib/rhosync/client_sync.rb
CHANGED
@@ -102,18 +102,22 @@ module Rhosync
|
|
102
102
|
|
103
103
|
# Checks if schema changed
|
104
104
|
def schema_changed?
|
105
|
-
|
105
|
+
if @source_sync.adapter.respond_to?(:schema)
|
106
|
+
schema_sha1 = @source.get_value(:schema_sha1)
|
107
|
+
|
108
|
+
if @client.get_value(:schema_sha1).nil?
|
109
|
+
@client.put_value(:schema_sha1,schema_sha1)
|
110
|
+
return false
|
111
|
+
elsif @client.get_value(:schema_sha1) == schema_sha1
|
112
|
+
return false
|
113
|
+
end
|
106
114
|
|
107
|
-
if @client.get_value(:schema_sha1).nil?
|
108
115
|
@client.put_value(:schema_sha1,schema_sha1)
|
109
|
-
|
110
|
-
|
116
|
+
@client.put_value(:schema_page,schema_sha1)
|
117
|
+
return true
|
118
|
+
else
|
111
119
|
return false
|
112
120
|
end
|
113
|
-
|
114
|
-
@client.put_value(:schema_sha1,schema_sha1)
|
115
|
-
@client.put_value(:schema_page,schema_sha1)
|
116
|
-
true
|
117
121
|
end
|
118
122
|
|
119
123
|
# Computes the metadata sha1 and returns metadata if client's sha1 doesn't
|
@@ -185,6 +189,9 @@ module Rhosync
|
|
185
189
|
c.rename("#{operation}_errors","#{operation}_errors_page")
|
186
190
|
end
|
187
191
|
end
|
192
|
+
@client.lock("update_rollback") do |c|
|
193
|
+
c.rename("update_rollback","update_rollback_page")
|
194
|
+
end
|
188
195
|
end
|
189
196
|
|
190
197
|
# Computes create links for a client and stores a copy as links page
|
@@ -344,6 +351,7 @@ module Rhosync
|
|
344
351
|
['create','update','delete'].each do |operation|
|
345
352
|
@client.flash_data("#{operation}_errors_page")
|
346
353
|
end
|
354
|
+
@client.flash_data("update_rollback_page")
|
347
355
|
end
|
348
356
|
|
349
357
|
def _send_errors
|
@@ -352,6 +360,7 @@ module Rhosync
|
|
352
360
|
res["#{operation}-error"] = @client.get_data("#{operation}_errors_page")
|
353
361
|
end
|
354
362
|
res["source-error"] = @source.lock(:errors) { |s| s.get_data(:errors) }
|
363
|
+
res["update-rollback"] = @client.get_data(:update_rollback_page)
|
355
364
|
res.reject! {|key,value| value.nil? or value.empty?}
|
356
365
|
res
|
357
366
|
end
|
data/lib/rhosync/license.rb
CHANGED
data/lib/rhosync/ping/android.rb
CHANGED
@@ -1,24 +1,42 @@
|
|
1
|
-
require '
|
1
|
+
require 'rest_client'
|
2
2
|
require 'uri'
|
3
|
+
|
3
4
|
module Rhosync
|
4
5
|
class Android
|
6
|
+
class StaleAuthToken < Exception; end
|
7
|
+
class InvalidAuthToken < Exception; end
|
8
|
+
class AndroidPingError < Exception; end
|
9
|
+
|
5
10
|
def self.ping(params)
|
6
11
|
begin
|
7
12
|
settings = get_config(Rhosync.base_directory)[Rhosync.environment]
|
8
13
|
authtoken = settings[:authtoken]
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
|
15
|
+
RestClient.post(
|
16
|
+
'https://android.apis.google.com/c2dm/send', c2d_message(params),
|
17
|
+
:authorization => "GoogleLogin auth=#{authtoken}"
|
18
|
+
) do |response, request, result, &block|
|
19
|
+
# return exceptions based on response code & body
|
20
|
+
case response.code
|
21
|
+
when 200
|
22
|
+
# TODO: Automate authtoken updates
|
23
|
+
if response[:update_client_auth]
|
24
|
+
raise StaleAuthToken.new(
|
25
|
+
"Stale auth token, please update :authtoken: in settings.yml."
|
26
|
+
)
|
27
|
+
# body will contain the exception class
|
28
|
+
elsif response.body =~ /^Error=(.*)$/
|
29
|
+
raise AndroidPingError.new("Android ping error: #{$1 || ''}")
|
30
|
+
else
|
31
|
+
response.return!(request, result, &block)
|
32
|
+
end
|
33
|
+
when 401, 403
|
34
|
+
raise InvalidAuthToken.new("Invalid auth token, please update :authtoken: in settings.yml.")
|
35
|
+
end
|
36
|
+
end
|
20
37
|
rescue Exception => error
|
21
|
-
log
|
38
|
+
log error
|
39
|
+
log error.backtrace.join("\n")
|
22
40
|
raise error
|
23
41
|
end
|
24
42
|
end
|
data/lib/rhosync/read_state.rb
CHANGED
@@ -18,6 +18,11 @@ module Rhosync
|
|
18
18
|
def self.delete(app_id)
|
19
19
|
Store.flash_data("#{class_prefix(self)}:#{app_id}:*")
|
20
20
|
end
|
21
|
+
|
22
|
+
def self.delete_user(params)
|
23
|
+
puts "#{class_prefix(self)}:#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}:*"
|
24
|
+
Store.flash_data("#{class_prefix(self)}:#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}:*")
|
25
|
+
end
|
21
26
|
|
22
27
|
private
|
23
28
|
def self.get_id(params)
|
data/lib/rhosync/source.rb
CHANGED
@@ -215,7 +215,19 @@ module Rhosync
|
|
215
215
|
def read_state
|
216
216
|
id = {:app_id => self.app_id,:user_id => user_by_partition,
|
217
217
|
:source_name => self.name}
|
218
|
-
|
218
|
+
load_read_state || ReadState.create(id)
|
219
|
+
end
|
220
|
+
|
221
|
+
def load_read_state
|
222
|
+
id = {:app_id => self.app_id,:user_id => user_by_partition,
|
223
|
+
:source_name => self.name}
|
224
|
+
ReadState.load(id)
|
225
|
+
end
|
226
|
+
|
227
|
+
def delete_user_read_state
|
228
|
+
id = {:app_id => self.app_id,:user_id => user_by_partition,
|
229
|
+
:source_name => self.name}
|
230
|
+
ReadState.delete_user(id)
|
219
231
|
end
|
220
232
|
|
221
233
|
def doc_suffix(doctype)
|
@@ -236,6 +248,12 @@ module Rhosync
|
|
236
248
|
self.partition_type = value
|
237
249
|
end
|
238
250
|
|
251
|
+
def flash_store_data
|
252
|
+
delete_user_read_state
|
253
|
+
flash_data('*')
|
254
|
+
flash_data(poll_interval_key)
|
255
|
+
end
|
256
|
+
|
239
257
|
def user_by_partition
|
240
258
|
self.partition.to_sym == :user ? self.user_id : '__shared__'
|
241
259
|
end
|
data/lib/rhosync/source_sync.rb
CHANGED
@@ -117,7 +117,7 @@ module Rhosync
|
|
117
117
|
true
|
118
118
|
end
|
119
119
|
|
120
|
-
def _process_create(
|
120
|
+
def _process_create(client,key,value,links,creates,deletes)
|
121
121
|
# Perform operation
|
122
122
|
link = @adapter.create value
|
123
123
|
# Store object-id link for the client
|
@@ -134,14 +134,21 @@ module Rhosync
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
def _process_update(
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
137
|
+
def _process_update(client,key,value)
|
138
|
+
begin
|
139
|
+
# Add id to object hash to forward to backend call
|
140
|
+
value['id'] = key
|
141
|
+
# Perform operation
|
142
|
+
@adapter.update value
|
143
|
+
rescue Exception => e
|
144
|
+
# TODO: This will be slow!
|
145
|
+
cd = client.get_data(:cd)
|
146
|
+
client.put_data(:update_rollback,{key => cd[key]},true) if cd[key]
|
147
|
+
raise e
|
148
|
+
end
|
142
149
|
end
|
143
150
|
|
144
|
-
def _process_delete(
|
151
|
+
def _process_delete(client,key,value,dels)
|
145
152
|
value['id'] = key
|
146
153
|
# Perform operation
|
147
154
|
@adapter.delete value
|
@@ -167,14 +174,15 @@ module Rhosync
|
|
167
174
|
# Call on source adapter to process individual object
|
168
175
|
case operation
|
169
176
|
when 'create'
|
170
|
-
_process_create(
|
177
|
+
_process_create(client,key,value,links,creates,deletes)
|
171
178
|
when 'update'
|
172
|
-
_process_update(
|
179
|
+
_process_update(client,key,value)
|
173
180
|
when 'delete'
|
174
|
-
_process_delete(
|
181
|
+
_process_delete(client,key,value,dels)
|
175
182
|
end
|
176
183
|
rescue Exception => e
|
177
184
|
log "SourceAdapter raised #{operation} exception: #{e}"
|
185
|
+
log e.backtrace.join("\n")
|
178
186
|
errors ||= {}
|
179
187
|
errors[key] = value
|
180
188
|
errors["#{key}-error"] = {'message'=>e.message}
|
data/lib/rhosync/version.rb
CHANGED
@@ -1,18 +1,37 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__),'api_helper')
|
2
2
|
|
3
3
|
describe "RhosyncApiDeleteUser" do
|
4
|
-
it_should_behave_like "ApiHelper"
|
4
|
+
it_should_behave_like "ApiHelper"
|
5
5
|
|
6
6
|
it "should delete user" do
|
7
7
|
params = {:api_token => @api_token,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
:attributes => {:login => 'testuser1', :password => 'testpass1'}}
|
9
|
+
post "/api/create_user", params
|
10
|
+
last_response.should be_ok
|
11
|
+
User.is_exist?(params[:attributes][:login]).should == true
|
12
|
+
|
13
|
+
#set up two users with data for the same source
|
14
|
+
params2 = {:app_id => APP_NAME,:user_id => 'testuser1'}
|
15
|
+
params3 = {:app_id => APP_NAME,:user_id => 'testuser'}
|
16
|
+
s = Source.load('SampleAdapter', params2)
|
17
|
+
s2 = Source.load('SampleAdapter', params3)
|
18
|
+
time = Time.now.to_i
|
19
|
+
s.read_state.refresh_time = time
|
20
|
+
s2.read_state.refresh_time = time
|
21
|
+
set_state(s.docname(:delete) => {'4'=>@product4})
|
22
|
+
set_state(s2.docname(:delete) => {'4'=>@product4})
|
23
|
+
verify_result(s.docname(:delete) => {'4'=>@product4})
|
24
|
+
verify_result(s2.docname(:delete) => {'4'=>@product4})
|
25
|
+
|
26
|
+
|
27
|
+
post "/api/delete_user", {:api_token => @api_token, :user_id => params[:attributes][:login]}
|
28
|
+
last_response.should be_ok
|
29
|
+
verify_result(s.docname(:delete) => {})
|
30
|
+
verify_result(s2.docname(:delete) => {'4'=>@product4})
|
31
|
+
s.load_read_state.should == nil
|
32
|
+
s2.load_read_state.refresh_time.should == time
|
33
|
+
User.is_exist?(params[:attributes][:login]).should == false
|
34
|
+
App.load(APP_NAME).users.members.should == ["testuser"]
|
35
|
+
|
17
36
|
end
|
18
37
|
end
|
data/spec/client_sync_spec.rb
CHANGED
@@ -68,6 +68,9 @@ describe "ClientSync" do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should handle update errors" do
|
71
|
+
broken_object = { ERROR => { 'price' => '99.99' } }
|
72
|
+
set_state(@c.docname(:cd) => broken_object)
|
73
|
+
set_test_data('test_db_storage',broken_object)
|
71
74
|
receive_and_send_cud('update')
|
72
75
|
end
|
73
76
|
|
@@ -97,10 +100,19 @@ describe "ClientSync" do
|
|
97
100
|
def receive_and_send_cud(operation)
|
98
101
|
msg = "Error #{operation} record"
|
99
102
|
op_data = {operation=>{ERROR=>{'an_attribute'=>msg,'name'=>'wrongname'}}}
|
100
|
-
@cs.receive_cud(op_data)
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
@cs.receive_cud(op_data)
|
104
|
+
if operation == 'update'
|
105
|
+
@cs.send_cud.should == [{"version"=>ClientSync::VERSION},
|
106
|
+
{"token"=>""}, {"count"=>0}, {"progress_count"=>1}, {"total_count"=>1},
|
107
|
+
{
|
108
|
+
"update-rollback"=>{"0_broken_object_id"=>{"price"=>"99.99"}},
|
109
|
+
"#{operation}-error"=>{"#{ERROR}-error"=>{"message"=>msg},ERROR=>op_data[operation][ERROR]}
|
110
|
+
}]
|
111
|
+
else
|
112
|
+
@cs.send_cud.should == [{"version"=>ClientSync::VERSION},
|
113
|
+
{"token"=>""}, {"count"=>0}, {"progress_count"=>0}, {"total_count"=>0},
|
114
|
+
{"#{operation}-error"=>{"#{ERROR}-error"=>{"message"=>msg},ERROR=>op_data[operation][ERROR]}}]
|
115
|
+
end
|
104
116
|
end
|
105
117
|
end
|
106
118
|
|
data/spec/doc/doc_spec.rb
CHANGED
@@ -173,6 +173,11 @@ eol
|
|
173
173
|
|
174
174
|
['create','update','delete'].each do |operation|
|
175
175
|
it "client #{operation} object(s) with error" do
|
176
|
+
if operation == 'update'
|
177
|
+
broken_object = { ERROR => { 'price' => '99.99' } }
|
178
|
+
set_state(@c.docname(:cd) => broken_object)
|
179
|
+
set_test_data('test_db_storage',broken_object)
|
180
|
+
end
|
176
181
|
params = {operation=>{ERROR=>{'an_attribute'=>"error #{operation}",'name'=>'wrongname'}},
|
177
182
|
:client_id => @c.id,
|
178
183
|
:source_name => @s.name}
|
data/spec/ping/android_spec.rb
CHANGED
@@ -8,28 +8,56 @@ describe "Ping Android" do
|
|
8
8
|
@params = {"device_pin" => @c.device_pin,
|
9
9
|
"sources" => [@s.name], "message" => 'hello world',
|
10
10
|
"vibrate" => '5', "badge" => '5', "sound" => 'hello.mp3'}
|
11
|
-
|
12
|
-
post.stub!(:new).and_return(post)
|
13
|
-
post.stub!(:set_form_data)
|
14
|
-
Net::HTTP::Post.stub!(:new).and_return(post)
|
15
|
-
|
16
|
-
@http = mock('http')
|
17
|
-
@http.stub!(:request)
|
18
|
-
@http.stub!(:use_ssl=)
|
19
|
-
@http.stub!(:verify_mode=)
|
20
|
-
@http.stub!(:start).and_yield(@http)
|
21
|
-
Net::HTTP.stub!(:new).and_return(@http)
|
11
|
+
@response = mock('response')
|
22
12
|
end
|
23
13
|
|
24
|
-
it "should ping android" do
|
25
|
-
|
14
|
+
it "should ping android successfully" do
|
15
|
+
result = 'id=0:34234234134254%abc123\n'
|
16
|
+
@response.stub!(:code).and_return(200)
|
17
|
+
@response.stub!(:body).and_return(result)
|
18
|
+
@response.stub!(:[]).and_return(false)
|
19
|
+
@response.stub!(:return!).and_return(@response)
|
20
|
+
RestClient.stub!(:post).and_yield(@response)
|
21
|
+
Android.ping(@params).body.should == result
|
26
22
|
end
|
27
23
|
|
28
|
-
it "should ping android with connection error" do
|
24
|
+
it "should ping android with 503 connection error" do
|
29
25
|
error = 'Connection refused'
|
30
|
-
@
|
31
|
-
|
32
|
-
|
26
|
+
@response.stub!(:body).and_return(error)
|
27
|
+
RestClient.stub!(:post).and_return { raise RestClient::Exception.new(@response,503) }
|
28
|
+
Android.should_receive(:log).twice
|
29
|
+
lambda { Android.ping(@params) }.should raise_error(RestClient::Exception)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should ping android with 200 error message" do
|
33
|
+
error = 'Error=QuotaExceeded'
|
34
|
+
@response.stub!(:code).and_return(200)
|
35
|
+
@response.stub!(:body).and_return(error)
|
36
|
+
@response.stub!(:[]).and_return(nil)
|
37
|
+
RestClient.stub!(:post).and_yield(@response)
|
38
|
+
Android.should_receive(:log).twice
|
39
|
+
lambda { Android.ping(@params) }.should raise_error(Android::AndroidPingError, "Android ping error: QuotaExceeded")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should ping android with stale auth token" do
|
43
|
+
@response.stub!(:code).and_return(200)
|
44
|
+
@response.stub!(:body).and_return('')
|
45
|
+
@response.stub!(:[]).and_return({:update_client_auth => 'abc123'})
|
46
|
+
RestClient.stub!(:post).and_yield(@response)
|
47
|
+
Android.should_receive(:log).twice
|
48
|
+
lambda { Android.ping(@params) }.should raise_error(
|
49
|
+
Android::StaleAuthToken, "Stale auth token, please update :authtoken: in settings.yml."
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should ping android with 401 error message" do
|
54
|
+
@response.stub!(:code).and_return(401)
|
55
|
+
@response.stub!(:body).and_return('')
|
56
|
+
RestClient.stub!(:post).and_yield(@response)
|
57
|
+
Android.should_receive(:log).twice
|
58
|
+
lambda { Android.ping(@params) }.should raise_error(
|
59
|
+
Android::InvalidAuthToken, "Invalid auth token, please update :authtoken: in settings.yml."
|
60
|
+
)
|
33
61
|
end
|
34
62
|
|
35
63
|
it "should compute c2d_message" do
|
data/spec/read_state_spec.rb
CHANGED
@@ -22,4 +22,13 @@ describe "ReadState" do
|
|
22
22
|
ReadState.delete(@a_fields[:name])
|
23
23
|
Store.db.keys("read_state*").should == []
|
24
24
|
end
|
25
|
+
|
26
|
+
it "should delete read_state from source" do
|
27
|
+
time = Time.now.to_i
|
28
|
+
@s.read_state.refresh_time = time
|
29
|
+
@s.load_read_state.refresh_time.should == time
|
30
|
+
|
31
|
+
@s.delete_user_read_state
|
32
|
+
@s.load_read_state.should == nil
|
33
|
+
end
|
25
34
|
end
|
data/spec/source_sync_spec.rb
CHANGED
@@ -145,11 +145,15 @@ describe "SourceSync" do
|
|
145
145
|
it "should do update with errors" do
|
146
146
|
msg = "Error updating record"
|
147
147
|
data = add_error_object({'4'=> { 'price' => '199.99' }},msg)
|
148
|
-
set_state(@c.docname(:update) => data
|
148
|
+
set_state(@c.docname(:update) => data,
|
149
|
+
@c.docname(:cd) => { ERROR => { 'price' => '99.99' } }
|
150
|
+
)
|
149
151
|
@ss.update(@c.id)
|
150
|
-
verify_result(
|
151
|
-
|
152
|
-
|
152
|
+
verify_result(
|
153
|
+
@c.docname(:update_errors) =>
|
154
|
+
{"#{ERROR}-error"=>{"message"=>msg}, ERROR=>data[ERROR]},
|
155
|
+
@c.docname(:update) => {'4'=> { 'price' => '199.99'}},
|
156
|
+
@c.docname(:update_rollback) => {ERROR=>{"price"=>"99.99"}})
|
153
157
|
end
|
154
158
|
end
|
155
159
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhosync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 2.1.
|
9
|
+
- 10
|
10
|
+
version: 2.1.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rhomobile
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -168,12 +168,12 @@ dependencies:
|
|
168
168
|
requirements:
|
169
169
|
- - ~>
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
hash:
|
171
|
+
hash: 63
|
172
172
|
segments:
|
173
173
|
- 0
|
174
|
-
-
|
175
|
-
-
|
176
|
-
version: 0.
|
174
|
+
- 9
|
175
|
+
- 2
|
176
|
+
version: 0.9.2
|
177
177
|
type: :runtime
|
178
178
|
version_requirements: *id010
|
179
179
|
- !ruby/object:Gem::Dependency
|
@@ -540,9 +540,6 @@ files:
|
|
540
540
|
- spec/testdata/upload2.txt
|
541
541
|
- spec/user_spec.rb
|
542
542
|
- tasks/redis.rake
|
543
|
-
- examples/simple/application.rb
|
544
|
-
- examples/simple/sources/sample_adapter.rb
|
545
|
-
- examples/simple/sources/simple_adapter.rb
|
546
543
|
homepage: http://rhomobile.com/products/rhosync
|
547
544
|
licenses: []
|
548
545
|
|
@@ -572,77 +569,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
572
569
|
requirements: []
|
573
570
|
|
574
571
|
rubyforge_project:
|
575
|
-
rubygems_version: 1.8.
|
572
|
+
rubygems_version: 1.8.7
|
576
573
|
signing_key:
|
577
574
|
specification_version: 3
|
578
575
|
summary: RhoSync Synchronization Framework
|
579
|
-
test_files:
|
580
|
-
|
581
|
-
- examples/simple/sources/sample_adapter.rb
|
582
|
-
- examples/simple/sources/simple_adapter.rb
|
583
|
-
- spec/api/api_helper.rb
|
584
|
-
- spec/api/create_client_spec.rb
|
585
|
-
- spec/api/create_user_spec.rb
|
586
|
-
- spec/api/delete_client_spec.rb
|
587
|
-
- spec/api/delete_user_spec.rb
|
588
|
-
- spec/api/get_api_token_spec.rb
|
589
|
-
- spec/api/get_client_params_spec.rb
|
590
|
-
- spec/api/get_db_doc_spec.rb
|
591
|
-
- spec/api/get_license_info_spec.rb
|
592
|
-
- spec/api/get_source_params_spec.rb
|
593
|
-
- spec/api/list_client_docs_spec.rb
|
594
|
-
- spec/api/list_clients_spec.rb
|
595
|
-
- spec/api/list_source_docs_spec.rb
|
596
|
-
- spec/api/list_sources_spec.rb
|
597
|
-
- spec/api/list_users_spec.rb
|
598
|
-
- spec/api/ping_spec.rb
|
599
|
-
- spec/api/push_deletes_spec.rb
|
600
|
-
- spec/api/push_objects_spec.rb
|
601
|
-
- spec/api/reset_spec.rb
|
602
|
-
- spec/api/rhosync_api_spec.rb
|
603
|
-
- spec/api/set_db_doc_spec.rb
|
604
|
-
- spec/api/set_refresh_time_spec.rb
|
605
|
-
- spec/api/stats_spec.rb
|
606
|
-
- spec/api/update_user_spec.rb
|
607
|
-
- spec/api/upload_file_spec.rb
|
608
|
-
- spec/api_token_spec.rb
|
609
|
-
- spec/app_spec.rb
|
610
|
-
- spec/apps/rhotestapp/application.rb
|
611
|
-
- spec/apps/rhotestapp/sources/base_adapter.rb
|
612
|
-
- spec/apps/rhotestapp/sources/fixed_schema_adapter.rb
|
613
|
-
- spec/apps/rhotestapp/sources/sample_adapter.rb
|
614
|
-
- spec/apps/rhotestapp/sources/simple_adapter.rb
|
615
|
-
- spec/apps/rhotestapp/sources/sub_adapter.rb
|
616
|
-
- spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb
|
617
|
-
- spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb
|
618
|
-
- spec/bulk_data/bulk_data_spec.rb
|
619
|
-
- spec/client_spec.rb
|
620
|
-
- spec/client_sync_spec.rb
|
621
|
-
- spec/doc/doc_spec.rb
|
622
|
-
- spec/document_spec.rb
|
623
|
-
- spec/generator/generator_spec.rb
|
624
|
-
- spec/generator/generator_spec_helper.rb
|
625
|
-
- spec/jobs/bulk_data_job_spec.rb
|
626
|
-
- spec/jobs/ping_job_spec.rb
|
627
|
-
- spec/jobs/source_job_spec.rb
|
628
|
-
- spec/license_spec.rb
|
629
|
-
- spec/model_spec.rb
|
630
|
-
- spec/perf/bulk_data_perf_spec.rb
|
631
|
-
- spec/perf/perf_spec_helper.rb
|
632
|
-
- spec/perf/store_perf_spec.rb
|
633
|
-
- spec/ping/android_spec.rb
|
634
|
-
- spec/ping/apple_spec.rb
|
635
|
-
- spec/ping/blackberry_spec.rb
|
636
|
-
- spec/read_state_spec.rb
|
637
|
-
- spec/rhosync_spec.rb
|
638
|
-
- spec/server/server_spec.rb
|
639
|
-
- spec/source_adapter_spec.rb
|
640
|
-
- spec/source_spec.rb
|
641
|
-
- spec/source_sync_spec.rb
|
642
|
-
- spec/spec_helper.rb
|
643
|
-
- spec/stats/middleware_spec.rb
|
644
|
-
- spec/stats/record_spec.rb
|
645
|
-
- spec/store_spec.rb
|
646
|
-
- spec/sync_states_spec.rb
|
647
|
-
- spec/test_methods_spec.rb
|
648
|
-
- spec/user_spec.rb
|
576
|
+
test_files: []
|
577
|
+
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class Application < Rhosync::Base
|
2
|
-
class << self
|
3
|
-
def authenticate(username,password,session)
|
4
|
-
true # do some interesting authentication here...
|
5
|
-
end
|
6
|
-
|
7
|
-
# Add hooks for application startup here
|
8
|
-
# Don't forget to call super at the end!
|
9
|
-
def initializer(path)
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
# Calling super here returns rack tempfile path:
|
14
|
-
# i.e. /var/folders/J4/J4wGJ-r6H7S313GEZ-Xx5E+++TI
|
15
|
-
# Note: This tempfile is removed when server stops or crashes...
|
16
|
-
# See http://rack.rubyforge.org/doc/Multipart.html for more info
|
17
|
-
#
|
18
|
-
# Override this by creating a copy of the file somewhere
|
19
|
-
# and returning the path to that file (then don't call super!):
|
20
|
-
# i.e. /mnt/myimages/soccer.png
|
21
|
-
def store_blob(obj,field_name,blob)
|
22
|
-
super #=> returns blob[:tempfile]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
Application.initializer(ROOT_PATH)
|