ruby 小脚本搞定CVS服务器更换后checkout下来的工程迁移
作者:
CVS换了新的服务器,原来的工程需要更改Server配置,这个东东手工做起来 可是个体力活,写了一个脚本分发下来。
def changeCVS(path)
Dir.foreach(path) do |dir|
if dir != "." && dir != ".."
absdir = path + "/" + dir
if (File.directory? absdir) && (dir == "CVS")
cvs_root_file_name = absdir + "/Root"
p cvs_root_file_name
File.open(cvs_root_file_name,"w") do |file|
file.write(":connection_type:user@ip:repository")
end
elsif File.directory? absdir
changeCVS(absdir)
end
end
end
end
changeCVS("C:/workspace")
Dir.foreach(path) do |dir|
if dir != "." && dir != ".."
absdir = path + "/" + dir
if (File.directory? absdir) && (dir == "CVS")
cvs_root_file_name = absdir + "/Root"
p cvs_root_file_name
File.open(cvs_root_file_name,"w") do |file|
file.write(":connection_type:user@ip:repository")
end
elsif File.directory? absdir
changeCVS(absdir)
end
end
end
end
changeCVS("C:/workspace")