model_attachment 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/model_attachment.rb +12 -12
  2. metadata +3 -3
@@ -14,7 +14,7 @@ require 'model_attachment/amazon'
14
14
 
15
15
  # The base module that gets included in ActiveRecord::Base.
16
16
  module ModelAttachment
17
- VERSION = "0.0.8"
17
+ VERSION = "0.0.9"
18
18
 
19
19
  class << self
20
20
 
@@ -293,19 +293,19 @@ module ModelAttachment
293
293
  remove_from_amazon
294
294
  end
295
295
 
296
- rescue Errno::ENOENT => e
297
- # ignore file-not-found, let everything else pass
296
+ rescue Exception => e
297
+ log("Error: #{e.message}")
298
298
  end
299
+
300
+ # remove document directory
299
301
  begin
300
- while(true)
301
- dir_path = File.dirname(full_filename)
302
- FileUtils.rmdir(dir_path)
303
- end
304
- rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR
305
- # Stop trying to remove parent directories
306
- rescue SystemCallError => e
307
- log("There was an unexpected error while deleting directories: #{e.class}")
308
- # Ignore it
302
+ dir_path = File.dirname(full_filename)
303
+ parts = dir_path.split(File::SEPARATOR)
304
+ dir_path = File.join(parts[0 .. -2])
305
+ log("Removing Dir: #{dir_path}")
306
+ FileUtils.rm_rf(dir_path)
307
+ rescue Exception => e
308
+ log("Error: #{e.message}")
309
309
  end
310
310
  end
311
311
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Steve Walker
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-05 00:00:00 -04:00
17
+ date: 2010-05-10 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency