Deploying the tool

As previously mentioned, arara runs on top of a Java virtual machine, available on all major operating systems -- in some cases, you might need to install the proper virtual machine. This chapter provides detailed instructions on how to properly deploy the tool in your computer from either the official package available in our project repository or a personal build generated from source (as seen in Building).

Directory structure

From the early development stages, our tool employs a very straightforward directory structure. In short, we provide the ARARA_HOME alias to the directory path in which the arara.jar Java archive file is located. This particular file is the heart and soul of our tool and dictates the default rule search path, which is a special directory named rules available from the same level. This directory contains all rules specified in the YAML format. The structure overview is presented as follows.

Structure 1

Provided that this specific directory structure is honoured, the tool is ready for use off the shelf. In fact, the official arara CTAN package is available in the artifacts section of our project repository. Once the package is properly downloaded, we simply need to extract it into a proper ARARA_HOME location.

Defining a location

First and foremost, we need to obtain master-ctan.zip from our project repository at GitLab, which is our CTAN package artifact. As the name indicates, this is a compressed file format, so we need to extract it into a proper location. Run the following commands in the terminal:

$ unzip master-ctan.zip
$ unzip arara.tds.zip
$ mv scripts/arara .

As a result of the previous commands, we obtained a directory named arara with the exact structure presented in the previous section in our working directory (amongst other files and directories that can be safely discarded). Now we need to decide where arara should reside in our system. For example, I usually deploy my tools inside the /opt/islandoftex path, so I need to run the following command in the terminal (please note that my personal directory already has the proper permissions, so I do not need superuser privileges):

$ mv arara /opt/islandoftex/

The tool has found a comfortable home inside my system! Observe that the full path of the ARARA_HOME reference points out to /opt/islandoftex/arara since this is my deployment location of choice. The resulting structure overview, from the root directory, is presented as follows:

Structure 1

If the tool was built from source (as indicated in Building), make sure to construct the provided directory structure previously presented. We can test the deployment by running the following command in the terminal (please note the full path):

$ java -jar /opt/islandoftex/arara/arara.jar
Usage: arara [OPTIONS] file...

    __ _ _ __ __ _ _ __ __ _
   / _` | '__/ _` | '__/ _` |
  | (_| | | | (_| | | | (_| |
   \__,_|_|  \__,_|_|  \__,_|

  The cool TeX automation tool.

  arara executes the TeX workflow you tell it to execute. Simply specify your
  needs within your TeX file and let arara do the work. These directives
  feature conditional execution and parameter expansion.

Options:
  -l, --log                        Generate a log output
  -v, --verbose / -s, --silent     Print the command output
  -n, --dry-run                    Go through all the motions of running a
                                   command, but with no actual calls
  -S, --safe-run                   Run in safe mode and disable potentially
                                   harmful features. Make sure your projects
                                   uses only allowed features.
  -w, --whole-file                 Extract directives in the file, not only in
                                   the header
  -p, --preamble TEXT              Set the file preamble based on the
                                   configuration file
  -t, --timeout INT                Set the execution timeout (in milliseconds)
  -L, --language TEXT              Set the application language
  -m, --max-loops INT              Set the maximum number of loops (> 0)
  -d, --working-directory PATH     Set the working directory for all tools
  -P, --call-property VALUE        Pass parameters to the application to be
                                   used within the session.
  --generate-completion [bash|zsh|fish]
                                   Generate a completion script for arara. Add
                                   'source <(arara --generate-completion
                                   <shell>)' to your shell's init file.
  -V, --version                    Show the version and exit
  -h, --help                       Show this message and exit

Arguments:
  file  The file(s) to evaluate and process

Please observe that, provided that the underlying operating system has an appropriate Java virtual machine installed, arara can be used as a portable, standalone application. Portable applications can be stored on any data storage device, including external devices such as USB drives and floppy disks.

Tool wrapping

arara is now properly deployed in our system, but we still need to provide the full path of arara.jar to the Java virtual machine in order to make our tool work. This section provides three approaches regarding the creation of a wrapper, a shell feature that embeds a system command or utility, that accepts and passes a set of parameters to that command.

Regardless of the adopted approach, there should be an arara wrapper available as an actual Unix command in your shell session. In order to test the wrapper, run the following command in the terminal:

$ arara
Usage: arara [OPTIONS] file...

    __ _ _ __ __ _ _ __ __ _
   / _` | '__/ _` | '__/ _` |
  | (_| | | | (_| | | | (_| |
   \__,_|_|  \__,_|_|  \__,_|

  The cool TeX automation tool.

  arara executes the TeX workflow you tell it to execute. Simply specify your
  needs within your TeX file and let arara do the work. These directives
  feature conditional execution and parameter expansion.

Options:
  -l, --log                        Generate a log output
  -v, --verbose / -s, --silent     Print the command output
  -n, --dry-run                    Go through all the motions of running a
                                   command, but with no actual calls
  -S, --safe-run                   Run in safe mode and disable potentially
                                   harmful features. Make sure your projects
                                   uses only allowed features.
  -w, --whole-file                 Extract directives in the file, not only in
                                   the header
  -p, --preamble TEXT              Set the file preamble based on the
                                   configuration file
  -t, --timeout INT                Set the execution timeout (in milliseconds)
  -L, --language TEXT              Set the application language
  -m, --max-loops INT              Set the maximum number of loops (> 0)
  -d, --working-directory PATH     Set the working directory for all tools
  -P, --call-property VALUE        Pass parameters to the application to be
                                   used within the session.
  --generate-completion [bash|zsh|fish]
                                   Generate a completion script for arara. Add
                                   'source <(arara --generate-completion
                                   <shell>)' to your shell's init file.
  -V, --version                    Show the version and exit
  -h, --help                       Show this message and exit

Arguments:
  file  The file(s) to evaluate and process

It is important to observe that the wrapper initiative presented in this section might cause a potential name clash with existing TeX Live or MiKTeX binaries and symbolic links. In this particular scenario, make sure to inspect the command location as a means to ensure a correct execution. To this end, run the following command in the terminal:

$ which arara
/usr/local/bin/arara

The which command shows the full path of the executable name provided as parameter. This particular utility does this by searching for an executable or script in the directories listed in the PATH environment variable. Be mindful that aliases and shell functions are listed as well.