class Rake::FtpFile
Note: Not released for general use.
###################################################################
def self.date
def self.date @date_class ||= Date end
def self.time
def self.time @time_class ||= Time end
def determine_time(d1, d2, d3)
def determine_time(d1, d2, d3) now = self.class.time.now if /:/ =~ d3 result = Time.parse("#{d1} #{d2} #{now.year} #{d3}") if result > now result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}") end else result = Time.parse("#{d1} #{d2} #{d3}") end result elements = ParseDate.parsedate("#{d1} #{d2} #{d3}") if elements[0].nil? today = self.class.date.today if elements[1] > today.month elements[0] = today.year - 1 else elements[0] = today.year end end elements = elements.collect { |el| el.nil? ? 0 : el } Time.mktime(*elements[0,7]) end
def directory?
def directory? @mode[0] == ?d end
def initialize(path, entry)
def initialize(path, entry) @path = path @mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ') @size = size.to_i @time = determine_time(d1, d2, d3) end
def mode
def mode parse_mode(@mode) end
def parse_mode(m)
def parse_mode(m) result = 0 (1..9).each do |i| result = 2*result + ((m[i]==?-) ? 0 : 1) end result end
def path
def path File.join(@path, @name) end
def symlink?
def symlink? @mode[0] == ?l end