Transmission Line Noise

A brief intro­duc­tion to Cap­puc­cino tools

Sun, May 16, 2010

Cap­puc­cino is an appli­ca­tion frame­work mod­elled on Objective-c but using Objective-j. It allows for web sites or appli­ca­tion to be built using the cap­puc­cino frame­work and then ‘com­plied’ to javascript.

Cap­puc­cino is rel­a­tively new and so is under­go­ing rapid devel­op­ment and improve­ment espe­cially with regard to tools to hadle the instal­la­tion, build and deploy­ment of cappuccino.

The cur­rent release of Cap­puc­cino is 0.8.1 and since release 0.7 the tools have changed some­what. (I will release a post on the ear­lier tools soon). As might be expected the tools are get­ting more sophis­ti­cated so if you can upgrade your projects from any ear­lier ver­sion it will make you a lot more productive.

Please note all of the fol­low­ing is being done on a Mac. If you are on Win­dows then you prob­a­bly need to bin it and get a Mac as opposed to strug­gling along and fight­ing the OS you have got.

Instal­la­tion — Obvi­ously this step is required to even have Cap­puc­cino and tools. Down­load from the Cap­puc­cino web site and install. There are two ways to do this. If you have the tool called Tusk he pack­age man­ager and vir­tual envi­ron­ment tool) installed then run:

tusk install --force cappuccino

if not there is a boot­strap script in the Cap­puc­cino down load called boot​strap​.sh. run this to install Nar­whal and Cappuccino:

To create Starter/

capp — capp is the project builder. Once you have Cap­puc­cino installed then use capp from the com­mand line to build a project. (capp details)

capp [—version] COMMAND [ARGS]

The com­mands and the argu­ments allow you var­i­ous option in the build.

–l will allow you to point at a cen­tral frame­work install instead of installing for each project. This way you can update the frame­work for all projects rather than one by one.

–t  lets you fde­fine the tem­plate used Application, ThemeDescriptor, NibApplication etc.

jake — jake is a generic build tool descended from Make, Rake, Ant, Scons, etc. It is writ­ten in JavaScript, run­ning on Nar­whal (jake details)

jake [OPTIONS] targets…

jake requires a Jake­file (which capp will cre­ate) defin­ing how jake builds. jake will build

  • “release”, “debug” – builds the release or debug ver­sions of the appli­ca­tion, respec­tively. The appli­ca­tion is placed in the Build sub­di­rec­tory of the project.
  • “run”, “run-release” – builds the debug or release ver­sion of the appli­ca­tion then opens it in your web browser (cur­rently Mac OS X only)
  • “deploy” – builds the release ver­sion of the appli­ca­tion then runs press on it to fur­ther opti­mize it.

jake will out­put .sj files and then you can use

press — press is a tool to ana­lyze and strip unused files from a Cap­puc­cino project’s .sj bundles.


In a default appli­ca­tion “press” is able to reduce the size of the code deliv­ered to the client by approx­i­mately 30%. Com­bined with enabling Gzip encod­ing on your web­server you can sig­nif­i­cantly reduce the size and thus load time of your application.

After press use flatten

flat­ten — flat­ten inlines all code into one or more JavaScript files, allow­ing cross-domain load­ing as well as elim­i­nat­ing dynamic eval­u­a­tion (eval, etc)


Some peo­ple also find the load per­for­mance of a “flat­tened” appli­ca­tion to be bet­ter, in par­tic­u­lar when using the split option. Using the “—split N” argu­ment will split the script file into N files, which allows the browser to down­load them in par­al­lel. Browsers can typ­i­cally down­load 2 to 6 files in par­al­lels, so that would be a good range to try for the “—split” para­me­ter. The split file could then be stored on a CDN such as Ama­zons AWS to sig­nif­i­cantly improve performance.

In sum­mary the process is to install Cap­puc­cino. Cre­ate your appli­ca­tion frame­work with capp. Build you app. THen com­pile and deploy with jake, press and flatten.

Don’t for­get to use an code repos­i­tory. SVN if you have to or GIT and prefer­ably Mer­cu­r­ial. Then some­thing like Hud­son for con­tin­u­ous inte­gra­tion or just roll your own at the com­mand line with the above tools.

p.s. Why the Mac? Well objective-j matched the objective-c and cocoa mod­els. But para­dox­i­cally while Cap­puc­cino is lead­ing edge Web 2.5 it’s tools are def­i­nitely old school CLI (com­mand line inter­face). So it will pay you to learn how to open the ter­mi­nal on the Mac and use it.