public void debug(final String message,
final Throwable throwable) {
}
});
final TarCompressionMethod compression = new TarCompressionMethod();
File dataTarGz = null;
if (!gem.getGemFiles().isEmpty()) {
// tar.gz the content into data.tar.gz
dataTarGz = new File(gemWorkdir, "data.tar.gz");
compression.setValue("gzip");
tar.setCompression(compression);
tar.setDestFile(dataTarGz);
for (final GemFileEntry entry : gem.getGemFiles()) {
if (entry.getSource().isFile()) {
tar.addFile(entry.getSource(), entry.getPathInGem());
}
else if (entry.getSource().isDirectory()) {
tar.addDirectory(entry.getSource(),
entry.getPathInGem());
}
}
tar.createArchive();
}
// and finally create gem by tar.gz-ing data.tar.gz and metadata.gz
final File gemFile = new File(target, gem.getGemFilename());
tar.setDestFile(gemFile);
compression.setValue("none");
tar.setCompression(compression);
if (dataTarGz != null) {
tar.addFile(dataTarGz, dataTarGz.getName());
}
tar.addFile(metadataGz, metadataGz.getName());