From 767161e06992f2ad8bb39a5f277946f238f38906 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 10 Aug 2015 05:41:49 -0700 Subject: [PATCH] Only attempt to copy the bindir if it actually exists in our data.tar.gz In commons-vfs 2.1-SNAPSHOT it appears that .getChild() is returning null instead of raising a FileNotFoundException when the bindir isn't present. I might be referring to outdated docs, but this resolves the issue and makes sure there are not NPEs raised --- .../jrubygradle/groovygem/internal/GemInstaller.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/com/github/jrubygradle/groovygem/internal/GemInstaller.groovy b/src/main/groovy/com/github/jrubygradle/groovygem/internal/GemInstaller.groovy index 2886988..fe05534 100644 --- a/src/main/groovy/com/github/jrubygradle/groovygem/internal/GemInstaller.groovy +++ b/src/main/groovy/com/github/jrubygradle/groovygem/internal/GemInstaller.groovy @@ -156,13 +156,20 @@ class GemInstaller { protected void extractData(File installDir, FileObject dataTarGz, Gem gem) { String dir = "${gem.name}-${gem.version.version}" + logger.info("Extracting into ${installDir} from ${gem.name}") FileObject outputDir = fileSystemManager.resolveFile(new File(installDir, 'gems'), dir) outputDir.copyFrom(dataTarGz, new AllFileSelector()) outputDir.close() } protected void extractExecutables(File installDir, FileObject dataTarGz, Gem gem) { + String binDir = gem.bindir ?: 'bin' FileObject binObject = fileSystemManager.resolveFile(installDir, 'bin') - binObject.copyFrom(dataTarGz.getChild(gem.bindir), new AllFileSelector()) + FileObject child = dataTarGz.getChild(binDir) + if (!child) { + return + } + binObject.copyFrom(child, new AllFileSelector()) + binObject.close() } } \ No newline at end of file