This is a small set of scripts to enable continuous compilation and deployment of LaTeX files in a GitHub repository. This is what this thing does:
- Start a Ruby/Sinatra server listening on port 5467.
- When someone requests yourip:5467/payload, the build system will start. Beware: there isn't any kind of control, you're responsible of securing and rate-limiting your server, if you need it.
- The build system checks out the latest changes from your repository.
- If your repository has packages that have to be installed or any kind of similar prebuild step, the function
packages_install
will launch if there are changes in that directory. - The build system compiles every
.tex
file in second level folders withlatexmk
(that is, repo/doc/man.tex will be built, but not repo/first.tex nor repo/doc/aux/aux.tex). Options for compilation are available in the scriptpullandbuild.sh
. - Whenever a PDF file is updated, it will be uploaded to the folders you specify in the
dbupload.rb
script (but first you have to get an access token from Dropbox and save it in the dbtoken file, see dropbox-sdk gem for details on how to do it). - If GHI is present and configured, the script will report build failures and conflict markers sending an issue to the Github repository.
latex_cd
requires a working Ruby installation for the Sinatra server and for the Dropbox uploader. Ruby installations are tricky if you want to do it the right way, so here're some guidelines to install Ruby and latex_cd as a service in your system (Debian based).
- Install RVM system-wide. Follow instructions in the RVM site, see multi-user install, but basically you should execute
curl -sSL https://get.rvm.io | sudo bash -s stable
. - Add yourself to the rvm group for testing:
sudo usermod -a -G rvm $USER
. Log out and log in again to load the environment variables. - Get the Ruby executable with
rvmsudo rvm install 2.2.1
. - Create the latexcd user:
sudo useradd -m latexcd
. - Add the latexcd user to the rvm group:
sudo usermod -a -G rvm latexcd
. - Execute the install script with
sudo ./install
. It will install the application to your chosen prefix (see latexcd.conf file) and install all necessary dependencies. - Run the service with
sudo service latexcd start
. - Execute latexcd at boot with
sudo update-rc.d latexcd defaults
. - (Optional for issue reporting) Configure GHI in the repo (/opt/latexcd/latex_cd/repo). Remember to prefix the executions with `rvm 2.2.1 do ghi ..." to avoid possible problems.
Just send a pull request :)