Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
View
5 src/main/java/com/sirrapa/maven/plugins/nodejs/NodeJsMojo.java
@@ -105,9 +105,12 @@ public void execute() throws MojoExecutionException {
* @return
*/
protected String getNodeJsExecutable(String osFamily) {
+ if(osFamily == null) {
+ throw new IllegalArgumentException("osFamily is null");
+ }
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)) {
+ if (osFamily.toLowerCase().startsWith("win")) {
sb.append(File.separator).append("node.exe");
} else {
sb.append(File.separator).append("bin").append(File.separator).append("node");
View
3 src/test/java/com/sirrapa/maven/plugins/nodejs/NodeJsMojoTest.java
@@ -174,11 +174,10 @@ public void testGetNodeJsExecutable() throws Exception {
String nodejsEx;
for (String family : Os.getValidFamilies()) {
- Os os = new Os(family);
nodejsEx = mojo.getNodeJsExecutable(family);
log.debug(String.format("nodejsEx for %s = %s", family, nodejsEx));
- if (Os.FAMILY_WINDOWS.equals(family) || Os.FAMILY_DOS.equals(family)) {
+ if (family.startsWith("win")) {
assertTrue(String.format("The nodejs executable for %s family is invalid", family), nodejsEx.endsWith(File.separator + "nodejs" + File.separator + "node.exe"));
} else {
assertTrue(String.format("The nodejs executable for %s family is invalid", family), nodejsEx.endsWith(File.separator + "nodejs" + File.separator + "bin" + File.separator + "node"));

No commit comments for this range

Something went wrong with that request. Please try again.