[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dennou-ruby:000011] Re: [Tips] install,version
���Ȥ���Ǥ�
In message "[dennou-ruby:000010] Re: [Tips] install,version"
on 99/08/09, Masato Shiotani <shiotani@xxxxxx> writes:
>���Υ�����ץȤǤ���, �ʲ��Τ褦�ʥ�å��������Ǥ���ư��ޤ���.
���Ҥ㤡�������ʤ�����1�������ؤ�äƤޤ�����û���������
ľ���ޤ���
���ʤߤˤ�äƤ뤳�Ȥϡ�devel �ˤ��� man �Ǥʤ���ΤΤ�����
�ֿ�������Τ�ɽ������Ȥ��������Ǥ���
>��������
>
>ruby 1.3.4-990625 [sparc-solaris2.6]
>
>�Ǥ�����, ������Ȥޤ����Ȥ�?
�������ˤ���ʤ��ȤϤʤ��Ǥ���
-- gotoken
#! /usr/local/bin/ruby
#
# latest-ruby.rb obtains the latest version of ruby
#
require "ftplib"
ftp = FTP.new("ftp.netlab.co.jp", "anonymous")
files = {}
now = Time.now
ftp.list("/pub/lang/ruby/devel").each do |line|
elm = line.split
mode, link, owner, group, size, month, date, tory, file = elm
next if file =~ /(^\.\.?$)|man/ || elm.size != 9
year, hour, min = if tory =~ /:/
[now.year, tory.split(":")[0], tory.split(":")[1]]
else
[tory, 0, 0]
end
files[file] = Time.gm(year, month, date, hour, min)
end
puts files.to_a.sort{|j,i|
i[1] <=> j[1]}.collect{|i| i[1].to_s + " " + i[0]}.shift