Package de.carne.gradle.plugin.java.util
Class NpmWrapper
- java.lang.Object
-
- de.carne.gradle.plugin.java.util.NpmWrapper
-
public final class NpmWrapper extends java.lang.ObjectUtility class used to invoke the npm executable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intexecuteCommand(de.carne.gradle.plugin.java.util.ExecOut out, @Nullable java.lang.String... args)intexecuteNpm(java.io.File logFile, @Nullable java.lang.String... arguments)Executes npm using the given arguments.static NpmWrappergetInstance(java.io.File directory, java.lang.String command)Gets a NpmWrapper instance for the given parameters.java.lang.StringnpmVersion()Gets the wrapped npm version.
-
-
-
Method Detail
-
getInstance
public static NpmWrapper getInstance(java.io.File directory, java.lang.String command) throws java.io.IOException, java.lang.InterruptedException
Gets a NpmWrapper instance for the given parameters.- Parameters:
directory- the directory where to run npm.command- the actual npm command to use.- Returns:
- the created NpmWrapper instance.
- Throws:
java.io.IOException- if an I/O error occurs while probing the npm command.java.lang.InterruptedException- if the thread is interrupted while probing the npm command.
-
npmVersion
public java.lang.String npmVersion()
Gets the wrapped npm version.- Returns:
- the wrapped npm version.
-
executeNpm
public int executeNpm(java.io.File logFile, @Nullable java.lang.String... arguments) throws java.io.IOException, java.lang.InterruptedExceptionExecutes npm using the given arguments.- Parameters:
logFile- the File to log the command output into.arguments- the npm arguments to use.- Returns:
- the command exit status.
- Throws:
java.io.IOException- if an I/O error occurs while executing the npm command.java.lang.InterruptedException- if the thread is interrupted while executing the npm command.
-
executeCommand
protected int executeCommand(de.carne.gradle.plugin.java.util.ExecOut out, @Nullable java.lang.String... args) throws java.io.IOException, java.lang.InterruptedException- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
-