R
Rebhan, Gilbert
Hi,
i have a ruby script that does for 1 - n folders a
cp_r of every folder to an existing cvs workspace
and afterwards the cvs operations=20
update to determine if add is needed
add if needed 1-n times
commit
As the cvs CLI lacks a recursive parameter for
the update / add commands, means when a new file
like subfolder/subfile.txt comes in=20
the add command only recognizes subfolder, but the=20
subfile.txt only after a 2nd add command
i have to do =3D
1. updpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} update")
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
to determine whether there are new files to be added
if updfiles !=3D 0 i have to execute the cvs add command =3D
2.addpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} add #{updfiles.to_s}")
addpipe.readlines.each { |x|=20
addfiles<<'.'<<'/'<<x[2..-2]<<' ' }
this add command gives me other folders or files that are also to be
added, if there are more to be added, i.e subfolders/subfiles ...
so i have to do the cvs add in a loop until nothing more comes
back from that cvs add command.=20
then i have to do a final commit =3D
3.system("#{CVSEXE}","-d","#{CVSROOT}","commit","-m","bla bla bla bla")
Now i'm looking for the best loop construct, i know
the addfiles array has to be cleared after every cvs add before
executing cvs add again
There is something like retry/redo i tried with retry after and before
the end of a while loop=20
updfiles=3DArray.new
updpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} update")
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
while updfiles.length > 0
addfiles=3DArray.new
addpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} add #{updfiles.to_s}")
addpipe.readlines.each { |x|=20
addfiles<<'.'<<'/'<<x[2..-2]<<' ' }=09
updfiles.clear
addfiles.clear
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
end
*retry*
but got :
retry outside of rescue clause (LocalJumpError)
What's the right loop ?
Is there a solution without retry / redo ?
Regards, Gilbert
i have a ruby script that does for 1 - n folders a
cp_r of every folder to an existing cvs workspace
and afterwards the cvs operations=20
update to determine if add is needed
add if needed 1-n times
commit
As the cvs CLI lacks a recursive parameter for
the update / add commands, means when a new file
like subfolder/subfile.txt comes in=20
the add command only recognizes subfolder, but the=20
subfile.txt only after a 2nd add command
i have to do =3D
1. updpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} update")
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
to determine whether there are new files to be added
if updfiles !=3D 0 i have to execute the cvs add command =3D
2.addpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} add #{updfiles.to_s}")
addpipe.readlines.each { |x|=20
addfiles<<'.'<<'/'<<x[2..-2]<<' ' }
this add command gives me other folders or files that are also to be
added, if there are more to be added, i.e subfolders/subfiles ...
so i have to do the cvs add in a loop until nothing more comes
back from that cvs add command.=20
then i have to do a final commit =3D
3.system("#{CVSEXE}","-d","#{CVSROOT}","commit","-m","bla bla bla bla")
Now i'm looking for the best loop construct, i know
the addfiles array has to be cleared after every cvs add before
executing cvs add again
There is something like retry/redo i tried with retry after and before
the end of a while loop=20
updfiles=3DArray.new
updpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} update")
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
while updfiles.length > 0
addfiles=3DArray.new
addpipe=3DIO.popen("#{CVSEXE} -d #{CVSROOT} add #{updfiles.to_s}")
addpipe.readlines.each { |x|=20
addfiles<<'.'<<'/'<<x[2..-2]<<' ' }=09
updfiles.clear
addfiles.clear
updpipe.readlines.each { |x|=20
updfiles<<'.'<<'/'<<x[2..-2]<<' ' }
end
*retry*
but got :
retry outside of rescue clause (LocalJumpError)
What's the right loop ?
Is there a solution without retry / redo ?
Regards, Gilbert