summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/arara/chapters/deploying.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/support/arara/chapters/deploying.tex')
-rw-r--r--Master/texmf-dist/doc/support/arara/chapters/deploying.tex223
1 files changed, 223 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/arara/chapters/deploying.tex b/Master/texmf-dist/doc/support/arara/chapters/deploying.tex
new file mode 100644
index 00000000000..533b883ee2b
--- /dev/null
+++ b/Master/texmf-dist/doc/support/arara/chapters/deploying.tex
@@ -0,0 +1,223 @@
+% !TeX root = ../arara-manual.tex
+\chapter{Deploying the tool}
+\label{chap:deployingthetool}
+
+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 Section~\ref{sec:compilingthetool}, on page~\pageref{sec:compilingthetool}).
+
+\begin{messagebox}{No more installers}{araracolour}{\icok}{white}
+Be mindful that, from version 4.0 on, the team decided to not release cross-platform installers any more. Our tool is available off the shelf on all major \TeX\ distributions, including \TeX\ Live and MiK\TeX, which makes manual installation unnecessary given the significant coverage of such distributions. Chances are you already have \arara\ in your system!
+\end{messagebox}
+
+\section{Directory structure}
+\label{sec:directorystructure}
+
+From the early development stages, our tool employs a very straightforward directory structure. In short, we provide the \abox[araracolour]{ARARA\_HOME} alias to the directory path in which the \rbox[araracolour]{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 \abox[araracolour]{rules/} available from the same level. This directory contains all rules specified in the \gls{YAML} format, as seen in Section~\ref{sec:rule}, on page~\pageref{sec:rule}. The structure overview is presented as follows.
+
+\vspace{1em}
+
+{\centering\begin{forest}
+for tree={
+ grow'=0,
+ edge={araracolour},
+ anchor=base west
+},
+forked edges,
+[{\abox[araracolour]{ARARA\_HOME}}
+ [{\rbox[araracolour]{arara.jar}}]
+ [{\abox[araracolour]{rules/}},s sep=1mm
+ [{\rbox[araracolour]{animate.yaml}}]
+ [{\rbox[araracolour]{bib2gls.yaml}}]
+ [{\color{araracolour}\ldots},no edge]
+ [{\rbox[araracolour]{xetex.yaml}}]
+ [{\rbox[araracolour]{xindy.yaml}}]
+ ]
+]
+\end{forest}\par}
+
+\vspace{1.4em}
+
+Provided that this specific directory structure is honoured, the tool is ready for use off the shelf. In fact, the official \arara\ package available in the \href{https://github.com/cereda/arara/releases}{release section} of our project repository, as well as the \href{https://bintray.com/cereda/arara}{Bintray} software distribution service, exactly mirrors this structure. Once the package is properly downloaded, we simply need to extract it into a proper \abox[araracolour]{ARARA\_HOME} location.
+
+\section{Defining a location}
+\label{sec:definingalocation}
+
+First and foremost, we need to obtain \rbox{arara-4.0.zip} from either our project repository at GitHub or at the Bintray service mirror. As the name indicates, this is a compressed file format, so we need to extract it into a proper location. Run the following command in the terminal:
+
+\begin{codebox}{Terminal}{teal}{\icnote}{white}
+$ unzip arara-4.0.zip
+\end{codebox}
+
+As a result of the previous command, we obtained a directory named \abox[araracolour]{arara} with the exact structure presented in Section~\ref{sec:directorystructure} in our working directory. Now we need to decide where \arara\ should reside in our system. For example, I usually deploy my tools inside the \abox[araracolour]{/opt/paulo} 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):
+
+\begin{codebox}{Terminal}{teal}{\icnote}{white}
+$ mv arara /opt/paulo/
+\end{codebox}
+
+The tool has found a comfortable home inside my system! Observe that the full path of the \abox[araracolour]{ARARA\_HOME} reference points out to \abox[araracolour]{/opt/paulo/arara} since this is my deployment location of choice. The resulting structure overview, from the root directory, is presented as follows:
+
+\vspace{1em}
+
+{\centering\begin{forest}
+for tree={
+ grow'=0,
+ edge={araracolour},
+ anchor=base west
+},
+forked edges,
+[{\abox[araracolour]{/}},s sep=1mm
+ [{\abox[araracolour]{bin/}}]
+ [{\abox[araracolour]{boot/}}]
+ [{\color{araracolour}\ldots},no edge]
+ [{\abox[araracolour]{opt/}},s sep=1mm
+ [{\abox[araracolour]{paulo/}}
+ [{\abox[araracolour]{arara/}}
+ [{\rbox[araracolour]{arara.jar}}]
+ [{\abox[araracolour]{rules/}},s sep=1mm
+ [{\rbox[araracolour]{animate.yaml}}]
+ [{\rbox[araracolour]{bib2gls.yaml}}]
+ [{\color{araracolour}\ldots},no edge]
+ [{\rbox[araracolour]{xetex.yaml}}]
+ [{\rbox[araracolour]{xindy.yaml}}]
+ ]
+ ]
+ ]
+ [{\color{araracolour}\ldots},no edge]
+ [{\abox[araracolour]{texbin/}}]
+ ]
+ [{\color{araracolour}\ldots},no edge]
+ [{\abox[araracolour]{usr/}}]
+ [{\abox[araracolour]{var/}}]
+]
+\end{forest}\par}
+
+\vspace{1.4em}
+
+If the tool was built from source (as indicated in Section~\ref{sec:compilingthetool}, on page~\pageref{sec:compilingthetool}), 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):
+
+\begin{codebox}{Terminal}{teal}{\icnote}{white}
+$ java -jar /opt/paulo/arara/arara.jar
+ __ _ _ __ __ _ _ __ __ _
+ / _` | '__/ _` | '__/ _` |
+| (_| | | | (_| | | | (_| |
+ \__,_|_| \__,_|_| \__,_|
+
+arara 4.0 (revision 1)
+Copyright (c) 2012-2018, Paulo Roberto Massa Cereda
+All rights reserved
+
+usage: arara [file [--dry-run] [--log] [--verbose | --silent]
+ [--timeout N] [--max-loops N] [--language L]
+ [ --preamble P ] [--header] | --help | --version]
+ -h,--help print the help message
+ -H,--header extract directives only in the file header
+ -l,--log generate a log output
+ -L,--language <code> set the application language
+ -m,--max-loops <number> set the maximum number of loops
+ -n,--dry-run go through all the motions of running a
+ command, but with no actual calls
+ -p,--preamble <name> set the file preamble based on the
+ configuration file
+ -s,--silent hide the command output
+ -t,--timeout <number> set the execution timeout (in milliseconds)
+ -V,--version print the application version
+ -v,--verbose print the command output
+\end{codebox}
+
+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.
+
+\section{Tool wrapping}
+\label{sec:toolwrapping}
+
+\arara\ is now properly deployed in our system, but we still need to provide the full path of \rbox{arara.jar} to the Java virtual machine in order to make our tool work. This section provides three approaches regarding the creation of a \emph{wrapper}, a shell feature that embeds a system command or utility, that accepts and passes a set of parameters to that command.
+
+\begin{description}
+\item[shell alias] An \emph{alias} is a command available in various shells which enables a replacement of a word by another string. It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command. In order to create a shell alias for our tool, open \rbox{.bashrc} (a script that is executed whenever a new terminal session starts in interactive mode) in your favourite editor and add the following line, preferably at the end:
+
+\begin{codebox}{Source code}{teal}{\icnote}{white}
+alias arara='java -jar /opt/paulo/arara/arara.jar'
+\end{codebox}
+
+Save the file and restart your terminal. It is important to observe that the given full path must be properly quoted if it contains spaces. There is no need to provide explicit parameters, as an alias simply acts as an inline string replacement.
+
+\item[shell function] A \emph{shell function} is, as the name suggests, a subroutine, a code block that implements a set of operations as a means to performs a specified task. In order to create a shell function for our tool, open \rbox{.bashrc} (a script that is executed whenever a new terminal session starts in interactive mode) in your favourite editor and add the following line, preferably at the end:
+
+\begin{codebox}{Source code}{teal}{\icnote}{white}
+arara() {
+ java -jar /opt/paulo/arara/arara.jar "$@"
+}
+\end{codebox}
+
+Save the file and restart your terminal. It is important to observe that the given full path must be properly quoted if it contains spaces. Note that the \rbox{\$@} symbol used in the function body represents a special shell variable that stores all the actual parameters in a list of strings.
+
+\begin{messagebox}{Alias or function?}{attentioncolour}{\icattention}{black}
+In general, an alias should effectively not do more than change the default options of a command, as it constitutes a mere string replacement. A function should be used when you need to do something more complex than an alias. In our particular case, as the underlying logic is pretty straightforward, both approaches are valid.
+\end{messagebox}
+
+\item[script file] A \emph{script} is a computer program designed to be run by an interpreter. In our context, the script merely sets up the environment and runs a system command. In order to provide a script for our tool, open your favourite editor and create the following file called \rbox{arara} (no extension):
+
+\begin{ncodebox}{Source file}{teal}{\icnote}{white}{arara}
+#!/bin/bash
+jarpath=/opt/paulo/arara/arara.jar
+java -jar "$jarpath" "$@"
+\end{ncodebox}
+
+It is important to observe that the given full path must be properly quoted if it contains spaces. Note that the \rbox{\$@} symbol used in the script body represents a special shell variable that stores all the actual parameters in a list of strings. This script file will act as the entry point for our tool. Now, we need to make it executable (i.e, set the corresponding execute permission) by running the following command in the terminal:
+
+\begin{codebox}{Source code}{teal}{\icnote}{white}
+$ chmod +x arara
+\end{codebox}
+
+Now we need to move this newly executable script file to one of the directories set forth in the \abox[araracolour]{PATH} environment variable, where executable commands are located. For illustrative purposes only, let us move the script file to the \abox[araracolour]{/usr/local/bin/} directory, a location originally designed for programs that a normal user may run. Run the following command in the terminal (note the need for superuser privileges):
+
+\begin{codebox}{Source code}{teal}{\icnote}{white}
+$ sudo mv arara /usr/local/bin/
+\end{codebox}
+
+Alternatively, the script can be placed inside a special directory named \abox[araracolour]{bin/} from the home directory of the current user, which is usually added by default to the system path. Observe that, in this particular case, superuser privileges are not required, as the operation is kept at the current user level. Run the following command in the terminal instead (please note that the \rbox{\textasciitilde} symbol is a shell feature called \href{http://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html}{tilde expansion} and refers to the home directory of the current user):
+
+\begin{codebox}{Source code}{teal}{\icnote}{white}
+$ mv arara ~/bin/
+\end{codebox}
+
+There is no need to restart your terminal, as the reference becomes available as soon as it is moved to the new location. Note that a shell script can provide a convenient variation of a system command where special environment settings, command options, or post-processing apply automatically, but in a way that allows the new script to still act as a fully normal Unix command.
+\end{description}
+
+Regardless of the adopted approach, there should be an \rbox{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:
+
+\begin{codebox}{Terminal}{teal}{\icnote}{white}
+$ arara
+ __ _ _ __ __ _ _ __ __ _
+ / _` | '__/ _` | '__/ _` |
+| (_| | | | (_| | | | (_| |
+ \__,_|_| \__,_|_| \__,_|
+
+arara 4.0 (revision 1)
+Copyright (c) 2012-2018, Paulo Roberto Massa Cereda
+All rights reserved
+
+usage: arara [file [--dry-run] [--log] [--verbose | --silent]
+ [--timeout N] [--max-loops N] [--language L]
+ [ --preamble P ] [--header] | --help | --version]
+ -h,--help print the help message
+ -H,--header extract directives only in the file header
+ -l,--log generate a log output
+ -L,--language <code> set the application language
+ -m,--max-loops <number> set the maximum number of loops
+ -n,--dry-run go through all the motions of running a
+ command, but with no actual calls
+ -p,--preamble <name> set the file preamble based on the
+ configuration file
+ -s,--silent hide the command output
+ -t,--timeout <number> set the execution timeout (in milliseconds)
+ -V,--version print the application version
+ -v,--verbose print the command output
+\end{codebox}
+
+It is important to observe that the wrapper initiative presented in this section might cause a potential name clash with existing \TeX\ Live or MiK\TeX\ 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:
+
+\begin{codebox}{Terminal}{teal}{\icnote}{white}
+$ which arara
+/usr/local/bin/arara
+\end{codebox}
+
+The \rbox{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 \abox[araracolour]{PATH} environment variable. Be mindful that aliases and shell functions are listed as well. \ No newline at end of file