[#9950] [PATCH] merge 1.5 change into 1.4.4 — Katsuyuki Komatsu <komatsu@...>
小松です。
10 messages
2000/06/01
[#9954] Re: [PATCH] merge 1.5 change into 1.4.4
— matz@... (Yukihiro Matsumoto)
2000/06/02
まつもと ゆきひろです
[#9955] Re: [PATCH] merge 1.5 change into 1.4.4
— nagai@...
2000/06/02
永井@知能.九工大です.
[#9980] Array#index(val) vs. Array#value(idx) — Hideto ISHIBASHI <hideto-i@...4u.or.jp>
石橋"rubyholic"秀仁です。
4 messages
2000/06/07
[#9986] % in C — gotoken@... (GOTO Kentaro)
ごとけんです
6 messages
2000/06/08
[#9990] Generational GC — Masato KIYAMA <masato@...>
まさとです.
6 messages
2000/06/09
[#10006] Re: File Utilities — WATANABE Hirofumi <eban@...>
わたなべです.
7 messages
2000/06/10
[#10007] Re: [ruby-talk:03267] Re: mod_ruby error? — Wakou Aoyama <wakou@...>
青山です。
31 messages
2000/06/11
[#10008] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/11
青山です。
[#10018] Re: [ruby-talk:03267] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/13
前田です。
[#10027] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/13
青山です。
[#10028] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/13
青山です。
[#10029] Re: [ruby-talk:03267] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/13
前田です。
[#10035] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/13
青山です。
[#10038] Re: [ruby-talk:03267] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/14
前田です。
[#10041] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/14
青山です。
[#10045] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/14
青山です。
[#10046] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/14
青山です。
[#10047] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/14
青山です。
[#10048] Re: [ruby-talk:03267] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/14
青山です。
[#10049] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/14
前田です。
[#10053] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/15
青山です。
[#10062] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/16
前田@出張中です。
[#10063] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/16
青山です。
[#10106] Re: mod_ruby error?
— Shugo Maeda <shugo@...>
2000/06/22
前田です。
[#10144] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/27
青山です。
[#10147] Re: mod_ruby error?
— matz@... (Yukihiro Matsumoto)
2000/06/27
まつもと ゆきひろです
[#10152] Re: mod_ruby error?
— Wakou Aoyama <wakou@...>
2000/06/29
青山です。
[#10019] NT build problem — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
9 messages
2000/06/13
[#10032] compile error on cygwin — "Nobuyoshi.Nakada" <nobu.nakada@...>
なかだです。
4 messages
2000/06/13
[#10050] sleep on Solaris — とみたまさひろ <tommy@...>
とみたです。
5 messages
2000/06/15
[#10069] File::Stat#inspect — Koji Arai <JCA02266@...>
新井です。
7 messages
2000/06/16
[#10081] [PATCH] module === string.extend(module).dup — nobu.nakada@...
なかだです。
9 messages
2000/06/18
[#10083] Re: [PATCH] module === string.extend(module).dup
— matz@... (Yukihiro Matsumoto)
2000/06/18
まつもと ゆきひろです
[#10085] Re: [PATCH] module === string.extend(module).dup
— nobu.nakada@...
2000/06/18
なかだです。
[#10096] Re: [PATCH] module === string.extend(module).dup
— matz@... (Yukihiro Matsumoto)
2000/06/20
まつもと ゆきひろです
[#10097] Re: [PATCH] module === string.extend(module).dup
— nobu.nakada@...
2000/06/20
なかだです。
[#10109] bit fix for net/protocol.rb — Toshiro Kuwabara <toshirok@...3.so-net.ne.jp>
Toshです。
10 messages
2000/06/22
[#10110] Re: bit fix for net/protocol.rb
— "Kikutani, Makoto" <kikutani@...>
2000/06/22
日時 Fri, 23 Jun 2000 02:16:31 +0900 の
[#10125] configure.in — Tadayoshi Funaba <tadf@...>
ふなばです。
14 messages
2000/06/26
[#10126] Re: configure.in
— WATANABE Hirofumi <eban@...>
2000/06/27
わたなべです.
[#10129] Re: configure.in
— Katsuyuki Komatsu <komatsu@...>
2000/06/27
小松です。
[#10135] don't use mktemp() — Shugo Maeda <shugo@...>
前田です。
35 messages
2000/06/27
[#10136] Re: don't use mktemp()
— matz@... (Yukihiro Matsumoto)
2000/06/27
まつもと ゆきひろです
[#10137] Re: don't use mktemp()
— Shugo Maeda <shugo@...>
2000/06/27
前田です。
[#10141] Re: don't use mktemp()
— kjana@... (YANAGAWA Kazuhisa)
2000/06/27
In message <874s6f1rqj.wl@studly.netlab.co.jp>
[#10143] Re: don't use mktemp()
— WATANABE Hirofumi <eban@...>
2000/06/27
わたなべです.
[#10181] Re: don't use mktemp()
— Katsuyuki Komatsu <komatsu@...>
2000/07/03
小松です。
[#10183] Re: don't use mktemp()
— WATANABE Hirofumi <eban@...>
2000/07/03
わたなべです.
[#10188] Re: don't use mktemp()
— KIMURA Koichi <kimura@...>
2000/07/04
[#10189] Re: don't use mktemp()
— "Nobuyoshi.Nakada" <nobu.nakada@...>
2000/07/04
なかだです。
[#10190] Re: don't use mktemp()
— matz@... (Yukihiro Matsumoto)
2000/07/04
まつもと ゆきひろです
[#10145] Re: [ruby-list:23495] Re: Ruby 1.4.5 — Wakou Aoyama <wakou@...>
青山です。
4 messages
2000/06/27
[ruby-dev:10122] [Patch] ftpup -> ftpsync
From:
"NAKAMURA, Hiroshi" <nakahiro@...>
Date:
2000-06-24 15:16:37 UTC
List:
ruby-dev #10122
なひです.
ちょっとした必要があって,ftpupの一部機能を変更して,
localとremoteのsyncをするようなモノを作ってみました.
ftpupの機能を向上したり,不具合を修正するものではないので,
取り込む必要はありません(つか,できません ^^;).
判断基準は以下のとおりです.
1. localとremoteのどちらかにファイル/ディレクトリがなければ,
反対側のファイルを取ってきて作成する.
2. localとremoteの両方にファイルがあり,サイズが同じ場合は,
タイムスタンプが異なっていても放置(何もしない).
3. 上記サイズが異なる場合,タイムスタンプが新しいほうで,
古いほうを上書きする(古いほうは消えますのでご注意).
今日作ったばかりで,なひもまだろくに運用してないので,
ご利用の際は充分注意してください.local/remote両サイドのバックアップが
必須です.なひは今後あちこちに使う予定なので,
不具合にぶちあたったらまたpatchを出すでしょう.^^;
ftpup-1.3.3へのpatchです.
--- ftpup Tue May 16 17:04:38 2000
+++ ftpsync Sun Jun 25 00:00:25 2000
@@ -103,4 +103,5 @@ EOF
update(".")
else
+ raise ArgumentError.new("Argument not allowed.")
path.each do |p|
update(p)
@@ -136,42 +137,63 @@ EOF
def updatedir(directory)
print directory.sub(/^./, Config::REMOTE_DIR), ":\n"
+ local_dirs = []
+ local_filetimes = {}
+ local_filesizes = {}
+ check_local_files(directory, local_dirs, local_filetimes, local_filesizes)
remote_dirs = [];
remote_filetimes = {}
remote_filesizes = {}
check_remote_files(directory, remote_dirs, remote_filetimes, remote_filesizes)
- Dir.foreach(directory) do |file|
- longname = directory + "/" + file
- if file != "." && file != ".."
- if File.ftype(longname) == "directory"
- if longname =~ @ignore_file_regexp
- next
- end
- unless remote_dirs.include?(file)
- makedir(longname)
- end
- updatedir(longname) unless @not_recursive
- else
- if not longname =~ @ignore_file_regexp and
- ((not remote_filesizes.has_key?(file) or
- remote_filesizes[file] != File.size(longname)) or
- (not remote_filetimes.has_key?(file) or
- remote_filetimes[file] < File.mtime(longname).gmtime))
- updatefile(longname)
- end
- remote_filetimes.delete(file)
+ (local_filetimes.keys + remote_filetimes.keys).uniq.each do |file|
+ longname = getlongname(directory, file)
+ if longname =~ @ignore_file_regexp
+ # Nothing to do.
+ elsif not local_filesizes.has_key?(file)
+ getfile(longname)
+ elsif not remote_filesizes.has_key?(file)
+ putfile(longname)
+ elsif local_filesizes[file] != remote_filesizes[file]
+ if local_filetimes[file] < remote_filetimes[file]
+ getfile(longname)
+ elsif local_filetimes[file] > remote_filetimes[file]
+ putfile(longname)
end
end
end
- if @remove_files
- remote_filetimes.each_key do |file|
- longname = directory + "/" + file
- unless @leave_file_regexp and longname =~ @leave_file_regexp
- print "delete ", File.basename(longname), "\n"
- @ftp.delete(longname)
+ (local_dirs + remote_dirs).uniq.each do |dir|
+ longname = getlongname(directory, dir)
+ if longname =~ @ignore_file_regexp
+ next
+ end
+ if local_dirs.include?(dir)
+ unless remote_dirs.include?(dir)
+ makedir(longname)
end
+ elsif remote_dirs.include?(dir)
+ Dir.mkdir(longname)
end
+ updatedir(longname) unless @not_recursive
end
end
+ def check_local_files(directory, dirs, filetimes, filesizes)
+ targetDir = Dir.open(directory)
+ targetDir.each do |file|
+ longname = getlongname(directory, file)
+ case File.ftype(longname)
+ when "directory"
+ if file != "." && file != ".."
+ dirs.push(file)
+ end
+ when "file"
+ filetimes[file] = File.mtime(longname).gmtime
+ filesizes[file] = File.size(longname)
+ else
+ print "#{File.ftype(longname)}(#{longname}) found. Skepped.\n"
+ end
+ end
+ targetDir.close
+ end
+
def check_remote_files(directory, dirs, filetimes, filesizes)
if @list_opts and @list_opts.length > 0
@@ -226,5 +248,22 @@ EOF
end
+ def getfile(file)
+ print "get ", file, ": "
+ @ftp.getbinaryfile(file, file, 4096) do |data|
+ print "."; $>.flush
+ end
+ print "\n"
+ end
+
+ def putfile(file)
+ print "put ", file, ": "
+ @ftp.putbinaryfile(file, file, 4096) do |data|
+ print "."; $>.flush
+ end
+ print "\n"
+ end
+
def updatefile(file)
+ raise RuntimeError.new("updatefile is obsolete.")
print "put ", file, ": "
if file =~ @textfile_regexp
@@ -242,4 +281,8 @@ EOF
end
print "\n"
+ end
+
+ def getlongname(directory, file)
+ directory + "/" + file
end