Skip to content

Commit f281a18

Browse files
author
Clark Perkins
committed
Newer JRuby versions have more than 1 line to copy in the bin stubs
1 parent ac8aae8 commit f281a18

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bundler-maven-plugin/src/main/java/de/saumya/mojo/bundler/InstallMojo.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,26 @@ private void generateBinStubs() throws IOException {
176176
continue;
177177
}
178178
String[] lines = FileUtils.fileRead(f).split(sep);
179+
180+
final String stubSupplement;
181+
if ("end".equals(lines[lines.length - 1])) {
182+
// extra stuff in there, we need the last 6 lines
183+
StringBuilder s = new StringBuilder();
184+
for (int i = lines.length - 6; i < lines.length; ++i) {
185+
s.append(lines[i].replaceFirst(", version", ""));
186+
s.append("\n");
187+
}
188+
stubSupplement = s.toString();
189+
} else {
190+
stubSupplement = lines[lines.length - 1].replaceFirst(", version", "");
191+
}
192+
179193
File binstubFile = new File(binStubs, f.getName());
180194
if(!binstubFile.exists()){
181195
if(jrubyVerbose){
182196
getLog().info("create bin stub " + binstubFile);
183197
}
184-
FileUtils.fileWrite(binstubFile, stub + lines[lines.length - 1].replaceFirst(", version", ""));
198+
FileUtils.fileWrite(binstubFile, stub + stubSupplement);
185199
setExecutable(binstubFile);
186200
}
187201
}

0 commit comments

Comments
 (0)