Class: FtpDeploy::Ftp

Inherits:
Object
  • Object
show all
Defined in:
lib/scms/deploy-ftp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port = 21, options = Hash.new) ⇒ Ftp

Returns a new instance of Ftp.



63
64
65
66
67
68
# File 'lib/scms/deploy-ftp.rb', line 63

def initialize(host, port = 21, options = Hash.new)
  options = {:username => nil, :password => nil}.merge(options)
  @host, @port = host, port
  @username, @password = options[:username], options[:password]
  @passive = options[:passive]
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



61
62
63
# File 'lib/scms/deploy-ftp.rb', line 61

def host
  @host
end

#passiveObject (readonly)

Returns the value of attribute passive.



61
62
63
# File 'lib/scms/deploy-ftp.rb', line 61

def passive
  @passive
end

#passwordObject (readonly)

Returns the value of attribute password.



61
62
63
# File 'lib/scms/deploy-ftp.rb', line 61

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



61
62
63
# File 'lib/scms/deploy-ftp.rb', line 61

def port
  @port
end

#usernameObject (readonly)

Returns the value of attribute username.



61
62
63
# File 'lib/scms/deploy-ftp.rb', line 61

def username
  @username
end

Instance Method Details

#sync(local, distant) ⇒ Object



70
71
72
73
74
# File 'lib/scms/deploy-ftp.rb', line 70

def sync(local, distant)
  connect do |ftp|
    send_dir(ftp, local, distant)
  end
end