Class: Pione::Location::MyFTPScheme

Inherits:
Pione::LocationScheme show all
Defined in:
lib/pione/location/myftp-scheme.rb

Overview

MyFTPScheme is a special scheme for launching PIONE embedded ftp server.

Examples:

URI.parse("myftp:./output")
URI.parse("myftp://abc:[email protected]:45321/home/keita/pione/output")

Constant Summary collapse

PORT =
39123
COMPONENT =
[:scheme, :user, :password, :host, :port, :path]

Instance Method Summary collapse

Instance Method Details

#normalizeURI

Normalize the URI.

Returns:

  • (URI)

    normalized URI



18
19
20
21
22
23
24
25
26
27
# File 'lib/pione/location/myftp-scheme.rb', line 18

def normalize
  hash = {
    :scheme => "myftp",
    :userinfo => userinfo || Util::FTPServer.auth_info.to_userinfo,
    :host => (host == "myself" or host.nil?) ? Util::IPAddress.myself : host,
    :port => port || PORT,
    :path => File.expand_path(path, Global.pwd) + (directory? ? "/" : "")
  }
  MyFTPScheme.build(hash)
end

#to_ftp_schemeURI

Return ftp scheme that refers the ftp server.

Returns:

  • (URI)

    ftp scheme URI



33
34
35
36
37
38
39
40
41
42
# File 'lib/pione/location/myftp-scheme.rb', line 33

def to_ftp_scheme
  hash = {
    :scheme => "ftp",
    :userinfo => userinfo || Util::FTPServer.auth_info.to_userinfo,
    :host => (host == "myself" or host.nil?) ? Util::IPAddress.myself : host,
    :port => port || PORT,
    :path => "/"
  }
  URI::FTP.build(hash)
end