mobilize-base 1.296 → 1.297
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/lib/mobilize-base/handlers/gsheet.rb +7 -15
- data/lib/mobilize-base/version.rb +1 -1
- metadata +3 -3
|
@@ -81,24 +81,16 @@ module Mobilize
|
|
|
81
81
|
|
|
82
82
|
def Gsheet.write_temp(target_path,gdrive_slot,tsv)
|
|
83
83
|
#find and delete temp sheet, if any
|
|
84
|
-
|
|
85
|
-
#
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
#then, the sheet itself
|
|
90
|
-
temp_sheet = Gsheet.find_by_path(temp_path,gdrive_slot)
|
|
91
|
-
temp_sheet.delete if temp_sheet
|
|
92
|
-
#write data to temp sheet
|
|
93
|
-
temp_sheet = Gsheet.find_or_create_by_path(temp_path,gdrive_slot)
|
|
94
|
-
#delete the temp sheet's datasets, they won't be needed again
|
|
95
|
-
temp_sheet_dst = Dataset.find_by_handler_and_path("gsheet",temp_path)
|
|
96
|
-
temp_book_dst = Dataset.find_by_handler_and_path("gbook",target_path.gridsafe)
|
|
97
|
-
[temp_sheet_dst, temp_book_dst].compact.each{|s| s.delete}
|
|
84
|
+
temp_book_title = target_path.gridsafe
|
|
85
|
+
#create book and sheet
|
|
86
|
+
temp_book = Gdrive.root(gdrive_slot).create_spreadsheet(temp_book_title)
|
|
87
|
+
rows, cols = tsv.split("\n").ie{|t| [t.length,t.first.split("\t").length]}
|
|
88
|
+
temp_sheet = temp_book.add_worksheet("temp",rows,cols)
|
|
98
89
|
#this step has a tendency to fail; if it does,
|
|
99
90
|
#don't fail the stage, mark it as false
|
|
100
91
|
begin
|
|
101
|
-
|
|
92
|
+
gdrive_user = gdrive_slot.split("@").first
|
|
93
|
+
temp_sheet.write(tsv,gdrive_user)
|
|
102
94
|
rescue
|
|
103
95
|
return nil
|
|
104
96
|
end
|
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.297'
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -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: -414933210981921919
|
|
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: -414933210981921919
|
|
238
238
|
requirements: []
|
|
239
239
|
rubyforge_project: mobilize-base
|
|
240
240
|
rubygems_version: 1.8.25
|