Avoid caching gem files unnecessarily

Fixes #5
This commit is contained in:
R. Tyler Croy 2015-08-21 17:53:07 -07:00
parent d796d01b35
commit 963ed7c59e
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
2 changed files with 2 additions and 19 deletions

View File

@ -23,7 +23,7 @@ import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
public class GemInstaller {
public static final String[] GEM_HOME_DIRS = {"bin", "build_info", "cache", "doc",
public static final String[] GEM_HOME_DIRS = {"bin", "build_info", "doc",
"extensions", "gems", "specifications"};
protected Logger logger = LoggerFactory.getLogger(GemInstaller.class);
@ -52,14 +52,6 @@ public class GemInstaller {
public Gem installGem(File installDir, File gem, DuplicateBehavior onDuplicate) {
/* TODO: isValidGem? */
try {
cacheGemInInstallDir(installDir, gem);
}
catch (IOException ex) {
logger.error("Failed to cache our gem in %s", installDir, ex);
return null;
}
Gem gemMetadata;
GenericArchive gemArchive = ShrinkWrap.create(TarImporter.class)
.importFrom(gem).as(GenericArchive.class);
@ -155,12 +147,6 @@ public class GemInstaller {
return fullName;
}
/** Cache the gem in GEM_HOME/cache */
protected void cacheGemInInstallDir(File installDir, File gem) throws IOException {
File cacheDir = new File(installDir, "cache");
Files.copy(gem.toPath(), (new File(cacheDir, gem.getName())).toPath());
}
/** Extract the gemspec file from the {@code Gem} provided into the ${installDir}/specifications */
protected void extractSpecification(File installDir, Gem gem) throws Exception {
String outputFileName = String.format("%s.gemspec", gemFullName(gem));

View File

@ -121,10 +121,7 @@ class GemInstallerIntegrationSpec extends Specification {
when:
installer.install()
then: "the gem should be cached in ${installDir}/cache"
(new File(installDir, ['cache', GemInstallerSpec.GEM_FILENAME].join(File.separator))).exists()
and: "the ${installDir}/specifications dir should contain the gemspec"
then: "the ${installDir}/specifications dir should contain the gemspec"
File specification = new File(installDir, ['specifications', "${GemInstallerSpec.GEM_NAME}.gemspec"].join(File.separator))
specification.isFile()
specification.size() > 0