Class: Frank::Publish::SFTP
Instance Attribute Summary
Attributes inherited from Base
#hostname, #local_path, #password, #port, #remote_path, #username
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(options, &block) ⇒ SFTP
constructor
A new instance of SFTP.
- #transfer! ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options, &block) ⇒ SFTP
Returns a new instance of SFTP.
10 11 12 13 14 15 |
# File 'lib/frank/publish/sftp.rb', line 10 def initialize(, &block) super() instance_eval(&block) if block_given? @port ||= 22 end |
Instance Method Details
#connection ⇒ Object
18 19 20 21 22 |
# File 'lib/frank/publish/sftp.rb', line 18 def connection Net::SFTP.start(hostname, username, :password => password) do |scp| yield scp end end |
#transfer! ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/frank/publish/sftp.rb', line 24 def transfer! connection do |scp| old_name = '' scp.upload! local_path, remote_path do |ch, name| if old_name != name "Uploading #{name}", " - " end end end end |