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

- old
+ new

@@ -1,30 +1,30 @@ -def syncrwdscheduledata - require 'fileutils' - @rwdschedulesyncresult = "" - begin - -@rwdschedulesyncresult = "updating local files" + "\n" - Dir.chdir($progdir) - - localfileListarray = Dir.new($rwdschedule_directory).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /sch$/) } - remotefileListarray = Dir.new($rwdschedule_updatedirectory ).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /sch$/) } - - tempupdatefilelistarray = remotefileListarray - localfileListarray - - if tempupdatefilelistarray - tempupdatefilelistarray.each do |temp| - tmpfilenametosync = File.join($rwdschedule_updatedirectory,temp) - tmpfilenamecopied = File.join($rwdschedule_directory,temp) - FileUtils.cp( tmpfilenametosync, tmpfilenamecopied) - @rwdschedulesyncresult = @rwdschedulesyncresult + temp + "\n" - - end - end - - -rescue - - -print "sync error" -end -end +def syncrwdscheduledata + require 'fileutils' + @rwdschedulesyncresult = "" + begin + +@rwdschedulesyncresult = "updating local files" + "\n" + Dir.chdir($progdir) + + localfileListarray = Dir.new($rwdschedule_directory).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /sch$/) } + remotefileListarray = Dir.new($rwdschedule_updatedirectory ).entries.sort.delete_if { |tmpfile| ! (tmpfile =~ /sch$/) } + + tempupdatefilelistarray = remotefileListarray - localfileListarray + + if tempupdatefilelistarray + tempupdatefilelistarray.each do |temp| + tmpfilenametosync = File.join($rwdschedule_updatedirectory,temp) + tmpfilenamecopied = File.join($rwdschedule_directory,temp) + FileUtils.cp( tmpfilenametosync, tmpfilenamecopied) + @rwdschedulesyncresult = @rwdschedulesyncresult + temp + "\n" + + end + end + + +rescue + + +print "sync error" +end +end