diff --git a/pmd-web/src/pmd.rb b/pmd-web/src/pmd.rb index 906d35ae92..c43868d681 100644 --- a/pmd-web/src/pmd.rb +++ b/pmd-web/src/pmd.rb @@ -52,6 +52,14 @@ class Job @sourceDirectory = moduleDirectory + '/' + sourceDirectory end + def checkout_code + `cvs -d:#{cvsroot} co #{moduleDirectory}` + end + + def run_pmd + `java -jar pmd-1.0rc2.jar #{sourceDirectory} html rulesets/unusedcode.xml > reports/#{projectName}.html` + end + def to_s return @projectName +":"+@moduleDirectory+":"+@sourceDirectory end diff --git a/pmd-web/src/processor.rb b/pmd-web/src/processor.rb index 9df43dc7df..efdcfd5394 100644 --- a/pmd-web/src/processor.rb +++ b/pmd-web/src/processor.rb @@ -3,13 +3,15 @@ require 'c:\data\pmd\pmd-web\src\pmd.rb' jobsDir = Dir.new("jobs") jobsDir.each { |candidate| - if candidate[".txt"] - jobFile=File.new("jobs/#{candidate}") - jobData = jobFile.read - jobFile.close - name,moduleDir,srcDir=jobData.split(":") - job = PMD::Job.new(name, moduleDir, srcDir) - puts job + begin + if candidate[".txt"] + name,moduleDir,srcDir = File.new("jobs/#{candidate}").read.split(":") + job = PMD::Job.new(name,moduleDir,srcDir) + job.checkout_code + job.run_pmd + end + rescue + puts "Exiting with error: #{$!}" end }