class RestFtpDaemon::Remote::RemoteBase

Attributes

job[RW]
log_prefix[R]

Class options

Public Class Methods

new(target, context, debug = false, ftpes = false) click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 16
def initialize target, context, debug = false, ftpes = false
  # Init
  @target = target
  @ftpes = ftpes
  @debug = !!debug

  # Build and empty job to protect set_info delegation
  @job = Job.new(nil, {})

  # Logger
  @context = context || {}
  log_pipe :transfer

  # Annnounce object
  log_info "initialize debug[#{debug}] target[#{target.path}] "

  # Prepare real object
  prepare
end

Public Instance Methods

chdir_or_create(directory, mkdir = false) click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 55
def chdir_or_create directory, mkdir = false
end
close() click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 61
def close
  log_debug "close"

  # Debug mode ?
  return unless @debug
  puts "-------------------- SESSION CLOSING --------------------------"
end
connect() click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 43
def connect
  # Debug mode ?
  return unless @debug
  puts
  puts "-------------------- SESSION STARTING -------------------------"
  puts "class\t #{myname}"
  puts "host\t #{@target.host}"
  puts "user\t #{@target.user}"
  puts "port\t #{@target.port}"
  puts "---------------------------------------------------------------"
end
prepare() click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 40
def prepare
end
remove!(target) click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 58
def remove! target
end
size_if_exists(target) click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 36
def size_if_exists target
  false
end

Protected Instance Methods

log_context() click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 71
def log_context
  @context
end

Private Instance Methods

myname() click to toggle source

def extract_parent path

return unless path.is_a? String
m = path.match(/^(.*)\/([^\/]+)\/?$/)
return m[1], m[2] unless m.nil?

end

# File lib/rest-ftp-daemon/remote/base.rb, line 88
def myname
  self.class.to_s
end
split_path(path) click to toggle source
# File lib/rest-ftp-daemon/remote/base.rb, line 77
def split_path path
  return unless path.is_a? String
  return File.dirname(path), File.basename(path)
end