Class GitExecutor

java.lang.Object
xyz.ronella.gradle.plugin.simple.git.GitExecutor

public class GitExecutor extends Object
The actual assembler of the git command to execute.
Since:
2020-05-05
  • Field Details

    • OS_TYPE

      public static final OSType OS_TYPE
      Holds the OS Type
    • GIT_EXE

      public static final String GIT_EXE
      Holds the git executable.
  • Method Details

    • quoteString

      public static String quoteString(String text)
      A utility for quoting a string.
      Parameters:
      text - The text to quote.
      Returns:
      A quoted string.
    • quoteString

      public static String quoteString(String text, OSType osType)
      A utility for quoting a string based on os type. Thus the return value is not necessary a quoted text.
      Parameters:
      text - The text to quote.
      osType - The os type.
      Returns:
      A quoted string.
    • getGitExe

      public String getGitExe()
      Provides the git executable.
      Returns:
      The git executable.
    • getScript

      public Path getScript()
      Provides the script to use to force in directory execution.
      Returns:
      The path of the script.
    • getDirectory

      public Path getDirectory()
      The directory to run the git command.
      Returns:
      The directory to run the git command.
    • execute

      public void execute(Consumer<IContext> logic)
      Must hold the execute logic based on the context provided.
      Parameters:
      logic - The executed logic with context.
    • getArgs

      public List<String> getArgs()
      The git command arguments.
      Returns:
      An array of arguments.
    • getOpts

      public List<String> getOpts()
      The options before the git command.
      Returns:
      An array of options.
    • getExecutable

      public String getExecutable()
      The executable to be used in task exec.
      Returns:
      The executable name.
    • getExecArgs

      public List<String> getExecArgs()
      The arguments for the executable.
      Returns:
      An array of executable args.
    • getCommand

      public String getCommand()
      The full command that will be executed.
      Returns:
      The full command.
    • getBuilder

      public static xyz.ronella.gradle.plugin.simple.git.GitExecutor.GitExecutorBuilder getBuilder()
      The builder of the GitExecutor
      Returns:
      An instance of GitExecutorBuilder.