paperclipftp 0.2.2 → 0.2.3

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/paperclipftp.rb +17 -2
  3. metadata +7 -6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.3
data/lib/paperclipftp.rb CHANGED
@@ -22,8 +22,23 @@ module Paperclip
22
22
  #class << self; attr_accessor :ftp_conn; end
23
23
 
24
24
  def exists?(style = default_style)
25
- Timeout::timeout(@timeout, FtpTimeout) do
26
- file_size(ftp_path(style)) > 0
25
+ first_try = true
26
+ begin
27
+ Timeout::timeout(@timeout, FtpTimeout) do
28
+ file_size(ftp_path(style)) > 0
29
+ end
30
+ rescue FtpTimeout => e
31
+ # we are really timing out here, lets honor the contract
32
+ raise e
33
+ rescue Timeout::Error => e
34
+ # sometimes those spurious timeout occur pretty much instantly, and are very disruptive
35
+ # in case they happen, lets try one more time before giving up
36
+ if first_try
37
+ first_try = false
38
+ retry
39
+ else
40
+ raise e
41
+ end
27
42
  end
28
43
  end
29
44
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclipftp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Damian Caruso
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-26 00:00:00 -04:00
18
+ date: 2011-06-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -83,5 +83,6 @@ rubygems_version: 1.6.2
83
83
  signing_key:
84
84
  specification_version: 3
85
85
  summary: Ftp storage support for paperclip file attachment
86
- test_files: []
87
-
86
+ test_files:
87
+ - test/paperclipftp_test.rb
88
+ - test/test_helper.rb