mirror of https://github.com/jruby-gradle/jem
parent
d796d01b35
commit
963ed7c59e
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue