Now it works as a cronjob, yay

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2391 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-11-18 15:11:20 +00:00
parent c1153c86dd
commit c999dd7751

View File

@ -3,28 +3,30 @@
require '/home/tom/data/pmd/pmd-web/src/pmd.rb' require '/home/tom/data/pmd/pmd-web/src/pmd.rb'
Dir.chdir(PMD::Job::ROOT) Dir.chdir(PMD::Job::ROOT)
ENV['JAVA_HOME']="/usr/local/java"
ENV['PATH']="#{ENV['PATH']}:#{ENV['JAVA_HOME']}/bin"
Dir.new("jobs").each { |candidate| Dir.new("jobs").each { |candidate|
begin begin
if candidate[".txt"] if candidate[".txt"]
location,title,unixname,moduleDir,srcDir = File.new("jobs/#{candidate}").read.split(":") location,title,unixname,moduleDir,srcDir = File.new("jobs/#{candidate}").read.split(":")
if ARGV.length != 0 && ARGV[0] != moduleDir if ARGV.length != 0 && ARGV[0] != moduleDir
next next
end end
job = PMD::Job.new(location,title,unixname,moduleDir,srcDir) job = PMD::Job.new(location,title,unixname,moduleDir,srcDir)
puts "Processing #{job}" puts "Processing #{job}"
job.clear job.clear
job.checkout_code job.checkout_code
if job.checkOutOK if job.checkOutOK
job.run_pmd job.run_pmd
job.run_cpd job.run_cpd
job.ncss job.ncss
`echo #{Time.now} > lastruntime.txt` `echo #{Time.now} > lastruntime.txt`
job.copy_up job.copy_up
job.clear job.clear
end end
end end
rescue rescue
puts "Exiting with error: #{$!}" puts "Exiting with error: #{$!}"
end end
} }