Skip to content

Commit d565248

Browse files
author
R. Tyler Croy
committed
Parent gemInstallDir under $project.buildDir
Fixes #28
1 parent cd9b8b1 commit d565248

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/main/groovy/com/lookout/jruby/GemUtils.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ class GemUtils {
1414

1515
static Boolean extractGem(Project p, File gem) {
1616
String gemName = gemFullNameFromFile(gem.getName())
17-
String installDir = p.jruby.gemInstallDir
18-
File extractDir = new File("./${installDir}/gems/${gemName}")
17+
// Wherever our gems will be installed, we need to make sure the
18+
// directory exists since `p.exec` will silently fail
19+
new File(p.gemInstallDir).mkdirs()
20+
File extractDir = new File("${p.gemInstallDir}/gems/${gemName}")
1921

2022
if (extractDir.exists()) {
2123
return
2224
}
2325

2426
p.exec {
2527
executable "gem"
26-
args 'install', gem, "--install-dir=./${installDir}", '--no-ri', '--no-rdoc'
28+
args 'install', gem, "--install-dir=${p.gemInstallDir}", '--no-ri', '--no-rdoc'
2729
}
2830
}
2931

src/main/groovy/com/lookout/jruby/JRubyPlugin.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class JRubyPlugin implements Plugin<Project> {
1313
project.apply plugin: 'war'
1414
project.extensions.create('jruby', JRubyPluginExtension, project)
1515

16+
project.ext {
17+
gemInstallDir = "${project.buildDir}/${project.jruby.gemInstallDir}"
18+
}
19+
1620
project.repositories {
1721
maven {
1822
// The url is in a closure to ensure that we can overwrite this
@@ -101,7 +105,7 @@ class JRubyPlugin implements Plugin<Project> {
101105
from "$project.buildDir/classes/main"
102106
// Bring our vendored gems into the created war file
103107
webInf {
104-
from project.jruby.gemInstallDir
108+
from project.gemInstallDir
105109
into 'gems'
106110
}
107111

0 commit comments

Comments
 (0)