Merge pull request #2 from aslakknutsen/export_exploded

Export complete data.tar.gz file via ShrinkWrap ExplodedExporter
This commit is contained in:
R. Tyler Croy 2015-08-12 15:10:15 -07:00
commit 55fc37d9cf
1 changed files with 3 additions and 13 deletions

View File

@ -5,7 +5,7 @@ import org.jboss.shrinkwrap.api.ArchivePath
import org.jboss.shrinkwrap.api.GenericArchive
import org.jboss.shrinkwrap.api.ShrinkWrap
import org.jboss.shrinkwrap.api.Node
import org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader
import org.jboss.shrinkwrap.api.exporter.ExplodedExporter
import org.jboss.shrinkwrap.api.importer.TarImporter
import org.jboss.shrinkwrap.impl.base.io.IOUtil
import org.slf4j.Logger
@ -141,20 +141,10 @@ class GemInstaller {
/** Extract the data.tar.gz contents into gems/full-name/* */
protected void extractData(File installDir, GenericArchive dataTarGz, Gem gem) {
ClassLoader loader = new ShrinkWrapClassLoader(dataTarGz)
File outputDir = new File(installDir, ['gems', gemFullName(gem)].join(File.separator))
File outputDir = new File(installDir, 'gems')
outputDir.mkdirs()
gem.files.sort().each { String fileName ->
File outputFile = new File(outputDir, fileName)
outputFile.parentFile.mkdirs()
InputStream stream = loader.getResourceAsStream(fileName)
if (stream) {
IOUtil.copy(stream, outputFile.newOutputStream())
}
}
dataTarGz.as(ExplodedExporter.class).exportExploded(outputDir, gemFullName(gem))
}
/** Extract the executables from the specified bindir */