Skip to content

Commit 6170d37

Browse files
author
R. Tyler Croy
committed
Refactor and tidy up customizing gemInstallDir while keeping it in project.buildDir by default
See #28
1 parent 85f1169 commit 6170d37

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

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

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

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

2223
if (extractDir.exists()) {
2324
return
2425
}
2526

2627
p.exec {
2728
executable "gem"
28-
args 'install', gem, "--install-dir=${p.gemInstallDir}", '--no-ri', '--no-rdoc'
29+
args 'install', gem, "--install-dir=${gemInstallDir}", '--no-ri', '--no-rdoc'
2930
}
3031
}
3132

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ class JRubyPlugin implements Plugin<Project> {
1919
}
2020
}
2121

22-
project.ext {
23-
gemInstallDir = "${project.buildDir}/${project.jruby.gemInstallDir}"
24-
}
25-
2622
// Set up a special configuration group for our embedding jars
2723
project.configurations {
2824
jrubyEmbeds

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import org.gradle.api.Incubating
44
import org.gradle.api.Project
55

66
class JRubyPluginExtension {
7-
// More details here: <http://rubygems-proxy.torquebox.org/>
8-
// String defaultGemRepo = 'http://rubygems-proxy.torquebox.org/releases'
9-
// String gemrepo_url = defaultGemRepo
10-
String gemInstallDir = 'vendor'
11-
127
/** The default version of jruby that will be used by jrubyWar
138
*
149
*/
1510
String defaultVersion = '1.7.13'
11+
/** Directory for jrubyPrepare to install .gem dependencies into
12+
*
13+
*/
14+
String gemInstallDir
1615

1716
/** The version of jruby used by jrubyexec as well as default version of jruby that will be used by JRubyExec
1817
*
@@ -27,6 +26,7 @@ class JRubyPluginExtension {
2726

2827
JRubyPluginExtension(Project p) {
2928
project = p
29+
gemInstallDir = [p.buildDir.absolutePath, 'vendor'].join(File.separator)
3030
}
3131

3232
/** Change the version of jruby for jrubyexec and JRubyExec

0 commit comments

Comments
 (0)