mobilize-base 1.293 → 1.294
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/README.md
CHANGED
@@ -220,9 +220,8 @@ production:
|
|
220
220
|
|
221
221
|
gsheet.yml needs:
|
222
222
|
* max_cells, which is the number of cells a sheet is allowed to have
|
223
|
-
written to it at one time. Default is
|
224
|
-
|
225
|
-
you try to write more than that.
|
223
|
+
written to it at one time. Default is 50k cells, which is about how
|
224
|
+
much you can write before things start breaking.
|
226
225
|
* Because Google Docs ties date formatting to the Locale for the
|
227
226
|
spreadsheet, there are 2 date format parameters:
|
228
227
|
* read_date_format, which is the format that should be read FROM google
|
@@ -13,7 +13,7 @@ module GoogleDrive
|
|
13
13
|
f = self
|
14
14
|
#admin includes workers
|
15
15
|
return true if f.has_admin_acl?
|
16
|
-
accounts = (Mobilize::Gdrive.admin_emails + Mobilize::Gdrive.worker_emails)
|
16
|
+
accounts = (Mobilize::Gdrive.admin_emails + Mobilize::Gdrive.worker_emails).uniq
|
17
17
|
accounts.each do |email|
|
18
18
|
f.update_acl(email)
|
19
19
|
end
|
@@ -21,9 +21,9 @@ module GoogleDrive
|
|
21
21
|
|
22
22
|
def has_admin_acl?
|
23
23
|
f = self
|
24
|
-
curr_emails = f.acls.map{|a| a.scope}.sort
|
25
|
-
admin_emails = (Mobilize::Gdrive.admin_emails + Mobilize::Gdrive.worker_emails)
|
26
|
-
if (curr_emails & admin_emails) == admin_emails
|
24
|
+
curr_emails = f.acls.map{|a| a.scope}.compact.sort
|
25
|
+
admin_emails = (Mobilize::Gdrive.admin_emails + Mobilize::Gdrive.worker_emails).uniq
|
26
|
+
if curr_emails == admin_emails or (curr_emails & admin_emails) == admin_emails
|
27
27
|
return true
|
28
28
|
else
|
29
29
|
return false
|
@@ -32,9 +32,9 @@ module GoogleDrive
|
|
32
32
|
|
33
33
|
def has_worker_acl?
|
34
34
|
f = self
|
35
|
-
curr_emails = f.acls.map{|a| a.scope}.sort
|
35
|
+
curr_emails = f.acls.map{|a| a.scope}.compact.sort
|
36
36
|
worker_emails = Mobilize::Gdrive.worker_emails.sort
|
37
|
-
if (curr_emails & worker_emails) == worker_emails
|
37
|
+
if curr_emails == worker_emails or (curr_emails & worker_emails) == worker_emails
|
38
38
|
return true
|
39
39
|
else
|
40
40
|
return false
|
@@ -84,7 +84,7 @@ module GoogleDrive
|
|
84
84
|
end
|
85
85
|
def acl_entry(email)
|
86
86
|
f = self
|
87
|
-
f.acls.select{|a| ['group','user'].include?(a.scope_type) and a.scope == email}.first
|
87
|
+
f.acls.select{|a| ['group','user'].include?(a.scope_type) and a.scope and a.scope == email}.first
|
88
88
|
end
|
89
89
|
def entry_hash
|
90
90
|
f = self
|
@@ -132,9 +132,14 @@ module Mobilize
|
|
132
132
|
raise "Need source for gsheet write" unless source
|
133
133
|
tsv = source.read(u.name,gdrive_slot)
|
134
134
|
raise "No data source found for #{source.url}" unless tsv
|
135
|
-
|
135
|
+
tsv_row_count = tsv.to_s.split("\n").length
|
136
|
+
tsv_col_count = tsv.to_s.split("\n").first.to_s.split("\t").length
|
137
|
+
tsv_cell_count = tsv_row_count * tsv_col_count
|
138
|
+
stdout = if tsv_row_count == 0
|
136
139
|
#soft error; no data to write. Stage will complete.
|
137
140
|
"Write skipped for #{s.target.url}"
|
141
|
+
elsif tsv_cell_count > Gsheet.max_cells
|
142
|
+
raise "Too many datapoints; you have #{tsv_cell_count.to_s}, max is #{Gsheet.max_cells.to_s}"
|
138
143
|
else
|
139
144
|
Dataset.write_by_url(s.target.url,tsv,u.name,gdrive_slot,crop)
|
140
145
|
#update status
|
data/lib/samples/gsheet.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
---
|
2
2
|
development:
|
3
|
-
max_cells:
|
3
|
+
max_cells: 50000 #current google limit is 400k cells per book but fails earlier
|
4
4
|
read_date_format: "%Y-%m-%d" #format to record when reading sheets
|
5
5
|
sheet_date_format: "%m/%d/%Y" #format to use to parse sheets
|
6
6
|
test:
|
7
|
-
max_cells:
|
7
|
+
max_cells: 50000 #current google limit is 400k cells per book but fails earlier
|
8
8
|
read_date_format: "%Y-%m-%d" #format to record when reading sheets
|
9
9
|
sheet_date_format: "%m/%d/%Y" #format to use to parse sheets
|
10
10
|
staging:
|
11
|
-
max_cells:
|
11
|
+
max_cells: 50000 #current google limit is 400k cells per book but fails earlier
|
12
12
|
read_date_format: "%Y-%m-%d" #format to record when reading sheets
|
13
13
|
sheet_date_format: "%m/%d/%Y" #format to use to parse sheets
|
14
14
|
production:
|
15
|
-
max_cells:
|
15
|
+
max_cells: 50000 #current google limit is 400k cells per book but fails earlier
|
16
16
|
read_date_format: "%Y-%m-%d" #format to record when reading sheets
|
17
17
|
sheet_date_format: "%m/%d/%Y" #format to use to parse sheets
|
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.
|
4
|
+
version: '1.294'
|
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-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -225,7 +225,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '0'
|
226
226
|
segments:
|
227
227
|
- 0
|
228
|
-
hash:
|
228
|
+
hash: 1508381292879500596
|
229
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
230
|
none: false
|
231
231
|
requirements:
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
version: '0'
|
235
235
|
segments:
|
236
236
|
- 0
|
237
|
-
hash:
|
237
|
+
hash: 1508381292879500596
|
238
238
|
requirements: []
|
239
239
|
rubyforge_project: mobilize-base
|
240
240
|
rubygems_version: 1.8.25
|