Automatic compiler and Dropbox uploader for LaTeX projects.
Shell Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Gemfile
README.md
dbupload.rb
install
latex_cd.sublime-project
latexcd
latexcd.conf
pullandbuild.sh
uptodatecheck.latexmkrc
webhook.rb
webhook_start

README.md

Continuous compilation and deployment of LaTeX files

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 with latexmk (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 script pullandbuild.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.

Requirements & installation

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).

  1. 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.
  2. 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.
  3. Get the Ruby executable with rvmsudo rvm install 2.2.1.
  4. Create the latexcd user: sudo useradd -m latexcd.
  5. Add the latexcd user to the rvm group: sudo usermod -a -G rvm latexcd.
  6. 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.
  7. Run the service with sudo service latexcd start.
  8. Execute latexcd at boot with sudo update-rc.d latexcd defaults.
  9. (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.

Collaboration

Just send a pull request :)