Skip to content

Commit

Permalink
resolves asciidoctor#115 issue warning if GEM_HOME resolves to unexpe…
Browse files Browse the repository at this point in the history
…cted external path
  • Loading branch information
mojavelinux committed Aug 21, 2014
1 parent 559fbe6 commit 9f74c5f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,22 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

protected Asciidoctor getAsciidoctorInstance(String gemPath) throws MojoExecutionException {
Asciidoctor asciidoctor = null;
if (gemPath == null) {
return Asciidoctor.Factory.create();
asciidoctor = Asciidoctor.Factory.create();
}
else {
return Asciidoctor.Factory.create(gemPath);
asciidoctor = Asciidoctor.Factory.create(gemPath);
}

String gemHome = JRubyRuntimeContext.get().evalScriptlet("ENV['GEM_HOME']").toString();
String gemHomeExpected = (gemPath == null || "".equals(gemPath)) ? "" : gemPath.split(java.io.File.pathSeparator)[0];

if (!"".equals(gemHome) && !gemHomeExpected.equals(gemHome)) {
getLog().warn("Using inherited external environment to resolve gems (" + gemHome + "), i.e. build is platform dependent!");
}

return asciidoctor;
}

private List<File> scanSourceFiles() {
Expand Down

0 comments on commit 9f74c5f

Please sign in to comment.