Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated README.md

  • Loading branch information...
commit 2152f500aa098cb54ce71f64c160e9d9ad168722 2 parents 146aabb + 928c1f8
@sirrapa authored
View
4 src/main/java/com/sirrapa/maven/plugins/nodejs/NodeJsMojo.java
@@ -105,14 +105,14 @@ public void execute() throws MojoExecutionException {
* @return
*/
protected String getNodeJsExecutable(String osFamily) {
- getLog().debug("Determing executable for osFamily = " + osFamily);
+ getLog().debug(String.format("Determing executable for osFamily = '%s'",osFamily));
StringBuilder sb = new StringBuilder(nodejsDirectory.getAbsolutePath());
if (Os.FAMILY_WINDOWS.equals(osFamily) || Os.FAMILY_DOS.equals(osFamily)) {
sb.append(File.separator).append("node.exe");
} else {
sb.append(File.separator).append("bin").append(File.separator).append("node");
}
- getLog().info("Determined executable for osFamily: " + sb.toString());
+ getLog().info(String.format("Determined executable for osFamily '%s' = '%s'",osFamily,sb.toString()));
return sb.toString();
}
View
17 src/test/java/com/sirrapa/maven/plugins/nodejs/NodeJsMojoTest.java
@@ -20,6 +20,7 @@
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.shell.BourneShell;
import org.codehaus.plexus.util.cli.shell.CmdShell;
import org.codehaus.plexus.util.cli.shell.CommandShell;
@@ -201,15 +202,21 @@ public void testGetCommandLine() throws Exception {
Commandline cmd = mojo.getCommandLine(new File(workDir + "/"), executable, module.getName(), module.getArguments());
assertNotNull("commandline is null", cmd);
- /** the expected string differs per OS... */
- String expected= "/bin/sh -c cd %s && %s %s -o buildconfig.js";
- assertEquals("The commandline string is invalid", String.format(expected, workDir, executable, module.getName()), cmd.toString());
- //windows...
+ /** the expected command shell differs per OS... */
+ //faking windows OS...
cmd.setShell(new CmdShell());
cmd.getShell().setQuotedExecutableEnabled(false);
cmd.getShell().setQuotedArgumentsEnabled(false);
- expected = "cmd.exe /X /C \"%s %s -o buildconfig.js\"";
+ String expected = "cmd.exe /X /C \"%s %s -o buildconfig.js\"";
assertEquals("The windows commandline string is invalid", String.format(expected, executable, module.getName()), cmd.toString());
+
+ //faking all OS with bourne shell...
+ cmd.setShell(new BourneShell());
+ cmd.getShell().setQuotedExecutableEnabled(false);
+ cmd.getShell().setQuotedArgumentsEnabled(false);
+ expected= "/bin/sh -c cd %s && %s %s -o buildconfig.js";
+ assertEquals("The commandline string is invalid", String.format(expected, workDir, executable, module.getName()), cmd.toString());
+
}
// public void testCmdLine() throws Exception {
Please sign in to comment.
Something went wrong with that request. Please try again.