Modified to use new -shortnames thing

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2109 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-07-21 13:13:58 +00:00
parent 5b3d7186c2
commit a31ff8c2e6

View File

@ -17,30 +17,26 @@ class MyThread < Thread
end end
class Job class Job
attr_reader :unixName attr_reader :unixName
def initialize(location, title, unixName, moduleDirectory, sourceDirectory ) def initialize(location, title, unixName, moduleDirectory, sourceDirectory )
@location = location @location = location
@title = title @title = title
@unixName = unixName @unixName = unixName
if (@location == "Sourceforge") @cvsroot = ':pserver:anonymous@cvs1:/cvsroot/' + unixName
@cvsroot = ':pserver:anonymous@cvs1:/cvsroot/' + unixName @moduleDirectory = moduleDirectory
else @sourceDirectory = sourceDirectory.strip
@cvsroot = ':pserver:anoncvs@cvs.apache.org:/home/cvspublic' end
end def checkout_code
@moduleDirectory = moduleDirectory # note that we just export the source directory - we don't need all the other stuff
@sourceDirectory = sourceDirectory.strip # this saves time/bandwidth/processing load. All good.
end #
def checkout_code # use the Thread.ttl gizmo to end it after 2 minutes
# note that we just export the source directory - we don't need all the other stuff t = MyThread.new {
# this saves time/bandwidth/processing load. All good. MyThread.ttl = 120
# `cvs -Q -d#{@cvsroot} export -D tomorrow "#{@sourceDirectory}"`
# use the Thread.ttl gizmo to end it after 2 minutes }
t = MyThread.new { t.join
MyThread.ttl = 120 end
`cvs -Q -d#{@cvsroot} export -D tomorrow "#{@sourceDirectory}"`
}
t.join
end
def checkOutOK def checkOutOK
return File.exists?(@sourceDirectory) return File.exists?(@sourceDirectory)
end end
@ -49,7 +45,7 @@ class Job
`#{cmd}` `#{cmd}`
end end
def run_pmd def run_pmd
cmd="java -jar pmd-1.1.jar \"#{@sourceDirectory}\" html rulesets/unusedcode.xml > \"#{reportFile}\"" cmd="java -jar pmd-1.1.jar \"/home/users/t/to/tomcopeland/pmdweb/#{@sourceDirectory}\" html rulesets/unusedcode.xml -shortnames > \"#{reportFile}\""
`#{cmd}` `#{cmd}`
arr = IO.readlines(reportFile()) arr = IO.readlines(reportFile())
newFile=File.open(reportFile(), "w") newFile=File.open(reportFile(), "w")
@ -64,21 +60,21 @@ class Job
cmd="java -cp pmd-1.1.jar net.sourceforge.pmd.cpd.CPD 100 \"#{@sourceDirectory}\" > \"#{cpdReportFile}\"" cmd="java -cp pmd-1.1.jar net.sourceforge.pmd.cpd.CPD 100 \"#{@sourceDirectory}\" > \"#{cpdReportFile}\""
`#{cmd}` `#{cmd}`
end end
def reportFile def reportFile
return "/home/groups/p/pm/pmd/htdocs/reports/#{@unixName}_#{@moduleDirectory.sub(" ", "")}.html" return "/home/groups/p/pm/pmd/htdocs/reports/#{@unixName}_#{@moduleDirectory.sub(" ", "")}.html"
end end
def cpdReportFile def cpdReportFile
return "/home/groups/p/pm/pmd/htdocs/reports/cpd_#{@unixName}_#{@moduleDirectory.sub(" ", "")}.txt" return "/home/groups/p/pm/pmd/htdocs/reports/cpd_#{@unixName}_#{@moduleDirectory.sub(" ", "")}.txt"
end end
def ncssReportFile def ncssReportFile
return "/home/groups/p/pm/pmd/htdocs/reports/#{@unixName}_#{@moduleDirectory.sub(" ", "")}_ncss.txt" return "/home/groups/p/pm/pmd/htdocs/reports/#{@unixName}_#{@moduleDirectory.sub(" ", "")}_ncss.txt"
end end
def clear def clear
`rm -rf "#{@moduleDirectory}"` `rm -rf "#{@moduleDirectory}"`
end end
def to_s def to_s
return @location + ":" + @title + ":" + @unixName +":"+@moduleDirectory+":"+@sourceDirectory return @location + ":" + @title + ":" + @unixName +":"+@moduleDirectory+":"+@sourceDirectory
end end
end end
end end