Skip to content

Commit b4d8779

Browse files
author
R. Tyler Croy
committed
Use the appropriate gemDir when setting the PATH env variable
Fixes #70
1 parent 328422b commit b4d8779

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/main/groovy/com/github/jrubygradle/JRubyExec.groovy

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ class JRubyExec extends JavaExec {
117117
/** Return the computed `PATH` for the task
118118
*
119119
*/
120-
String getComputedPATH(String configuration, String originalPath) {
121-
File path = new File([project.buildDir,
122-
'tmp',
123-
configuration,
124-
'bin'].join(File.separator))
120+
String getComputedPATH(String originalPath) {
121+
File path = new File(tmpGemDir(), 'bin')
125122
return path.absolutePath + File.pathSeparatorChar + originalPath
126123
}
127124

@@ -154,7 +151,7 @@ class JRubyExec extends JavaExec {
154151
File gemDir = tmpGemDir()
155152
gemDir.mkdirs()
156153
environment 'GEM_HOME' : gemDir,
157-
'PATH' : getComputedPATH(configuration, System.env.PATH)
154+
'PATH' : getComputedPATH(System.env.PATH)
158155

159156
if (configuration != null) {
160157
GemUtils.extractGems(

src/test/groovy/com/github/jrubygradle/JRubyExecSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,6 @@ class JRubyExecSpec extends Specification {
174174
}
175175

176176
then:
177-
execTask.getComputedPATH('foo', System.env.PATH).contains('foo')
177+
execTask.getComputedPATH(System.env.PATH).contains('foo')
178178
}
179179
}

0 commit comments

Comments
 (0)