From b786e2f0a5e4aaeae3906bc97aeed9f6f2f0f005 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Wed, 25 Sep 2002 18:31:55 +0000 Subject: [PATCH] processor works now git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@986 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-web/src/copytolocal.bat | 3 +++ pmd-web/src/pmd.rb | 17 ++++++++++------- pmd-web/src/processor.rb | 8 +++++--- pmd-web/src/webpmd.pl | 19 ++++++++++--------- 4 files changed, 28 insertions(+), 19 deletions(-) create mode 100755 pmd-web/src/copytolocal.bat diff --git a/pmd-web/src/copytolocal.bat b/pmd-web/src/copytolocal.bat new file mode 100755 index 0000000000..b62d7af8da --- /dev/null +++ b/pmd-web/src/copytolocal.bat @@ -0,0 +1,3 @@ +pscp tomcopeland@pmd.sourceforge.net:/home/groups/p/pm/pmd/cgi-bin/webpmd.pl . +pscp tomcopeland@pmd.sourceforge.net:/home/groups/p/pm/pmd/cgi-bin/pmd.rb . +pscp tomcopeland@pmd.sourceforge.net:/home/groups/p/pm/pmd/cgi-bin/processor.rb . \ No newline at end of file diff --git a/pmd-web/src/pmd.rb b/pmd-web/src/pmd.rb index b225623f3e..5e3efadd5b 100644 --- a/pmd-web/src/pmd.rb +++ b/pmd-web/src/pmd.rb @@ -45,27 +45,30 @@ end class Job - def initialize( projectName, moduleDirectory, sourceDirectory ) - @projectName = projectName - @cvsroot = ':pserver:anonymous@cvs.' + projectName + '.sourceforge.net:/cvsroot/' + projectName + def initialize(title, unixName, moduleDirectory, sourceDirectory ) + @title = title + @unixName = unixName + @cvsroot = ':pserver:anonymous@cvs.' + unixName + '.sourceforge.net:/cvsroot/' + unixName @moduleDirectory = moduleDirectory @sourceDirectory = sourceDirectory end def checkout_code - `cvs -d:#{cvsroot} co #{moduleDirectory}` + `cvs -d#{@cvsroot} co #{@moduleDirectory}` end def run_pmd - `java -jar pmd-1.0rc2.jar #{sourceDirectory} html rulesets/unusedcode.xml > ../htdocs/reports/#{moduleDirectory}.html` + cmd="java -jar pmd-1.0rc2.jar #{@sourceDirectory} html rulesets/unusedcode.xml > ../htdocs/reports/#{@unixName}.html" + puts cmd + `#{cmd}` end def clear - `rm -rf #{moduleDirectory}` + `rm -rf #{@moduleDirectory}` end def to_s - return @projectName +":"+@moduleDirectory+":"+@sourceDirectory + return @unixName +":"+@moduleDirectory+":"+@sourceDirectory end end diff --git a/pmd-web/src/processor.rb b/pmd-web/src/processor.rb index efdcfd5394..853e3a69f5 100644 --- a/pmd-web/src/processor.rb +++ b/pmd-web/src/processor.rb @@ -1,14 +1,16 @@ +#!/usr/bin/ruby -require 'c:\data\pmd\pmd-web\src\pmd.rb' +require 'pmd.rb' jobsDir = Dir.new("jobs") jobsDir.each { |candidate| begin if candidate[".txt"] - name,moduleDir,srcDir = File.new("jobs/#{candidate}").read.split(":") - job = PMD::Job.new(name,moduleDir,srcDir) + title,unixname,moduleDir,srcDir = File.new("jobs/#{candidate}").read.split(":") + job = PMD::Job.new(title,unixname,moduleDir,srcDir) job.checkout_code job.run_pmd + job.clear end rescue puts "Exiting with error: #{$!}" diff --git a/pmd-web/src/webpmd.pl b/pmd-web/src/webpmd.pl index c199e45b0d..eaa901b410 100644 --- a/pmd-web/src/webpmd.pl +++ b/pmd-web/src/webpmd.pl @@ -13,8 +13,8 @@ sub nopage() { sub default() { print start_html("Run PMD on your Sourceforge project"); - if (param("projectname")) { - addProject(param("projectname"), param("moduledirectory"), param("srcdir")); + if (param("unixname")) { + addProject(param("unixname"), param("moduledirectory"), param("srcdir")); print p(); print b("Added that project to the schedule"); } @@ -23,9 +23,10 @@ sub default() { #print p("Stats:"); print p("Want to run PMD on your Sourceforge project? Fill in the blanks and hit go"); print start_form(); - print p(), "Project name (i.e., PMD): ", textfield(-name=>'projectname',-default=>'',-override=>1); - print p(), "Module directory (i.e., pmd): ", textfield(-name=>'moduledirectory',-default=>'',-override=>1); - print p(), "Source directory (i.e., pmd/src): ", textfield(-name=>'srcdir',-default=>'',-override=>1); + print p(), "Project title (i.e., PMD): ", textfield(-name=>'unixname',-default=>'',-override=>1); + print p(), "Project name (i.e., pmd): ", textfield(-name=>'unixname',-default=>'',-override=>1); + print p(), "Module directory (i.e., pmd-dcpd): ", textfield(-name=>'moduledirectory',-default=>'',-override=>1); + print p(), "Source directory (i.e., pmd-dcpd/src): ", textfield(-name=>'srcdir',-default=>'',-override=>1); my $cachebuster=`date`; print $query->hidden(-name=>'cachebuster', -value=>${cachebuster}); print p(), submit(-value=>'Go'); @@ -39,12 +40,12 @@ sub loadProjectList() { if ($file =~ /txt/) { open(FILE,"jobs/${file}"); my $jobdata=; - my ($name, $mod, $src) = split(":", $jobdata); + my ($title,$unixname, $mod, $src) = split(":", $jobdata); my $jobtext=""; - if (-e "../htdocs/reports/${mod}.html") { - $jobtext="${name}"; + if (-e "../htdocs/reports/${unixname}.html") { + $jobtext="${title}"; } else { - $jobtext=$name; + $jobtext=$title; } $result="${result}${jobtext}"; }