paperclip-storage-ftp 1.1.0 → 1.2.0
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.
- checksums.yaml +7 -0
- data/.travis.yml +3 -1
- data/Gemfile +5 -0
- data/LICENSE +1 -1
- data/README.md +16 -2
- data/gemfiles/Gemfile.paperclip-2.x +6 -1
- data/gemfiles/Gemfile.paperclip-3.x +7 -2
- data/gemfiles/Gemfile.paperclip-4.x +15 -0
- data/lib/paperclip/storage/ftp.rb +21 -9
- data/lib/paperclip/storage/ftp/server.rb +34 -3
- data/paperclip-storage-ftp.gemspec +2 -1
- data/spec/integration_spec.rb +41 -6
- data/spec/paperclip/storage/ftp/server_spec.rb +7 -10
- data/spec/paperclip/storage/ftp_spec.rb +22 -15
- data/spec/support/integration/ftp_server.rb +2 -1
- data/spec/support/integration/user.rb +79 -16
- data/test-all.sh +29 -0
- metadata +37 -52
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 18a15c30e1b75f999126536007200110375d2005
|
4
|
+
data.tar.gz: c402de4d71aa7749219617cd3c9a07636b45e979
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 558948f893a8728ea1bf72506a6991357a2c685524919707e818df3b1cc7d1ff68df0e6cb475756b8e8dbdeb7b0f4a9620ead026f1cbc57846def429f769335e
|
7
|
+
data.tar.gz: a2ef9e53c6f7150ee4f19f9e12d7646ffced3dfd09ce497eb7f7b74d95a5502c95286b7170a13cbe33b294daf20d9276bf4d40df9eb95efd294b891bc4503fa2
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -63,12 +63,26 @@ class User < ActiveRecord::Base
|
|
63
63
|
:port => 2121, # optional, 21 by default
|
64
64
|
:passive => true # optional, false by default
|
65
65
|
}
|
66
|
-
]
|
66
|
+
],
|
67
|
+
|
68
|
+
# Optional socket connect timeout (in seconds).
|
69
|
+
# This only limits the connection phase, once connected this option is of no more use.
|
70
|
+
:ftp_connect_timeout => 5, # optional, nil by default (OS default timeout)
|
71
|
+
|
72
|
+
# If set to true and the connection to a particular server cannot be established,
|
73
|
+
# the connection error will be ignored and the files will not be uploaded to that server.
|
74
|
+
# If set to false and the connection to a particular server cannot be established,
|
75
|
+
# a SystemCallError will be raised (Errno::ETIMEDOUT, Errno::ENETUNREACH, etc.).
|
76
|
+
:ftp_ignore_failing_connections => true # optional, false by default
|
67
77
|
end
|
68
78
|
```
|
69
79
|
|
70
80
|
## Changelog
|
71
81
|
|
82
|
+
### 1.2.0
|
83
|
+
|
84
|
+
* New options `:ftp_connect_timeout` and `:ftp_ignore_failing_connections`. See usage example above.
|
85
|
+
|
72
86
|
### 1.1.0
|
73
87
|
|
74
88
|
Mostly performance enhancements
|
@@ -92,7 +106,7 @@ Mostly performance enhancements
|
|
92
106
|
|
93
107
|
You can find out more about our work on our [dev blog](http://devblog.xing.com).
|
94
108
|
|
95
|
-
Copyright (c)
|
109
|
+
Copyright (c) 2014 [XING AG](http://www.xing.com)
|
96
110
|
|
97
111
|
Released under the MIT license. For full details see [LICENSE](https://github.com/xing/paperclip-storage-ftp/blob/master/LICENSE)
|
98
112
|
included in this distribution.
|
@@ -7,6 +7,11 @@ gem "paperclip", "~>2.0"
|
|
7
7
|
group :test do
|
8
8
|
gem "activerecord", "~>3.0"
|
9
9
|
|
10
|
-
gem "sqlite3",
|
10
|
+
gem "sqlite3", :platforms => :ruby
|
11
11
|
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
12
12
|
end
|
13
|
+
|
14
|
+
platforms :rbx do
|
15
|
+
gem 'rubysl', '~> 2.0'
|
16
|
+
gem 'json'
|
17
|
+
end
|
@@ -5,6 +5,11 @@ gemspec :path => '..'
|
|
5
5
|
gem "paperclip", "~>3.0"
|
6
6
|
|
7
7
|
group :test do
|
8
|
-
gem "sqlite3",
|
9
|
-
gem "activerecord-jdbcsqlite3-adapter",
|
8
|
+
gem "sqlite3", :platforms => :ruby
|
9
|
+
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
10
|
+
end
|
11
|
+
|
12
|
+
platforms :rbx do
|
13
|
+
gem 'rubysl', '~> 2.0'
|
14
|
+
gem 'json'
|
10
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec :path => '..'
|
4
|
+
|
5
|
+
gem "paperclip", "~>4.0"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem "sqlite3", :platforms => :ruby
|
9
|
+
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
10
|
+
end
|
11
|
+
|
12
|
+
platforms :rbx do
|
13
|
+
gem 'rubysl', '~> 2.0'
|
14
|
+
gem 'json'
|
15
|
+
end
|
@@ -71,10 +71,12 @@ module Paperclip
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def with_primary_ftp_server(&blk)
|
74
|
-
primary_ftp_server
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
server = primary_ftp_server
|
75
|
+
begin
|
76
|
+
yield server
|
77
|
+
ensure
|
78
|
+
server.close_connection
|
79
|
+
end
|
78
80
|
end
|
79
81
|
|
80
82
|
def primary_ftp_server
|
@@ -82,14 +84,24 @@ module Paperclip
|
|
82
84
|
end
|
83
85
|
|
84
86
|
def with_ftp_servers(&blk)
|
85
|
-
ftp_servers
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
servers = ftp_servers
|
88
|
+
begin
|
89
|
+
yield servers
|
90
|
+
ensure
|
91
|
+
servers.each(&:close_connection)
|
92
|
+
end
|
89
93
|
end
|
90
94
|
|
91
95
|
def ftp_servers
|
92
|
-
|
96
|
+
ftp_servers = @options[:ftp_servers].map do |server_options|
|
97
|
+
server = Server.new(server_options.merge(
|
98
|
+
:connect_timeout => @options[:ftp_connect_timeout],
|
99
|
+
:ignore_connect_errors => @options[:ftp_ignore_failing_connections]
|
100
|
+
))
|
101
|
+
server.establish_connection
|
102
|
+
server
|
103
|
+
end
|
104
|
+
ftp_servers.select{|s| s.connected? }
|
93
105
|
end
|
94
106
|
end
|
95
107
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
require "pathname"
|
2
2
|
require "net/ftp"
|
3
|
+
require "timeout"
|
3
4
|
|
4
5
|
module Paperclip
|
5
6
|
module Storage
|
6
7
|
module Ftp
|
7
8
|
class Server
|
8
9
|
|
9
|
-
attr_accessor :host, :user, :password, :port, :passive
|
10
|
+
attr_accessor :host, :user, :password, :port, :passive,
|
11
|
+
:connect_timeout, :ignore_connect_errors
|
12
|
+
|
10
13
|
attr_reader :connection
|
11
14
|
|
12
15
|
def initialize(options = {})
|
@@ -20,12 +23,28 @@ module Paperclip
|
|
20
23
|
def establish_connection
|
21
24
|
@connection = Net::FTP.new
|
22
25
|
@connection.passive = passive
|
23
|
-
|
26
|
+
|
27
|
+
if ignore_connect_errors
|
28
|
+
begin
|
29
|
+
connect
|
30
|
+
rescue SystemCallError => e
|
31
|
+
Paperclip.log("could not connect to ftp://#{user}@#{host}:#{port} (#{e})")
|
32
|
+
@connection = nil
|
33
|
+
return
|
34
|
+
end
|
35
|
+
else
|
36
|
+
connect
|
37
|
+
end
|
38
|
+
|
24
39
|
@connection.login(user, password)
|
25
40
|
end
|
26
41
|
|
27
42
|
def close_connection
|
28
|
-
connection.close if
|
43
|
+
connection.close if connected?
|
44
|
+
end
|
45
|
+
|
46
|
+
def connected?
|
47
|
+
connection && !connection.closed?
|
29
48
|
end
|
30
49
|
|
31
50
|
def file_exists?(path)
|
@@ -60,6 +79,18 @@ module Paperclip
|
|
60
79
|
end
|
61
80
|
end
|
62
81
|
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def connect
|
86
|
+
if connect_timeout
|
87
|
+
Timeout.timeout(connect_timeout, Errno::ETIMEDOUT) do
|
88
|
+
@connection.connect(host, port)
|
89
|
+
end
|
90
|
+
else
|
91
|
+
@connection.connect(host, port)
|
92
|
+
end
|
93
|
+
end
|
63
94
|
end
|
64
95
|
end
|
65
96
|
end
|
@@ -5,13 +5,14 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.description = %q{Allow Paperclip attachments to be stored on FTP servers}
|
6
6
|
gem.summary = %q{Allow Paperclip attachments to be stored on FTP servers}
|
7
7
|
gem.homepage = "https://github.com/xing/paperclip-storage-ftp"
|
8
|
+
gem.license = "MIT"
|
8
9
|
|
9
10
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
10
11
|
gem.files = `git ls-files`.split("\n")
|
11
12
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
12
13
|
gem.name = "paperclip-storage-ftp"
|
13
14
|
gem.require_paths = ["lib"]
|
14
|
-
gem.version = "1.
|
15
|
+
gem.version = "1.2.0"
|
15
16
|
|
16
17
|
gem.add_dependency("paperclip")
|
17
18
|
|
data/spec/integration_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require "timeout"
|
2
3
|
|
3
4
|
describe "paperclip-storage-ftp", :integration => true do
|
4
5
|
|
@@ -15,12 +16,12 @@ describe "paperclip-storage-ftp", :integration => true do
|
|
15
16
|
let(:file) { File.new(File.expand_path("../support/integration/avatar.jpg", __FILE__), "rb") }
|
16
17
|
let(:user) { User.new }
|
17
18
|
|
18
|
-
let(:uploaded_file_server1) { FtpServer::USER1_PATH + "
|
19
|
-
let(:uploaded_file_server1_medium) { FtpServer::USER1_PATH + "
|
20
|
-
let(:uploaded_file_server1_thumb) { FtpServer::USER1_PATH + "
|
21
|
-
let(:uploaded_file_server2) { FtpServer::USER2_PATH + "
|
22
|
-
let(:uploaded_file_server2_medium) { FtpServer::USER2_PATH + "
|
23
|
-
let(:uploaded_file_server2_thumb) { FtpServer::USER2_PATH + "
|
19
|
+
let(:uploaded_file_server1) { FtpServer::USER1_PATH + "/original/avatar.jpg" }
|
20
|
+
let(:uploaded_file_server1_medium) { FtpServer::USER1_PATH + "/medium/avatar.jpg" }
|
21
|
+
let(:uploaded_file_server1_thumb) { FtpServer::USER1_PATH + "/thumb/avatar.jpg" }
|
22
|
+
let(:uploaded_file_server2) { FtpServer::USER2_PATH + "/original/avatar.jpg" }
|
23
|
+
let(:uploaded_file_server2_medium) { FtpServer::USER2_PATH + "/medium/avatar.jpg" }
|
24
|
+
let(:uploaded_file_server2_thumb) { FtpServer::USER2_PATH + "/thumb/avatar.jpg" }
|
24
25
|
|
25
26
|
it "stores the attachment on the ftp servers" do
|
26
27
|
user.avatar = file
|
@@ -66,4 +67,38 @@ describe "paperclip-storage-ftp", :integration => true do
|
|
66
67
|
File.exists?(uploaded_file_server1).should be_true
|
67
68
|
File.exists?(uploaded_file_server2).should be_true
|
68
69
|
end
|
70
|
+
|
71
|
+
it "allows ignoring failed connections" do
|
72
|
+
user = UserIgnoringFailingConnection.new
|
73
|
+
user.avatar = file
|
74
|
+
expect{ user.save! }.to_not raise_error
|
75
|
+
|
76
|
+
File.exists?(uploaded_file_server1).should be_true
|
77
|
+
File.exists?(uploaded_file_server1_medium).should be_true
|
78
|
+
File.exists?(uploaded_file_server1_thumb).should be_true
|
79
|
+
File.exists?(uploaded_file_server2).should be_false
|
80
|
+
File.exists?(uploaded_file_server2_medium).should be_false
|
81
|
+
File.exists?(uploaded_file_server2_thumb).should be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
it "raises a SystemCallError when not ignoring failed connections" do
|
85
|
+
user = UserNotIgnoringFailingConnection.new
|
86
|
+
user.avatar = file
|
87
|
+
expect{ user.save! }.to raise_error(SystemCallError)
|
88
|
+
end
|
89
|
+
|
90
|
+
unless ENV['TRAVIS']
|
91
|
+
it "allows setting a connect timeout" do
|
92
|
+
user = UserWithConnectTimeout.new
|
93
|
+
user.avatar = file
|
94
|
+
|
95
|
+
# Wrap the expectation in a timeout block to make
|
96
|
+
# sure we don't accidentally get a passing test by waiting
|
97
|
+
# for the Errno::ETIMEDOUT raised by the OS (usually in the
|
98
|
+
# seconds or minutes range)
|
99
|
+
Timeout.timeout(UserWithConnectTimeout::TIMEOUT + 1) do
|
100
|
+
expect { user.save! }.to raise_error(Errno::ETIMEDOUT)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
69
104
|
end
|
@@ -6,18 +6,15 @@ describe Paperclip::Storage::Ftp::Server do
|
|
6
6
|
context "initialize" do
|
7
7
|
it "accepts options to initialize attributes" do
|
8
8
|
options = {
|
9
|
-
:host
|
10
|
-
:user
|
11
|
-
:password
|
12
|
-
:port
|
13
|
-
:passive
|
9
|
+
:host => "ftp.example.com",
|
10
|
+
:user => "user",
|
11
|
+
:password => "password",
|
12
|
+
:port => 2121,
|
13
|
+
:passive => true,
|
14
|
+
:connect_timeout => 2
|
14
15
|
}
|
15
16
|
server = Paperclip::Storage::Ftp::Server.new(options)
|
16
|
-
server.
|
17
|
-
server.user.should == options[:user]
|
18
|
-
server.password.should == options[:password]
|
19
|
-
server.port.should == options[:port]
|
20
|
-
server.passive.should == options[:passive]
|
17
|
+
options.each{|k,v| server.send(k).should == v }
|
21
18
|
end
|
22
19
|
|
23
20
|
it "sets a default port" do
|
@@ -22,7 +22,9 @@ describe Paperclip::Storage::Ftp do
|
|
22
22
|
:password => "password2",
|
23
23
|
:passive => true
|
24
24
|
}
|
25
|
-
]
|
25
|
+
],
|
26
|
+
:ftp_connect_timeout => 5,
|
27
|
+
:ftp_ignore_failing_connections => true
|
26
28
|
})
|
27
29
|
end
|
28
30
|
|
@@ -139,9 +141,8 @@ describe Paperclip::Storage::Ftp do
|
|
139
141
|
end
|
140
142
|
|
141
143
|
context "#with_primary_ftp_server" do
|
142
|
-
it "yields the
|
144
|
+
it "yields the primary ftp server, closes the connection afterwards" do
|
143
145
|
attachment.stub(:primary_ftp_server).and_return(first_server)
|
144
|
-
first_server.should_receive(:establish_connection).ordered
|
145
146
|
first_server.should_receive(:close_connection).ordered
|
146
147
|
expect { |b| attachment.with_primary_ftp_server(&b) }.to yield_with_args(first_server)
|
147
148
|
end
|
@@ -149,15 +150,14 @@ describe Paperclip::Storage::Ftp do
|
|
149
150
|
|
150
151
|
context "#primary_ftp_server" do
|
151
152
|
it "returns the first server in the list" do
|
152
|
-
attachment.
|
153
|
+
attachment.stub(:ftp_servers).and_return([first_server, second_server])
|
154
|
+
attachment.primary_ftp_server.should == attachment.ftp_servers.first
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
156
158
|
context "#with_ftp_servers" do
|
157
|
-
it "yields the
|
159
|
+
it "yields the ftp servers, closes the connections afterwards" do
|
158
160
|
attachment.stub(:ftp_servers).and_return([first_server, second_server])
|
159
|
-
first_server.should_receive(:establish_connection).ordered
|
160
|
-
second_server.should_receive(:establish_connection).ordered
|
161
161
|
first_server.should_receive(:close_connection).ordered
|
162
162
|
second_server.should_receive(:close_connection).ordered
|
163
163
|
expect { |b| attachment.with_ftp_servers(&b) }.to yield_with_args([first_server, second_server])
|
@@ -166,14 +166,21 @@ describe Paperclip::Storage::Ftp do
|
|
166
166
|
|
167
167
|
context "#ftp_servers" do
|
168
168
|
it "returns the configured ftp servers" do
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
attachment.ftp_servers.first.
|
173
|
-
attachment.ftp_servers.
|
174
|
-
attachment.ftp_servers.
|
175
|
-
attachment.ftp_servers.
|
176
|
-
attachment.ftp_servers.
|
169
|
+
Paperclip::Storage::Ftp::Server.any_instance.stub(:establish_connection)
|
170
|
+
Paperclip::Storage::Ftp::Server.any_instance.stub(:connected?).and_return(true)
|
171
|
+
|
172
|
+
attachment.ftp_servers.first.host.should == "ftp1.example.com"
|
173
|
+
attachment.ftp_servers.first.user.should == "user1"
|
174
|
+
attachment.ftp_servers.first.password.should == "password1"
|
175
|
+
attachment.ftp_servers.first.port.should == 2121
|
176
|
+
attachment.ftp_servers.first.connect_timeout.should == 5
|
177
|
+
attachment.ftp_servers.first.ignore_connect_errors.should == true
|
178
|
+
attachment.ftp_servers.second.host.should == "ftp2.example.com"
|
179
|
+
attachment.ftp_servers.second.user.should == "user2"
|
180
|
+
attachment.ftp_servers.second.password.should == "password2"
|
181
|
+
attachment.ftp_servers.second.passive.should == true
|
182
|
+
attachment.ftp_servers.second.connect_timeout.should == 5
|
183
|
+
attachment.ftp_servers.second.ignore_connect_errors.should == true
|
177
184
|
end
|
178
185
|
end
|
179
186
|
end
|
@@ -27,7 +27,8 @@ class FtpServer
|
|
27
27
|
:start_command => "cd #{INSTALL_PATH}; ./bin/ftpd.sh res/conf/ftpd-typical.xml",
|
28
28
|
:ping_command => [:tcp, '127.0.0.1', 2121],
|
29
29
|
:pid_file => INSTALL_PATH + "/res/ftpd.pid",
|
30
|
-
:log_file => INSTALL_PATH + "/res/log/ftpd.log"
|
30
|
+
:log_file => INSTALL_PATH + "/res/log/ftpd.log",
|
31
|
+
:start_timeout => ENV['TRAVIS'] ? 120 : 10
|
31
32
|
)
|
32
33
|
end
|
33
34
|
end
|
@@ -14,25 +14,88 @@ ActiveRecord::Schema.define do
|
|
14
14
|
add_column :users, :avatar_updated_at, :datetime
|
15
15
|
end
|
16
16
|
|
17
|
-
class
|
17
|
+
class UserBase < ActiveRecord::Base
|
18
18
|
include Paperclip::Glue
|
19
|
+
self.table_name = "users"
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def self.avatar_options
|
22
|
+
{
|
23
|
+
:storage => :ftp,
|
24
|
+
:styles => { :medium => "50x50>", :thumb => "10x10>" },
|
25
|
+
:path => "/:style/:filename",
|
26
|
+
:ftp_servers => [
|
27
|
+
{
|
28
|
+
:host => "127.0.0.1",
|
29
|
+
:user => "user1",
|
30
|
+
:password => "secret1",
|
31
|
+
:port => 2121
|
32
|
+
},
|
33
|
+
{
|
34
|
+
:host => "127.0.0.1",
|
35
|
+
:user => "user2",
|
36
|
+
:password => "secret2",
|
37
|
+
:port => 2121
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# must be called after has_attached_file
|
44
|
+
def self.setup_validation
|
45
|
+
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class User < UserBase
|
50
|
+
has_attached_file :avatar, avatar_options
|
51
|
+
setup_validation
|
52
|
+
end
|
53
|
+
|
54
|
+
class UserWithConnectTimeout < UserBase
|
55
|
+
TIMEOUT = 0.1
|
56
|
+
|
57
|
+
has_attached_file :avatar, avatar_options.merge(
|
24
58
|
:ftp_servers => [
|
25
59
|
{
|
26
|
-
:host
|
27
|
-
:user => "user1",
|
28
|
-
:password => "secret1",
|
29
|
-
:port => 2121
|
30
|
-
},
|
31
|
-
{
|
32
|
-
:host => "127.0.0.1",
|
33
|
-
:user => "user2",
|
34
|
-
:password => "secret2",
|
35
|
-
:port => 2121
|
60
|
+
:host => "127.0.0.2" # should raise Errno::ETIMEDOUT
|
36
61
|
}
|
37
|
-
]
|
62
|
+
],
|
63
|
+
:ftp_connect_timeout => TIMEOUT
|
64
|
+
)
|
65
|
+
setup_validation
|
66
|
+
end
|
67
|
+
|
68
|
+
class UserWithInvalidPort < UserBase
|
69
|
+
def self.avatar_options
|
70
|
+
super.merge(
|
71
|
+
:ftp_servers => [
|
72
|
+
{
|
73
|
+
:host => "127.0.0.1",
|
74
|
+
:user => "user1",
|
75
|
+
:password => "secret1",
|
76
|
+
:port => 2121
|
77
|
+
},
|
78
|
+
{
|
79
|
+
:host => "127.0.0.1",
|
80
|
+
:user => "user2",
|
81
|
+
:password => "secret2",
|
82
|
+
:port => 2122 # should raise Errno::ECONNREFUSED
|
83
|
+
}
|
84
|
+
]
|
85
|
+
)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
class UserIgnoringFailingConnection < UserWithInvalidPort
|
90
|
+
has_attached_file :avatar, avatar_options.merge(
|
91
|
+
:ftp_ignore_failing_connections => true
|
92
|
+
)
|
93
|
+
setup_validation
|
94
|
+
end
|
95
|
+
|
96
|
+
class UserNotIgnoringFailingConnection < UserWithInvalidPort
|
97
|
+
has_attached_file :avatar, avatar_options.merge(
|
98
|
+
:ftp_ignore_failing_connections => false
|
99
|
+
)
|
100
|
+
setup_validation
|
38
101
|
end
|
data/test-all.sh
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Run specs against all supported ruby and paperclip versions
|
4
|
+
# using RVM (http://rvm.io/)
|
5
|
+
|
6
|
+
# Load RVM into a shell session *as a function*
|
7
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
8
|
+
# First try to load from a user install
|
9
|
+
source "$HOME/.rvm/scripts/rvm"
|
10
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
11
|
+
# Then try to load from a root install
|
12
|
+
source "/usr/local/rvm/scripts/rvm"
|
13
|
+
else
|
14
|
+
printf "ERROR: An RVM installation was not found.\n"
|
15
|
+
fi
|
16
|
+
|
17
|
+
for ruby in '1.9.3' '2.0.0' '2.1.0' 'jruby --1.9' 'rbx'
|
18
|
+
do
|
19
|
+
rvm try_install $ruby
|
20
|
+
rvm use $ruby
|
21
|
+
gem install bundler --conservative --no-rdoc --no-ri
|
22
|
+
|
23
|
+
for paperclip_version in 2 3 4
|
24
|
+
do
|
25
|
+
gemfile="gemfiles/Gemfile.paperclip-${paperclip_version}.x"
|
26
|
+
bundle install --gemfile=$gemfile
|
27
|
+
BUNDLE_GEMFILE=$gemfile bundle exec rake
|
28
|
+
done
|
29
|
+
done
|
metadata
CHANGED
@@ -1,96 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-storage-ftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.1.0
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sebastian Röbke
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
version_requirements: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - '>='
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
19
|
+
prerelease: false
|
15
20
|
name: paperclip
|
16
|
-
type: :runtime
|
17
21
|
requirement: !ruby/object:Gem::Requirement
|
18
22
|
requirements:
|
19
|
-
- -
|
23
|
+
- - '>='
|
20
24
|
- !ruby/object:Gem::Version
|
21
25
|
version: '0'
|
22
|
-
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
23
28
|
version_requirements: !ruby/object:Gem::Requirement
|
24
29
|
requirements:
|
25
|
-
- -
|
30
|
+
- - '>='
|
26
31
|
- !ruby/object:Gem::Version
|
27
32
|
version: '0'
|
28
|
-
none: false
|
29
33
|
prerelease: false
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
34
|
name: rspec
|
32
|
-
type: :development
|
33
35
|
requirement: !ruby/object:Gem::Requirement
|
34
36
|
requirements:
|
35
|
-
- -
|
37
|
+
- - '>='
|
36
38
|
- !ruby/object:Gem::Version
|
37
39
|
version: '0'
|
38
|
-
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
39
42
|
version_requirements: !ruby/object:Gem::Requirement
|
40
43
|
requirements:
|
41
|
-
- -
|
44
|
+
- - '>='
|
42
45
|
- !ruby/object:Gem::Version
|
43
46
|
version: '0'
|
44
|
-
none: false
|
45
47
|
prerelease: false
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
48
|
name: rake
|
48
|
-
type: :development
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
|
-
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
55
56
|
version_requirements: !ruby/object:Gem::Requirement
|
56
57
|
requirements:
|
57
|
-
- -
|
58
|
+
- - '>='
|
58
59
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
60
|
-
none: false
|
60
|
+
version: 1.1.0
|
61
61
|
prerelease: false
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
62
|
name: daemon_controller
|
64
|
-
type: :development
|
65
63
|
requirement: !ruby/object:Gem::Requirement
|
66
64
|
requirements:
|
67
|
-
- -
|
65
|
+
- - '>='
|
68
66
|
- !ruby/object:Gem::Version
|
69
67
|
version: 1.1.0
|
70
|
-
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
71
70
|
version_requirements: !ruby/object:Gem::Requirement
|
72
71
|
requirements:
|
73
|
-
- -
|
72
|
+
- - '>='
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
none: false
|
74
|
+
version: '0'
|
77
75
|
prerelease: false
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
76
|
name: activerecord
|
80
|
-
type: :development
|
81
77
|
requirement: !ruby/object:Gem::Requirement
|
82
78
|
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
none: false
|
87
|
-
version_requirements: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ! '>='
|
79
|
+
- - '>='
|
90
80
|
- !ruby/object:Gem::Version
|
91
81
|
version: '0'
|
92
|
-
|
93
|
-
prerelease: false
|
82
|
+
type: :development
|
94
83
|
description: Allow Paperclip attachments to be stored on FTP servers
|
95
84
|
email:
|
96
85
|
- sebastian.roebke@xing.com
|
@@ -106,6 +95,7 @@ files:
|
|
106
95
|
- Rakefile
|
107
96
|
- gemfiles/Gemfile.paperclip-2.x
|
108
97
|
- gemfiles/Gemfile.paperclip-3.x
|
98
|
+
- gemfiles/Gemfile.paperclip-4.x
|
109
99
|
- lib/paperclip/storage/ftp.rb
|
110
100
|
- lib/paperclip/storage/ftp/server.rb
|
111
101
|
- paperclip-storage-ftp.gemspec
|
@@ -116,6 +106,7 @@ files:
|
|
116
106
|
- spec/support/integration/avatar.jpg
|
117
107
|
- spec/support/integration/ftp_server.rb
|
118
108
|
- spec/support/integration/user.rb
|
109
|
+
- test-all.sh
|
119
110
|
- vendor/apache-ftpserver/LICENSE
|
120
111
|
- vendor/apache-ftpserver/LICENSE.slf4j.txt
|
121
112
|
- vendor/apache-ftpserver/LICENSE.springframework.txt
|
@@ -147,34 +138,28 @@ files:
|
|
147
138
|
- vendor/apache-ftpserver/res/ftp-db.sql
|
148
139
|
- vendor/apache-ftpserver/res/ftpserver.jks
|
149
140
|
homepage: https://github.com/xing/paperclip-storage-ftp
|
150
|
-
licenses:
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
151
144
|
post_install_message:
|
152
145
|
rdoc_options: []
|
153
146
|
require_paths:
|
154
147
|
- lib
|
155
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
149
|
requirements:
|
157
|
-
- -
|
150
|
+
- - '>='
|
158
151
|
- !ruby/object:Gem::Version
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
hash: 197284226891016539
|
162
152
|
version: '0'
|
163
|
-
none: false
|
164
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
154
|
requirements:
|
166
|
-
- -
|
155
|
+
- - '>='
|
167
156
|
- !ruby/object:Gem::Version
|
168
|
-
segments:
|
169
|
-
- 0
|
170
|
-
hash: 197284226891016539
|
171
157
|
version: '0'
|
172
|
-
none: false
|
173
158
|
requirements: []
|
174
159
|
rubyforge_project:
|
175
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.2.1
|
176
161
|
signing_key:
|
177
|
-
specification_version:
|
162
|
+
specification_version: 4
|
178
163
|
summary: Allow Paperclip attachments to be stored on FTP servers
|
179
164
|
test_files:
|
180
165
|
- spec/integration_spec.rb
|