From 0291d6c0f152b7ad8eabb6dc7618cfbac1c8cfdf Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Tue, 24 Sep 2002 20:16:11 +0000 Subject: [PATCH] added cvs checkout and pmd run git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@983 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-web/src/pmd.rb | 8 ++++++++ pmd-web/src/processor.rb | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) 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 }