mobilize-base 1.296 → 1.297

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- temp_path = [target_path.gridsafe,"temp"].join("/")
85
- #delete the temp sheet's datasets if they are lingering
86
- temp_sheet_dst = Dataset.find_by_handler_and_path("gsheet",temp_path)
87
- temp_book_dst = Dataset.find_by_handler_and_path("gbook",target_path.gridsafe)
88
- [temp_sheet_dst, temp_book_dst].compact.each{|s| s.delete}
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
- temp_sheet.write(tsv,Gdrive.owner_name)
92
+ gdrive_user = gdrive_slot.split("@").first
93
+ temp_sheet.write(tsv,gdrive_user)
102
94
  rescue
103
95
  return nil
104
96
  end
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Base
3
- VERSION = "1.296"
3
+ VERSION = "1.297"
4
4
  end
5
5
  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.296'
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: -2602647237759817043
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: -2602647237759817043
237
+ hash: -414933210981921919
238
238
  requirements: []
239
239
  rubyforge_project: mobilize-base
240
240
  rubygems_version: 1.8.25