code/superant.com.schedule/downloadrwdschedulefiles.rb in rwdschedule-0.92 vs code/superant.com.schedule/downloadrwdschedulefiles.rb in rwdschedule-0.93

- old
+ new

@@ -1,34 +1,34 @@ -def downloadrwdschedulefiles - require 'net/ftp' - BasicSocket.do_not_reverse_lookup = true - @rwdscheduleftpdisplays = "" - begin - ftp = Net::FTP::new($rwdschedule_ftpsite) - @rwdscheduleftpdisplay = "files downloaded" + "\n" - ftp.debug_mode = false - ftp.login($rwdschedule_ftplogin, $rwdschedule_ftppassword) - ftp.chdir($rwdschedule_ftpdirectory) - print "I'm in the directory ", ftp.pwd(), "\n" - schfiles = ftp.nlst($rwdschedule_ftpdirectory) - schfiles.each do |x| - #adjust the filters to the files you want to see... - if(!test(?d,x)) - if x =~ /sch/ - lastslash = x.rindex('/')+1 - newstring = x.slice!(lastslash..256) - localupdatefile = File.join($rwdschedule_updatedirectory, "#{newstring}") - ftp.getbinaryfile("#{newstring}" , localupdatefile ) - @rwdscheduleftpdisplay = @rwdscheduleftpdisplay + newstring + "\n" - end - end - - end - ftp.close - -rescue - -if ftp - ftp.close - end -end -end +def downloadrwdschedulefiles + require 'net/ftp' + BasicSocket.do_not_reverse_lookup = true + @rwdscheduleftpdisplays = "" + begin + ftp = Net::FTP::new($rwdschedule_ftpsite) + @rwdscheduleftpdisplay = "files downloaded" + "\n" + ftp.debug_mode = false + ftp.login($rwdschedule_ftplogin, $rwdschedule_ftppassword) + ftp.chdir($rwdschedule_ftpdirectory) + print "I'm in the directory ", ftp.pwd(), "\n" + schfiles = ftp.nlst($rwdschedule_ftpdirectory) + schfiles.each do |x| + #adjust the filters to the files you want to see... + if(!test(?d,x)) + if x =~ /sch/ + lastslash = x.rindex('/')+1 + newstring = x.slice!(lastslash..256) + localupdatefile = File.join($rwdschedule_updatedirectory, "#{newstring}") + ftp.getbinaryfile("#{newstring}" , localupdatefile ) + @rwdscheduleftpdisplay = @rwdscheduleftpdisplay + newstring + "\n" + end + end + + end + ftp.close + +rescue + +if ftp + ftp.close + end +end +end