Skip to content

Commit

Permalink
updated Readme, some additional cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbramire authored and luan committed Nov 1, 2017
1 parent e3598cf commit f99a84c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 57 deletions.
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CarrierWave.configure do |config|
config.ftp_folder = "/public_html/uploads"
config.ftp_url = "http://example.com/uploads"
config.ftp_passive = false # false by default
config.ftp_tls = false # false by default
end
```

Expand All @@ -47,30 +48,6 @@ class AvatarUploader < CarrierWave::Uploader::Base
end
```

## Getting Started (FTPTLS)

First configure CarrierWave with your FTPTLS credentials:

```ruby
CarrierWave.configure do |config|
config.ftptls_host = "ftp.example.com"
config.ftptls_port = 21
config.ftptls_user = "example"
config.ftptls_passwd = "secret"
config.ftptls_folder = "/public_html/uploads"
config.ftptls_url = "http://example.com/uploads"
config.ftptls_passive = true # true by default
end
```

And then in your uploader, set the storage to `:ftp`:

```ruby
class AvatarUploader < CarrierWave::Uploader::Base
storage :ftptls
end
```

## Getting Started (SFTP)

First configure CarrierWave with your SFTP credentials:
Expand Down
32 changes: 0 additions & 32 deletions spec/ftp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,6 @@ class FtpUploader < CarrierWave::Uploader::Base
@stored = @storage.store!(@file)
end

it "opens/closes a secure ftp connection to the given host" do
CarrierWave.configure do |config|
config.reset_config
config.ftp_host = 'ftp.testcarrierwave.dev'
config.ftp_user = 'test_user'
config.ftp_passwd = 'test_passwd'
config.ftp_folder = '~/public_html'
config.ftp_url = 'http://testcarrierwave.dev'
config.ftp_passive = true
config.ftp_tls = true
end
@secure_storage = CarrierWave::Storage::FTP.new(FtpUploader)

ftp = double(:ftp_connection)
ftp_params = [
'ftp.testcarrierwave.dev',
'test_user',
'test_passwd',
21
]

Net::FTP.should_receive(:new).and_return(ftp)
ftp.should_receive(:connect).with('ftp.testcarrierwave.dev', 21)
ftp.should_receive(:login).with('test_user', 'test_passwd')
ftp.should_receive(:passive=).with(true)
ftp.should_receive(:mkdir_p).with('~/public_html/uploads')
ftp.should_receive(:chdir).with('~/public_html/uploads')
ftp.should_receive(:put).with(@file.path, 'test.jpg')
ftp.should_receive(:quit)
@stored = @storage.store!(@file)
end

describe 'after upload' do
before do
ftp = double(:ftp_connection)
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'bundler/setup'
require 'rspec'
require 'tempfile'
require 'pry'

require 'carrierwave'

Expand Down

0 comments on commit f99a84c

Please sign in to comment.