lib/reports/Report.rb in taskjuggler-0.0.7 vs lib/reports/Report.rb in taskjuggler-0.0.8
- old
+ new
@@ -139,11 +139,11 @@
if a('selfcontained')
auxSrcDir = AppConfig.dataDirs('data/css')[0]
cssFileName = (auxSrcDir ? auxSrcDir + '/tjreport.css' : '')
# Raise an error if we haven't found the data directory
if auxSrcDir.nil? || !File.exists?(cssFileName)
- dataDirError(cssFileName)
+ dataDirError(cssFileName, AppConfig.dataSearchDirs('data/css'))
end
cssFile = IO.read(cssFileName)
if cssFile.empty?
raise TjException.new, <<"EOT"
Cannot read '#{cssFileName}'. Make sure the file is not empty and you have
@@ -212,39 +212,10 @@
return nil unless @content
# CSV format can only handle the first element.
return nil unless (csv = @content.to_csv)
- # Expand nested tables into the outer table.
- columnIdx = 0
- while columnIdx < csv[0].length do
- if csv[0][columnIdx].is_a?(Array)
- # We've found a nested table.
- nestedTable = csv[0][columnIdx]
- # The nested table must have exactly as many lines as the outer table.
- if csv.length != nestedTable.length
- raise "Table size mismatch"
- end
- # Insert the nested table into the lines of the outer table.
- csv.each do |line|
- lineIdx = csv.index(line)
- if lineIdx == 0
- # The header cell can be reused.
- line[columnIdx] = nestedTable[lineIdx]
- else
- # For normal lines we have no cells for the table. Just inject
- # them.
- line.insert(columnIdx, nestedTable[lineIdx])
- end
- # Make sure there are no more Arrays nested into the line.
- line.flatten!
- end
- else
- columnIdx += 1
- end
- end
-
# Use the CSVFile class to write the Array of Arrays to a colon
# separated file. Write to $stdout if the filename was set to '.'.
begin
fileName = (@name == '.' ? @name :
(@name[0] == '/' ? '' : @project.outputDir) +
@@ -298,11 +269,13 @@
auxDstDir = (File.dirname((@name[0] == '/' ? '' : @project.outputDir) +
@name) + '/').untaint
# Find the data directory that came with the TaskJuggler installation.
auxSrcDir = AppConfig.dataDirs("data/#{dirName}")[0].untaint
# Raise an error if we haven't found the data directory
- dataDirError(dirName) if auxSrcDir.nil? || !File.exists?(auxSrcDir)
+ if auxSrcDir.nil? || !File.exists?(auxSrcDir)
+ dataDirError(dirName, AppConfig.dataSearchDirs("data/#{dirName}"))
+ end
# Don't copy directory if all files are up-to-date.
return if directoryUpToDate?(auxSrcDir, auxDstDir + dirName)
# Recursively copy the directory and all content.
FileUtils.cp_r(auxSrcDir, auxDstDir)
@@ -320,16 +293,19 @@
File.mtime(srcFile) > File.mtime(dstFile)
end
true
end
- def dataDirError(dirName)
+ def dataDirError(dirName, dirs)
error('data_dir_error', <<"EOT"
Cannot find the #{dirName} directory. This is usually the result of an
improper TaskJuggler installation. If you know the directory, you can use the
TASKJUGGLER_DATA_PATH environment variable to specify the location. The
variable should be set to the path without the /data at the end. Multiple
-directories must be separated by colons.
+directories must be separated by colons. The following directories have been
+tried:
+
+#{dirs.join("\n")}
EOT
)
end
end