mobilize-base 1.295 → 1.296

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ require 'tempfile'
1
2
  module Mobilize
2
3
  module Gridfs
3
4
  def Gridfs.config
@@ -18,9 +19,9 @@ module Mobilize
18
19
  curr_zs = curr_file.data if curr_file
19
20
  #overwrite when there is a change
20
21
  if curr_zs != zs
21
- curr_file.delete if curr_file
22
+ Mongoid::GridFs.delete(curr_file.id) if curr_file
22
23
  #create temp file w zstring
23
- temp_file = Tempfile.new("#{string}#{Time.now.to_f}".to_md5)
24
+ temp_file = ::Tempfile.new("#{string}#{Time.now.to_f}".to_md5)
24
25
  temp_file.print(zs)
25
26
  temp_file.close
26
27
  #put data in file
@@ -82,6 +82,11 @@ module Mobilize
82
82
  def Gsheet.write_temp(target_path,gdrive_slot,tsv)
83
83
  #find and delete temp sheet, if any
84
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
85
90
  temp_sheet = Gsheet.find_by_path(temp_path,gdrive_slot)
86
91
  temp_sheet.delete if temp_sheet
87
92
  #write data to temp sheet
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Base
3
- VERSION = "1.295"
3
+ VERSION = "1.296"
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.295'
4
+ version: '1.296'
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-04-05 00:00:00.000000000 Z
12
+ date: 2013-04-06 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: -2613537944604284453
228
+ hash: -2602647237759817043
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: -2613537944604284453
237
+ hash: -2602647237759817043
238
238
  requirements: []
239
239
  rubyforge_project: mobilize-base
240
240
  rubygems_version: 1.8.25