mobilize-base 1.1.08 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,7 @@ module Mobilize
|
|
47
47
|
|
48
48
|
#email management - used to make sure not too many emails get used at the same time
|
49
49
|
def Gdrive.slot_worker_by_path(path)
|
50
|
-
working_slots = Mobilize::Resque.jobs
|
50
|
+
working_slots = Mobilize::Resque.jobs.map{|j| begin j['args'][1]['gdrive_slot'];rescue;nil;end}.compact.uniq
|
51
51
|
Gdrive.workers.sort_by{rand}.each do |w|
|
52
52
|
unless working_slots.include?([w['name'],Gdrive.domain].join("@"))
|
53
53
|
Mobilize::Resque.set_worker_args_by_path(path,{'gdrive_slot'=>[w['name'],Gdrive.domain].join("@")})
|
@@ -57,8 +57,18 @@ module Mobilize
|
|
57
57
|
tsv = source_dst.read(user.name)
|
58
58
|
sheet_name = target_path.split("/").last
|
59
59
|
temp_path = [stage_path.gridsafe,sheet_name].join("/")
|
60
|
+
#find and delete temp sheet, if any
|
61
|
+
temp_sheet = Gsheet.find_by_path(temp_path,gdrive_slot)
|
62
|
+
temp_sheet.delete if temp_sheet
|
63
|
+
#write data to temp sheet
|
60
64
|
temp_sheet = Gsheet.find_or_create_by_path(temp_path,gdrive_slot)
|
61
|
-
|
65
|
+
#this step has a tendency to fail; if it does,
|
66
|
+
#don't fail the stage, mark it as false
|
67
|
+
begin
|
68
|
+
temp_sheet.write(tsv,Gdrive.owner_name)
|
69
|
+
rescue
|
70
|
+
return nil
|
71
|
+
end
|
62
72
|
temp_sheet.check_and_fix(tsv)
|
63
73
|
target_sheet = Gsheet.find_by_path(target_path,gdrive_slot)
|
64
74
|
unless target_sheet
|
@@ -68,7 +78,13 @@ module Mobilize
|
|
68
78
|
target_sheet.spreadsheet.update_acl(user.email,"writer") unless target_sheet.spreadsheet.acl_entry(user.email).ie{|e| e and e.role=="owner"}
|
69
79
|
target_sheet.delete_sheet1
|
70
80
|
end
|
71
|
-
|
81
|
+
#this step has a tendency to fail; if it does,
|
82
|
+
#don't fail the stage, mark it as false
|
83
|
+
begin
|
84
|
+
target_sheet.merge(temp_sheet,user.name)
|
85
|
+
rescue
|
86
|
+
return nil
|
87
|
+
end
|
72
88
|
#delete the temp sheet's book
|
73
89
|
temp_sheet.spreadsheet.delete
|
74
90
|
status = "Write successful for #{target_path}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobilize-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
239
239
|
version: '0'
|
240
240
|
segments:
|
241
241
|
- 0
|
242
|
-
hash:
|
242
|
+
hash: 944227401708125254
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
none: false
|
245
245
|
requirements:
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
segments:
|
250
250
|
- 0
|
251
|
-
hash:
|
251
|
+
hash: 944227401708125254
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project: mobilize-base
|
254
254
|
rubygems_version: 1.8.24
|