added ability to handle module names with spaces
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1064 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -54,14 +54,15 @@ class Job
|
||||
end
|
||||
|
||||
def checkout_code
|
||||
`cvs -Q -d#{@cvsroot} co #{@moduleDirectory}`
|
||||
`cvs -Q -d#{@cvsroot} co "#{@moduleDirectory}"`
|
||||
end
|
||||
|
||||
def run_pmd
|
||||
cmd="java -jar pmd-1.0rc2.jar #{@sourceDirectory} html rulesets/unusedcode.xml > ../htdocs/reports/#{@unixName}_#{@moduleDirectory}.html"
|
||||
cmd="java -jar pmd-1.0rc2.jar \"#{@sourceDirectory}\" html rulesets/unusedcode.xml > \"#{reportFile()}\""
|
||||
puts "running #{cmd}"
|
||||
`#{cmd}`
|
||||
arr = IO.readlines("../htdocs/reports/#{@unixName}_#{@moduleDirectory}.html")
|
||||
newFile=File.open("../htdocs/reports/#{@unixName}_#{@moduleDirectory}.html", "w")
|
||||
arr = IO.readlines(reportFile())
|
||||
newFile=File.open(reportFile(), "w")
|
||||
arr.each do | line |
|
||||
if (line["Error while parsing"] == nil)
|
||||
newFile << line
|
||||
@ -69,9 +70,13 @@ class Job
|
||||
end
|
||||
newFile.close
|
||||
end
|
||||
|
||||
def reportFile
|
||||
return "../htdocs/reports/#{@unixName}_#{@moduleDirectory.sub(" ", "")}.html"
|
||||
end
|
||||
|
||||
def clear
|
||||
`rm -rf #{@moduleDirectory}`
|
||||
`rm -rf "#{@moduleDirectory}"`
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
@ -72,12 +72,13 @@ sub loadProjectList() {
|
||||
my $jobdata=<FILE>;
|
||||
my ($title,$unixname, $mod, $src) = split(":", $jobdata);
|
||||
my $jobtext="";
|
||||
if (-e "../htdocs/reports/${unixname}_${mod}.html") {
|
||||
$jobtext="<a href=\"http://pmd.sf.net/reports/${unixname}_${mod}.html\">${title}</a>";
|
||||
if (-e getReportFile($unixname, $mod)) {
|
||||
my $reportURL=getReportURL(${unixname}, ${mod});
|
||||
$jobtext="<a href=\"${reportURL}\")>${title}</a>";
|
||||
} else {
|
||||
$jobtext=$title;
|
||||
}
|
||||
my $lines = getLines("../htdocs/reports/${unixname}_${mod}.html");
|
||||
my $lines = getLines(getReportFile($unixname, $mod));
|
||||
$result="${result}<tr><td>${jobtext}</td><td></td><td><a href=\"http://${unixname}.sf.net/\">http://${unixname}.sf.net/</a></td><td>${lines}</td>";
|
||||
}
|
||||
}
|
||||
@ -85,6 +86,24 @@ sub loadProjectList() {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub getReportURL() {
|
||||
my ($unixname, $mod) = @_;
|
||||
my $name = getReportFileName($unixname, $mod);
|
||||
return "http://pmd.sf.net/reports/${name}";
|
||||
}
|
||||
|
||||
sub getReportFile() {
|
||||
my ($unixname, $mod) = @_;
|
||||
my $name = getReportFileName($unixname, $mod);
|
||||
return "../htdocs/reports/${name}";
|
||||
}
|
||||
|
||||
sub getReportFileName() {
|
||||
my ($unixname, $mod) = @_;
|
||||
$mod=~s/\s+//g;
|
||||
return "${unixname}_${mod}.html";
|
||||
}
|
||||
|
||||
sub getLines() {
|
||||
my ($filename) = @_;
|
||||
open(FILE,$filename);
|
||||
|
Reference in New Issue
Block a user