schmittjoh/twig.js — pull request #56 by h2s (2013-03-18 23:23:59+00:00)
Title: Introduce a Makefile to reduce configuration and setup, and streamline building

I understand why this project uses Closure Compiler, and I think it's probably quite a worthwhile performance boost. However, I think the recompilation step is a little clumsy in its current form and this is preventing people from contributing to the project as effectively as they could be.

This commit removes the need for developers to go hunting for a copy of plovr.jar and then configure $_SERVER['PLOVR_BIN'] in ./config.php. The Makefile knows where to get plovr, installs it to a known location, and invokes it in that location when building the assets.

It'll only attempt to fetch plovr if it's not already present at bin/plovr. Anybody with edge-case needs who wants a specific version of plovr.jar can cope by placing their version in bin/plovr, without impacting those who simply want to get on with building the assets.

Here's what happens when you type `make build` for the first time:

h2s@blueprint:~/src/twig.js [easier-building] $ make build
rm -f twig.js
rm -f twig.dev.js
wget "http://plovr.googlecode.com/files/plovr-eba786b34df9.jar" -O bin/plovr
--2013-03-18 23:19:02-- http://plovr.googlecode.com/files/plovr-eba786b34df9.jar
Resolving plovr.googlecode.com (plovr.googlecode.com)... 173.194.67.82, 2a00:1450:400c:c05::52
Connecting to plovr.googlecode.com (plovr.googlecode.com)|173.194.67.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16947179 (16M) [application/x-java-archive]
Saving to: ‘bin/plovr’

100%[==============================================================================================>] 16,947,179 809KB/s in 21s

2013-03-18 23:19:24 (792 KB/s) - ‘bin/plovr’ saved [16947179/16947179]

java -jar bin/plovr build Resources/config/compile.js
0 error(s), 0 warning(s), 95.80% typed
java -jar bin/plovr build Resources/config/compile_dev.js
0 error(s), 0 warning(s), 95.80% typed

And here's what happens on subsequent builds:

h2s@blueprint:~/src/twig.js [easier-building] $ make build
rm -f twig.js
rm -f twig.dev.js
java -jar bin/plovr build Resources/config/compile.js
0 error(s), 0 warning(s), 95.80% typed
java -jar bin/plovr build Resources/config/compile_dev.js
0 error(s), 0 warning(s), 95.80% typed

Sound good?