processor works now

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@986 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-09-25 18:31:55 +00:00
parent cfeb90c3ce
commit b786e2f0a5
4 changed files with 28 additions and 19 deletions

3
pmd-web/src/copytolocal.bat Executable file
View File

@ -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 .

View File

@ -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

View File

@ -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: #{$!}"

View File

@ -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=<FILE>;
my ($name, $mod, $src) = split(":", $jobdata);
my ($title,$unixname, $mod, $src) = split(":", $jobdata);
my $jobtext="";
if (-e "../htdocs/reports/${mod}.html") {
$jobtext="<a href=\"http://pmd.sf.net/reports/${mod}.html\">${name}</a>";
if (-e "../htdocs/reports/${unixname}.html") {
$jobtext="<a href=\"http://pmd.sf.net/reports/${unixname}.html\">${title}</a>";
} else {
$jobtext=$name;
$jobtext=$title;
}
$result="${result}<tr><td>${jobtext}</td>";
}