Class NodeCommand

java.lang.Object
com.brunoritz.gradle.singularnode.platform.NodeCommand

public class NodeCommand extends Object
Utility to create NodeJS invocations. This class provides means of setting the execution environment and providing any arguments necessary. The commands are executed using th calling project's directory as its working directory.
  • Constructor Details

    • NodeCommand

      public NodeCommand(org.gradle.process.ExecOperations processes, File workingDirectory, InstallationLayout layout)
  • Method Details

    • args

      public NodeCommand args(CharSequence... args)
      Appends the given arguments to the potentially existing ones. No existing parameters will be overwritten.
      Parameters:
      args - The additional arguments
      Returns:
      A new instance with the updated arguments
    • args

      public NodeCommand args(io.vavr.collection.List<CharSequence> args)
      Appends the given arguments to the potentially existing ones. No existing parameters will be overwritten.
      Parameters:
      args - The additional arguments
      Returns:
      A new instance with the updated arguments
    • withEnvironment

      public NodeCommand withEnvironment(io.vavr.collection.Map<CharSequence,CharSequence> environment)
      Appends environment variables to the command. Existing environment variables will be overwritten with those contained in environment.
      Parameters:
      environment - The additional environment to apply
      Returns:
      A new instance with the updated environment
    • execute

      public void execute()
      Executes the configured command. In order to make the NodeJS invocation work properly, the PATH envioronemnt variable is prepended with the binary directory of the NodeJS installation.