Class: Photocopier::FTP
- Defined in:
- lib/photocopier/ftp.rb,
lib/photocopier/ftp/session.rb
Defined Under Namespace
Classes: Session
Instance Attribute Summary
Attributes inherited from Adapter
Instance Method Summary collapse
- #delete(remote_path) ⇒ Object
- #get(remote_path, file_path = nil) ⇒ Object
- #get_directory(remote_path, local_path, exclude = []) ⇒ Object
- #inferred_port ⇒ Object
-
#initialize(options = {}) ⇒ FTP
constructor
rubocop:disable Lint/MissingSuper.
-
#options ⇒ Object
rubocop:enable Lint/MissingSuper.
- #put_directory(local_path, remote_path, exclude = []) ⇒ Object
- #put_file(file_path, remote_path) ⇒ Object
Methods inherited from Adapter
Constructor Details
#initialize(options = {}) ⇒ FTP
rubocop:disable Lint/MissingSuper
4 5 6 |
# File 'lib/photocopier/ftp.rb', line 4 def initialize( = {}) @options = end |
Instance Method Details
#delete(remote_path) ⇒ Object
21 22 23 |
# File 'lib/photocopier/ftp.rb', line 21 def delete(remote_path) session.delete(remote_path) end |
#get(remote_path, file_path = nil) ⇒ Object
13 14 15 |
# File 'lib/photocopier/ftp.rb', line 13 def get(remote_path, file_path = nil) session.get remote_path, file_path end |
#get_directory(remote_path, local_path, exclude = []) ⇒ Object
25 26 27 28 |
# File 'lib/photocopier/ftp.rb', line 25 def get_directory(remote_path, local_path, exclude = []) FileUtils.mkdir_p(local_path) lftp(local_path, remote_path, false, exclude, [:port]) end |
#inferred_port ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/photocopier/ftp.rb', line 34 def inferred_port if [:port].nil? && [:scheme] == 'sftp' 22 elsif [:port].nil? 21 else [:port] end end |
#options ⇒ Object
rubocop:enable Lint/MissingSuper
9 10 11 |
# File 'lib/photocopier/ftp.rb', line 9 def @options.clone end |
#put_directory(local_path, remote_path, exclude = []) ⇒ Object
30 31 32 |
# File 'lib/photocopier/ftp.rb', line 30 def put_directory(local_path, remote_path, exclude = []) lftp(local_path, remote_path, true, exclude, [:port]) end |
#put_file(file_path, remote_path) ⇒ Object
17 18 19 |
# File 'lib/photocopier/ftp.rb', line 17 def put_file(file_path, remote_path) session.put_file file_path, remote_path end |