<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cappuccino Blog &#187; Tools</title>
	<atom:link href="http://cappuccino.org/discuss/category/cappuccino/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://cappuccino.org/discuss</link>
	<description>Home of Cappuccino and Objective-J</description>
	<lastBuildDate>Thu, 17 Nov 2011 00:42:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Cappuccino 0.8 Tools</title>
		<link>http://cappuccino.org/discuss/2010/04/12/cappuccino-0-8-tools/</link>
		<comments>http://cappuccino.org/discuss/2010/04/12/cappuccino-0-8-tools/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 18:40:47 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=601</guid>
		<description><![CDATA[Cappuccino comes with a comprehensive set of tools for developing, debugging, optimizing, and deploying your Cappuccino applications. Those who have been following Cappuccino since the 0.7 release will notice some changes in the tools. The most important being that Cappuccino's tools are now written entirely in JavaScript and Objective-J.]]></description>
			<content:encoded><![CDATA[<p>Cappuccino comes with a comprehensive set of tools for developing, debugging, optimizing, and deploying your Cappuccino applications. Those who have been following Cappuccino since the 0.7 release will notice some changes in the tools. The most important being that Cappuccino&#8217;s tools are now written entirely in JavaScript and Objective-J.</p>
<p>The 0.7 release used <a href="http://rake.rubyforge.org/">Rake</a>, a Ruby build tool similar to &#8220;make&#8221;, to manage the build process of Cappuccino applications, as well as Cappuccino and Objective-J itself. In an effort to speed up the tools, reduce the number of dependencies, and allow us to focus on a single language family, we have replaced the Rake dependency with a simple port of Rake for JavaScript, aptly named <a href="http://github.com/280north/jake">Jake</a>. Since Jake is written in JavaScript, other JavaScript and Objective-J build tools like the Objective-J compiler can run within the same process, speeding up the build time significantly.</p>
<p>Additionally, we have expanded the command-line/server-side JavaScript environment used for Cappuccino&#8217;s tools, now available as a separate project called <a href="http://narwhaljs.org/">Narwhal</a>. Narwhal aims to support the emerging <a href="http://commonjs.org/">CommonJS</a> module and standard library specifications on multiple JavaScript engines.</p>
<p>We started working with the <a href="http://www.mozilla.org/rhino/">Rhino</a> engine, since the existing build tools were built on Rhino, and have recently added support for the JavaScriptCore / SquirrelFish engine. The performance of Narwhal on JavaScriptCore is an order of magnitude faster than Rhino, vastly improving build times. Currently &#8220;narwhal-jsc&#8221; supports Mac OS X, but other platform support is in progress.</p>
<p>Another major change was the refactoring of the <a href="http://wiki.github.com/280north/cappuccino/press">&#8220;press&#8221;</a> tool, which attempts to strip unnecessary files from your application bundle. As part of that refactoring we moved the &#8220;&#8211;flatten&#8221; feature, which inlines all code and files into one or more JavaScript files, into a separate tool, unsurprisingly called <a href="http://wiki.github.com/280north/cappuccino/flatten">&#8220;flatten&#8221;</a>. Flatten now supports splitting your application into multiple files which will be downloaded by the browser in parallel, via the &#8220;&#8211;split N&#8221; option.</p>
<p>For more information on all of these tools, check out the <a href="http://wiki.github.com/280north/cappuccino/Tools">Tools</a> wiki page.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2010/04/12/cappuccino-0-8-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Just One File with Cappuccino 0.8</title>
		<link>http://cappuccino.org/discuss/2009/11/11/just-one-file-with-cappuccino-0-8/</link>
		<comments>http://cappuccino.org/discuss/2009/11/11/just-one-file-with-cappuccino-0-8/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 10:44:24 +0000</pubDate>
		<dc:creator>tolmasky</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=498</guid>
		<description><![CDATA[The entire 280 crew just got back from an awesome time at JSConf EU in Berlin, where we got to show off some of the cool new developments coming with Cappuccino 0.8. I wanted to take the time to share one in particular in more depth here: image spriting. The Problem with Spriting Image spriting [...]]]></description>
			<content:encoded><![CDATA[<p>The entire 280 crew just got back from an awesome time at <a href = "http://jsconf.eu/2009/">JSConf EU</a> in Berlin, where we got to show off some of the cool new developments coming with Cappuccino 0.8. I wanted to take the time to share one in particular in more depth here: <strong>image spriting</strong>.</p>
<h3>The Problem with Spriting</h3>
<p>Image spriting is the act of taking all the images in your app (or framework, or library, or whatever) and combining them down to one single image. This has the advantages of being smaller (since each individual image has overhead associated with the format), as well as allowing you to grab it from your server with one request:</p>
<p><center><img style = "border:1px solid black;" src="http://cappuccino.org/discuss/wp-content/uploads/2009/11/Screen-shot-2009-11-11-at-1.55.50-AM.png" alt="Traditional Spriting" title="Traditional Spriting" width="471" height="304" class="size-full wp-image-549" /></center></p>
<p>This is faster in an absolute sense, but even more so psychologically since it allows you to show the contents of your app faster without having all the images &#8220;flash in&#8221; later. Cappuccino currently uses a similar technique with the source code in your application: concatenating it all together and minifying it, but up until now we&#8217;ve had no automatic, or built-in, support for spriting, you&#8217;ve instead had to do it entirely yourself. And truthfully, no framework has really good support for this.</p>
<p>This is because the fundamental problem with spriting today is that the process isn&#8217;t really automated and the results are thus subpar. Sure, there are scripts which will put images together for you, but they all require you to configure them first and to update them as your use of the images in question changes. This is because traditional spriting is dependent on <strong>how</strong> you use your images. Whether you choose to repeat, stretch, scale, or even draw to a canvas affects which images can be sprited together, and even which can&#8217;t be sprited at all. This has a number of unfortunate side effects:</p>
<ul>
<li><strong>Rarely do you actually end up with just one image:</strong> Instead, you can end up with 2, 3, or even more. This is because images have to be &#8220;grouped&#8221; by their use. For example, vertically repeating images can be sprited together, but not with horizontally repeating images.</li>
<li><strong>You may have to actually change your code:</strong> Since images are being mutated, the code you write needs to take into account these new images. If you are lucky you have a system that is relatively good at doing this for you. However, if you decide to use an image in a new way (such as drawing it to a canvas), you either have to update your configuration files or choose to code it differently. This is easy to forget.</li>
<li><strong>Your images are still shipped separately from your code:</strong> Even in the best case where you are lucky enough to successfully sprite all your images together, you still have to wait for them separately from when your code is ready, potentially leading to noticeable delays from latency, or a &#8220;flash in&#8221; effect.</li>
<li><strong>Inflexible due to loss of data:</strong> There exist cases where your code is meant to be used by others, such as with libraries and frameworks. In this case, images can&#8217;t be used in any way other than how you intended them to if they are sprited, because the original images are gone or would require a redundant second download.
</li>
</ul>
<p>So unfortunately there is currently no good one-size-fits-all solution for image spriting the way there is with &#8220;code spriting&#8221;. All of them require the user to actually become involved in the optimization process, and even still can produce less than stellar results. This is clearly not a solution that can scale, and most everyone agrees to this.</p>
<p>But we&#8217;re hoping to change this with the release of Cappuccino 0.8, as we&#8217;re introducing a whole new, completely cross-platform, way to sprite: base64 images. By encoding images as base64, we create a lossless text representation of images, allowing us not only to use them in whatever way we please, but to actually ship them <strong>with</strong> the code:</p>
<p>There are many advantages to this:</p>
<ul>
<li><strong>One file, guaranteed:</strong> All images can always be sprited together regardless of how you plan to use them, and can be included with the actual source code. This has the added benefit that gzip can work its magic on the entirety of your web app as one, producing better results.</li>
<li><strong>No need to ever modify code or configuration files:</strong> Since we&#8217;ve eliminated the ambiguous part of spriting images, the Cappuccino build tools are able to perform this optimization on your code automatically without tedious configuration files or having to &#8220;learn&#8221; how to sprite.</li>
</ul>
<h3>Yes, This Works in IE 6 and 7.</h3>
<p>I&#8217;m sure most people are wondering how we are pulling this off in versions of IE before 8, since they do not support data URLs. Notice that earlier I didn&#8217;t specifically mention data URLs though, I instead only referred to the more broad technology of base64 images. As it turns out, IE has had support for base64 images since version 6 (!) with a little-known technology called MHTML. MHTML allows you place all your resources in one &#8220;resources&#8221; file, which incidentally can be any file in your website&#8230; including the same file that contains all your code.</p>
<p>Cappuccino is already smart enough to be able to automatically download and use different code depending on what browser is being used (and with <strong>no</strong> server configuration), so we now simply ship data URL versions of this technique to modern browsers, and MHTML versions to older copies of IE:<br />
<center><img style = "border:1px solid black;" src="http://cappuccino.org/discuss/wp-content/uploads/2009/11/Screen-shot-2009-11-11-at-1.57.08-AM.png" alt="Cappuccino Spriting" title="Cappuccino Spriting" width="464" height="303" class="aligncenter size-full wp-image-546" /></center></p>
<p>This is a very exciting feature for us. This has been a weak point in Cappuccino and its nice to finally have a solution that not only works, but is drop dead simple to use. Our tests have been proven incredibly promising, giving us the fastest load times we&#8217;ve ever seen with Cappuccino, and absolutely fantastic perceived speed as well. Our tools have all been honed to use this at every level: Apps, frameworks, and themes will automatically sprite your images for you.</p>
<p>This is just one of the many enhancements coming with Cappuccino 0.8, and the best part is as usual you won&#8217;t have to change a single line of code to get all the benefits.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2009/11/11/just-one-file-with-cappuccino-0-8/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Push with Cappuccino and Tornado</title>
		<link>http://cappuccino.org/discuss/2009/10/05/push-with-cappuccino-and-tornado/</link>
		<comments>http://cappuccino.org/discuss/2009/10/05/push-with-cappuccino-and-tornado/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 13:35:52 +0000</pubDate>
		<dc:creator>tolmasky</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=463</guid>
		<description><![CDATA[Elias Klughammer has taken the time to put together a demo of using the new Tornado web server to bring push to Cappuccino applications. Tornado is a brand new non-blocking server recently open sourced by Facebook which was built to deal with the high intensity demands of FriendFeed. When combined with Cappuccino, the results are [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/eliasklughammer">Elias Klughammer</a> has taken the time to put together a demo of using the new <a href="http://www.tornadoweb.org/">Tornado web server</a> to bring push to Cappuccino applications. Tornado is a brand new non-blocking server recently open sourced by Facebook which was built to deal with the high intensity demands of <a href = "http://friendfeed.com">FriendFeed</a>. When combined with Cappuccino, the results are pretty impressive:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/1MPTxS9uyT4&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1MPTxS9uyT4&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Check out the project on <a href="http://github.com/eliasklughammer/Cappuccino-X-Tornado">GitHub</a> to start hacking on your own real time Cappuccino services!</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2009/10/05/push-with-cappuccino-and-tornado/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Announcing Atlas</title>
		<link>http://cappuccino.org/discuss/2009/02/28/announcing-atlas/</link>
		<comments>http://cappuccino.org/discuss/2009/02/28/announcing-atlas/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 03:55:48 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[280 North]]></category>
		<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Objective-J]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[280north]]></category>
		<category><![CDATA[atlas]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=301</guid>
		<description><![CDATA[Over at 280 North, we announced our next product, called Atlas, at the Future of Web Apps conference in Miami this week. Atlas is a visual development tool for creating web applications using the Cappuccino framework. The best way to explain Atlas is to show it: Think Vitamin has an article discussing Atlas in more [...]]]></description>
			<content:encoded><![CDATA[<p>Over at <a href="http://280north.com">280 North</a>, we announced our next product, called Atlas, at the <a href="http://events.carsonified.com/fowa">Future of Web Apps</a> conference in Miami this week.</p>
<p>Atlas is a visual development tool for creating web applications using the <a href="http://cappuccino.org">Cappuccino</a> framework. The best way to explain Atlas is to show it:</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="545" height="361" id="viddler_1db9bf4d"><param name="wmode" value="transparent" /><param name="movie" value="http://www.viddler.com/simple/1db9bf4d/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/simple/1db9bf4d/" width="545" height="361" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_1db9bf4d" wmode="transparent"></embed></object></p>
<p><a href="http://thinkvitamin.com/features/atlas-under-the-hood/">Think Vitamin has an article</a> discussing Atlas in more detail.</p>
<p>We&#8217;re really excited about the ways Atlas could change the process of developing web applications. Atlas will allow developers to worry less about boilerplate user interface and glue code, just as the Cappuccino framework gives developers many common features expected by users, letting them focus on the ones specific to their applications.</p>
<p>Furthermore, Atlas allows non-programmers, such as many graphic designers, to join in on the process of actually building an application, rather than just providing mockups that must then be replicated in code by a developer.</p>
<p>Atlas will be available this summer. Sign up for updates on <a href="http://280atlas.com">280atlas.com</a> and we&#8217;ll let you know of the progress on Atlas.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2009/02/28/announcing-atlas/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Cappuccino Tools: &#8220;bake&#8221;</title>
		<link>http://cappuccino.org/discuss/2008/10/29/cappuccino-tools-bak/</link>
		<comments>http://cappuccino.org/discuss/2008/10/29/cappuccino-tools-bak/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 10:06:21 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=135</guid>
		<description><![CDATA[Note: please check the tools page on the wiki for the latest information on Cappuccino&#8217;s tools. In the final installment of the Cappuccino Tool article series (for now), we cover &#8220;bake&#8221;, an automatic deployment tool. Writing a Cappuccino application does not require using &#8220;bake&#8221;, but can help with more advanced deployments. Introduction &#8220;bake&#8221; is somewhat [...]]]></description>
			<content:encoded><![CDATA[<p><i>Note: please check the <a href="http://wiki.github.com/280north/cappuccino/tools">tools page</a> on the wiki for the latest information on Cappuccino&#8217;s tools.</i></p>
<p>In the final installment of the Cappuccino Tool article series (for now), we cover &#8220;bake&#8221;, an automatic deployment tool. Writing a Cappuccino application does not require using &#8220;bake&#8221;, but can help with more advanced deployments.</p>
<h3>Introduction</h3>
<p>&#8220;bake&#8221; is somewhat analogous to <a href="http://www.capify.org/">Capistrano</a>, a deployment tool often used for deploying Ruby on Rails and other applications, but &#8220;bake&#8221; has several features specifically for deploying Cappuccino applications.</p>
<p>The basic idea behind &#8220;bake&#8221; is to assemble a complete deployable copy of your application by pulling the pieces from various places (Git, Subversion, and local or remote directories via rsync), building it, packing it up, and deploying it to your server(s).</p>
<p>One key feature of bake is the management of multiple deployments over time, which allows three things: <a href="http://en.wikipedia.org/wiki/Atomic_operation">atomic</a> deployments, keeping your client side code (the Cappuccino application) synchronized with your server side code, and enabling aggressive caching on all your static resources (code, images, etc). We&#8217;ll see later this is done by putting all the new resources in place, then &#8220;swinging&#8221; a single file, the index.html with a &lt;base&gt; tag.</p>
<p>&#8220;Atomic deployments&#8221; means that the deployment is updated to the new version in a single operation, which is either successful or not, nothing in between. Every client loading your application receives either the previous deployment, or the new deployment, but never a mixture of the two.</p>
<p>Keeping client code synchronized with server code is (sometimes) important for making sure users who have already loaded the application can continue using it even after you deploy a new version of the server side code that is incompatible with older versions of the client side code.</p>
<p>Aggressive caching of static resources reduces the load time of Cappuccino applications for repeat useres. This is possible because every resources URL is unique in each deployment, so we can set the &#8220;Expires&#8221; header far in the future (e.x. &#8216;Expires &#8220;Thu, 15 Apr 2010 20:00:00 GMT&#8221;&#8216;). While the actual file name is not unique (for example Objective-J/Objective-J.js), in the deployed application the <em>path</em> will be unique (www.yourserver.com/YourApp/1225273279/Objective-J/Objective-J.js where the version number changes for each deployment)</p>
<h3>Summary</h3>
<p>The configuration for a bake deployment is specified in a &#8220;bakefile&#8221;, which is in the JSON format with a structure like the following:</p>
<pre>
{
	"sources" : [
	    {
	        "type"    : "git",
	        "path"    : "git://github.com/280north/cappuccino.git",
	        "parts"   : [
    	        {
    	            "src"       :   "Objective-J",
    	            "dst"       :   "Frameworks/Objective-J",
    	            "build"     :   "ant -DBuild=BUILD_PATH",
    	            "copyFrom"  :   "Release/Objective-J"
    	        },
	            {
    	            "src"       :   "Foundation",
    	            "dst"       :   "Frameworks/Foundation",
    	            "build"     :   "steam build -c Release -b BUILD_PATH",
    	            "copyFrom"  :   "Release/Foundation"
	            },
        	    {
    	            "src"       :   "AppKit",
    	            "dst"       :   "Frameworks/AppKit",
    	            "build"     :   "steam build -c Release -b BUILD_PATH",
    	            "copyFrom"  :   "Release/AppKit"
        	    }
	        ]
	    },
	    {
	        "type"    : "rsync",
	        "path"    : "/Users/username/projects/NewApplication",
	        "parts"   : [
	            {
    	            "src"       :   "",
    	            "dst"       :   "Blah"
	            }
	        ]
	    },
	    {
	        "type"    : "svn",
	        "path"    : "https://svn.youserver.com/Project/trunk",
	        "parts"   : [
	            {
    	            "src"       :   "subdirectory",
    	            "dst"       :   "Something"
	            }
	        ]
	    }
	],
	"deployments" : [
	    { "host" : "deploy@myserver.com", "path" : "/var/www/mysite/public" }
	],
	"templateVars" : {
        "APPLICATION_NAME" : "My Application",
        "BACKGROUND_COLOR" : "black",
        "TEXT_COLOR" : "black"
	}
}
</pre>
<p>This bakefile contains three &#8220;sources&#8221;: a git repository, a local directory, and a svn repository. The git repository is the main <a href="http://github.com/280north/cappuccino/">Cappuccino git repository</a>, hosted on GitHub. You could replace this with a different branch if you needed a specific version, or even your own if you have one. This source contains three &#8220;parts&#8221;, Objective-J, AppKit, and Foundation. The &#8220;src&#8221; specifies where in the checkout the part is located, while &#8220;dst&#8221; specified where in the final built application it should be placed. You can optionally specify a &#8220;build&#8221; command, which is run from the specified &#8220;src&#8221; directory. This command should include the placeholder &#8220;BUILD_PATH&#8221;, which will be filled in by &#8220;bake&#8221; with the temporary directory where the build results are placed (equivalent to $STEAM_BUILD for any &#8220;steam&#8221; commands). Additionally, if you specify a &#8220;build&#8221; command you also need to specify a &#8220;copyFrom&#8221; parameter, which tells build the subdirectory of the build directory it should copy the built part from.</p>
<p>Once each piece of the application has been built it is copied to the appropriate subdirectory of a uniquely named (using the current Unix timestamp) &#8220;versioned&#8221; directory. Rather than deploying this versioned directory directly, it is placed within another directory which contains a special index.html file. This file includes a &lt;base&gt; tag that points to the versioned directory, which causes the browser to treat it as the base for all relative URLs, thus loading the correct version of all resources without requiring the application be located at a unique URL. &#8220;bake&#8221; will fill in &#8220;$VERSION&#8221; template variable in the base tag of the template with the correct</p>
<p>Additionally, &#8220;bake&#8221; will calculate the size of all code which needs to be loaded, in order to provide an accurate loading progress bar. The calculated size is inserted into the template variable &#8220;$FILES_TOTAL&#8221;. You can also specify other template variables such as &#8220;$APPLICATION_NAME&#8221;, &#8220;$BACKGROUND_COLOR&#8221;, and &#8220;$TEXT_COLOR&#8221; in the bakefile.</p>
<p>If you use your own template, the only required variable is the &#8220;$VERSION&#8221; one, but you can specify as many custom variables as you wish.</p>
<p>Finally, once the application has been built and assembled, it is optionally run through <a href="http://cappuccino.org/discuss/2008/10/21/cappuccino-tools-“press”/">&#8220;press&#8221;</a>, then gzipped. If the &#8220;&#8211;deploy&#8221; command line parameter was given then the gzipped application is transmitted to the deployment servers, un-gzipped, and copied to the deployment path using a specific sequence of command to ensure the deployment is atomic:</p>
<pre>
tar xzf 1225273279.tar.gz
mkdir -p /path/to/deployment
mv 1225273279/1225273279/ /path/to/deployment/1225273279
mv 1225273279/index.html path/to/deployment/index.html
rm "1225273279.tar.gz
rmdir 1225273279
cd /path/to/deployment
ln -nsf 1225273279 Current
</pre>
<p>(version &#8220;1225273279&#8243;, deplyoment directory &#8220;/path/to/deployment&#8221;)</p>
<p>One important thing to note about &#8220;bake&#8221; is that since the old deployment remains live (but hidden) if you deploy a fix for a security vulnerability you should manually purge all the old deployments from your server. If the change doesn&#8217;t introduce any incompatibilities between the server and client, you could set up a <a href="http://en.wikipedia.org/wiki/Rewrite_engine">rewrite rule</a> to direct all requests to the purged deployments to the latest, which is always symlinked to &#8220;Current&#8221;.</p>
<h3>Conclusion</h3>
<p>Once again I should stress that this tool is by no means required for writing a Cappuccino application. It was written to help deploy our production application, <a href="http://280slides.com">280 Slides</a>, but we have made it available for anyone who has similar deployment requirements. If it doesn&#8217;t quite fit your requirements, please feel free to suggest improvements, or even better, make improvements yourself and contribute them back!</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2008/10/29/cappuccino-tools-bak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cappuccino Tools: “press”</title>
		<link>http://cappuccino.org/discuss/2008/10/21/cappuccino-tools-%e2%80%9cpress%e2%80%9d/</link>
		<comments>http://cappuccino.org/discuss/2008/10/21/cappuccino-tools-%e2%80%9cpress%e2%80%9d/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 11:16:45 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[build tool]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=104</guid>
		<description><![CDATA[Note: please check the tools page on the wiki for the latest information on Cappuccino&#8217;s tools. In the third installment of the build tools series we tackle one of the most advanced build tools: &#8220;press&#8221;. Recall from the overview that &#8220;press&#8221; is a tool for stripping code and other optimizations. Additionally, it can convert an [...]]]></description>
			<content:encoded><![CDATA[<p><i>Note: please check the <a href="http://wiki.github.com/280north/cappuccino/tools">tools page</a> on the wiki for the latest information on Cappuccino&#8217;s tools.</i></p>
<p>In the third installment of the build tools series we tackle one of the most advanced build tools: &#8220;press&#8221;. Recall from the <a href="http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/">overview</a> that &#8220;press&#8221; is a tool for stripping code and other optimizations. Additionally, it can convert an entire Objective-J application into a single pure JavaScript file, which we&#8217;ll see can be useful.</p>
<h3>press</h3>
<p>The primary goal of &#8220;press&#8221; is to strip unused code from your application and frameworks and perform other optimizations. It needs to know about the entire application, including your application code and the Cappuccino frameworks, in order to determine the dependencies and remove unused files. It is called with two parameters, the path to your application, and the output directory:</p>
<p><code>press root_directory output_directory</code></p>
<p>This will run &#8220;press&#8221; on your application located at root_directory, and output a similar but smaller version (with unused files stripped) at output_directory.</p>
<p>Additionally, there are several useful options:</p>
<ul>
<li><em>&#8208;&#8208;main path</em>: The relative path (from root_directory) to the main file (default: &#8216;main.j&#8217;)</li>
<li><em>&#8208&#8208frameworks path</em>: The relative path (from root_directory) to the frameworks directory (default: &#8216;Frameworks&#8217;)</li>
<li><em>&#8208&#8208png</em>: Run pngcrush on all PNGs (pngcrush must be installed!)</li>
<li><em>&#8208&#8208flatten</em>: Flatten all code into a single Application.js file and attempt to add script tag to index.html (useful for Adobe AIR and CDN deployment)</li>
<li><em>&#8208&#8208nostrip</em>: Don&#8217;t strip any files. Mostly useful for debugging.</li>
</ul>
<h3>&#8208&#8208flatten</h3>
<p>The most interesting of these options is &#8220;&#8208&#8208flatten&#8221;, which converts your application into a single pure JavaScript file that can be imported with a standard &#8220;script&#8221; tag. While the Objective-J load system is great in most scenarios, there are currently a few limitations that a pure JavaScript file helps overcome. Namely that the load system doesn&#8217;t work in Adobe AIR due to strict security restrictions, and the load system doesn&#8217;t work across domains, such as with a CDN, also due to browser security restrictions. By flattening all Objective-J code into a JavaScript file, we can use a standard script tag to load our application, which works cross-domain and in Adobe AIR.</p>
<h3>Internals</h3>
<p>If you&#8217;re interested in how &#8220;press&#8221; works, read on. It starts by loading your application while noting which global variables are defined in each file. It then &#8220;walks&#8221; along the dependency &#8220;graph&#8221;, including every imported file, with one important exception: framework imports like &#8220;import &lt;AppKit/AppKit.j&gt;&#8221; and &#8220;import &lt;Foundation/Foundation.j&gt;&#8221; are ignored since these types of imports would result in the entire framework (including unused files) being imported. Instead, press looks at the global dependencies, and only keeps the files that are referenced by any other file that has been imported.</p>
<h3>Conclusion</h3>
<p>&#8220;press&#8221; is a already a great tool, but there is much room for improvement. In the future we would like to add finer-granularity code stripping, such as method-level rather than file-level. Additionally, we&#8217;re working on an automatic <a href="http://www.alistapart.com/articles/sprites">image spriting</a> and optimization feature which determines exactly which images are required for your application and includes them in a single image, vastly reducing the number of HTTP requests to load your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2008/10/21/cappuccino-tools-%e2%80%9cpress%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Cappuccino Tools: &#8220;objjc&#8221; and &#8220;steam&#8221;</title>
		<link>http://cappuccino.org/discuss/2008/10/14/objjc-and-steam/</link>
		<comments>http://cappuccino.org/discuss/2008/10/14/objjc-and-steam/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 06:42:38 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[build tool]]></category>
		<category><![CDATA[Objective-J]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=93</guid>
		<description><![CDATA[Note: please check the tools page on the wiki for the latest information on Cappuccino&#8217;s tools. In our previous post on the Cappuccino build tools we summarized the purpose of four of the tools. In this article we&#8217;ll dive deeper into two of them, objjc and steam. To review, the purpose of these tools is [...]]]></description>
			<content:encoded><![CDATA[<p><i>Note: please check the <a href="http://wiki.github.com/280north/cappuccino/tools">tools page</a> on the wiki for the latest information on Cappuccino&#8217;s tools.</i></p>
<p>In our previous post on the <a href="http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/">Cappuccino build tools</a> we summarized the purpose of four of the tools. In this article we&#8217;ll dive deeper into two of them, objjc and steam.</p>
<p>To review, the purpose of these tools is to prepare your application for deployment by pre-compiling all application Objective-J code into JavaScript, thereby reducing the load time for clients. Additionally, since most developers won&#8217;t need to modify Cappuccino itself, we always compile Cappuccino&#8217;s AppKit and Foundation frameworks to further reduce load time.</p>
<p>The only time you&#8217;ll need to run steam (which handles running objjc for you) is when you&#8217;re deploying your application, or if you&#8217;re making changes to the Cappuccino frameworks themselves. In the latter case, the easiest way to recompile the frameworks is to run the default ant task in the Cappuccino source tree:</p>
<pre><code>cd /path/to/cappuccino
ant</code></pre>
<p>To use the freshly built frameworks simply replace the &#8220;Frameworks&#8221; directory in your application with a symbolic link to the Release directory in the directory pointed to by your $STEAM_BUILD environment variable:</p>
<pre><code>cd /path/to/your_application
mv Frameworks Frameworks-Original
ln -s $STEAM_BUILD/Release Frameworks</code></pre>
<p>(if you&#8217;re loading your project through a webserver like Apache make sure to <a href="http://tlrobinson.net/blog/?p=40">enable the FollowSymLinks option</a>)</p>
<h3>objjc</h3>
<p>objjc, the Objective-J compiler, is the most important of the build tools, but you&#8217;ll likely never invoke it directly. objj can take any number of parameters as input filenames and output filenames (preceded by the &#8220;-o&#8221; flag). For example:</p>
<pre><code>objj Class1.j -o Class1.o Class2.j -o Class2.o</code></pre>
<p style="text-align: center;"><img src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/objjc1.png" alt="" title="objjc" width="338" height="76" class="aligncenter size-full wp-image-49" /></p>
<p>This will invoke the Objective-J compiler (which is identical to the one used by Objective-J in the browser) on each input file, outputting JavaScript plus some metadata to each specified output file. Next we need to combine all of these individual output files into a single &#8220;.sj&#8221; archive that contains the JavaScript and import dependency metadata for the entire framework. It would be possible to do this by hand, but steam takes care of it for you.</p>
<h3>steam</h3>
<p>steam is the general Cappuccino build tool that manages the creation and compilation of your Cappuccino applications.</p>
<p>To create a basic Cappuccino application, simply run steam with the &#8220;create&#8221; command:</p>
<pre><code>steam create ApplicationName</code></pre>
<p>This will create a new Cappuccino application in the directory &#8220;ApplicationName&#8221;. This application can be modified and run (by opening index.html in the browser) without any further usage of the build tools.</p>
<p>When you&#8217;re ready to compile the application code for deployment, add a .steam file to your application, like the following:</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#236e25;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span><br />
<span style="color:#236e25;">&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;</span><br />
<span style="color:#881280;">&lt;plist </span><span style="color:#994500;">version</span><span style="color:#881280;">=</span><span style="color:#1a1aa6;">&quot;1.0&quot;</span><span style="color:#881280;">&gt;</span><br />
<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Name<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;string&gt;</span>YourApplication<span style="color:#881280;">&lt;/string&gt;</span><br />
&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Targets<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;<span style="color:#881280;">&lt;array&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Name<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;string&gt;</span>YourApplication<span style="color:#881280;">&lt;/string&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/dict&gt;</span><br />
&nbsp;&nbsp;<span style="color:#881280;">&lt;/array&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Configurations<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;<span style="color:#881280;">&lt;array&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Name<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;string&gt;</span>Debug<span style="color:#881280;">&lt;/string&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Settings<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>PREPROCESS<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;true/&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>FLAGS<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;string&gt;</span>-DDEBUG<span style="color:#881280;">&lt;/string&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Name<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;string&gt;</span>Release<span style="color:#881280;">&lt;/string&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>Settings<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>PREPROCESS<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;true/&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;key&gt;</span>PREINTERPRET<span style="color:#881280;">&lt;/key&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;true/&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/dict&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/dict&gt;</span><br />
&nbsp;&nbsp;<span style="color:#881280;">&lt;/array&gt;</span><br />
<span style="color:#881280;">&lt;/dict&gt;</span><br />
<span style="color:#881280;">&lt;/plist&gt;</span></div>
<p>This file defines the targets and configurations for your project. This one defines a single target, YourApplication, and two configurations, Release and Debug. To compile your application, simply execute steam with the build command, the .steam filename, and the configuration name:</p>
<pre><code>steam build -f MyApp.steam -c Release</code></pre>
<p>If a .steam filename is not provided it will look for a file with the extension &#8220;.steam&#8221;. Likewise, if a configuration name is not provided, it will use the first one defined in the file. The following will run the &#8220;Debug&#8221; configuration in your .steam file:</p>
<pre><code>steam build</code></pre>
<p>steam gathers all &#8220;.j&#8221; files in your application, compiles them, and combines them into a single &#8220;.sj&#8221; file (&#8220;static Objective-J&#8221;), along with a new &#8220;Info.plist&#8221; which tell Objective-J which files are contained in the &#8220;.sj&#8221;.</p>
<p style="text-align: center;"><img src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/steam1.png" alt="" title="steam" width="356" height="100" class="aligncenter size-full wp-image-50" /></p>
<p>The results are placed in a subdirectory of $STEAM_BUILD named the same as the configuration, i.e. Debug or Release. Alternatively, pass the &#8220;-b&#8221; flag and a build directory to specify where it should be built.</p>
<p>The compiled application or framework can then be used in place of the original uncompiled collection of .j files. If it was an application, copy or symlink your Frameworks directory to it&#8217;s directory. If it was a framework, copy it to your application&#8217;s Frameworks directory.</p>
<h3>Conclusion</h3>
<p>This article covered the core Cappuccino build tools, objjc and steam. Remember that you will probably never want to call objjc directly, but rather rely on the &#8220;steam build&#8221; command to manage the build process for you. Additionally, remember the build process is entirely optional (except if you&#8217;re editing the Cappuccino frameworks themselves), and is only necessary as a deploy-time optimization.</p>
<p>In subsequent articles we&#8217;ll cover the remaining more advanced build tools, press and bake, as well as further deployment optimizations.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2008/10/14/objjc-and-steam/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Cappuccino and Objective-J Build Tools</title>
		<link>http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/</link>
		<comments>http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 08:33:16 +0000</pubDate>
		<dc:creator>tlrobinson</dc:creator>
				<category><![CDATA[Cappuccino]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[build tool]]></category>
		<category><![CDATA[Objective-J]]></category>

		<guid isPermaLink="false">http://cappuccino.org/discuss/?p=41</guid>
		<description><![CDATA[Note: please check the tools page on the wiki for the latest information on Cappuccino&#8217;s tools. This article is a high level overview of the current Cappuccino and Objective-J build tools. Subsequent posts will cover each tool in more detail. One of our primary design goals with Cappuccino and Objective-J was to keep the simple [...]]]></description>
			<content:encoded><![CDATA[<p><i>Note: please check the <a href="http://wiki.github.com/280north/cappuccino/tools">tools page</a> on the wiki for the latest information on Cappuccino&#8217;s tools.</i></p>
<p>This article is a high level overview of the current Cappuccino and Objective-J build tools. Subsequent posts will cover each tool in more detail.</p>
<p>One of our primary design goals with Cappuccino and Objective-J was to keep the simple development cycle web developers are used to: edit your code, save, refresh the browser. At the same time we wanted to add powerful language features to JavaScript without requiring the user install a plugin like Flash or Silverlight. At first glance it seemed like only two of these three requirements could be satisfied simultaneously, until we had the key realization that we could simply write our compiler in JavaScript itself, and perform the compilation at runtime on the client.</p>
<p>In reality the Objective-J &#8220;compiler&#8221; is more like a preprocessor, performing a relatively simple transformation from Objective-J code to JavaScript code, which is then interpretted by the browser&#8217;s native JavaScript engine. We don&#8217;t do full parsing and compiling, nor do we have a separate interpreter on top of JavaScript. The result is that the compiler and resulting code run very fast.</p>
<p>This turned out to work great. Simply <a href="http://cappuccino.org/starter">download the starter package</a>, load index.html in your browser, and start editing away! If you&#8217;re just getting started with Objective-J and Cappuccino you don&#8217;t even need to worry about the build tools, they&#8217;re entirely optional.</p>
<p>When it comes time to deploy your application you may want to optimize it. There&#8217;s no reason for your customers to wait any longer than necessary, even if the overhead is minimal. That&#8217;s where the build tools come in. Each tool has a specific purpose, and they all work together to produce an optimized Cappuccino application:</p>
<ul>
<li><strong>objjc</strong> &#8211; the Objective-J compiler</li>
<li><strong>steam</strong> &#8211; a general tool for managing the build process, creating new Cappuccino applications, etc.</li>
<li><strong>press</strong> &#8211; code stripping and other optimizations</li>
<li><strong>bake</strong> &#8211; deployment tool</li>
</ul>
<h3>objjc</h3>
<p>At the lowest level is &#8220;objjc&#8221;, the Objective-J compiler. It&#8217;s equivalent to gcc or javac, except it converts Objective-J code to JavaScript. Because we can run the same JavaScript code in the browser and <a href="http://www.mozilla.org/rhino/">Rhino</a> the core of objjc is identical to the in-browser compiler.</p>
<p style="text-align: center;"><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/objjc.png"></a><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/objjc1.png"><img class="aligncenter size-full wp-image-49" title="objjc" src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/objjc1.png" alt="" width="338" height="76" /></a></p>
<p>Currently objjc&#8217;s implementation is closer to a simple preprocessor than a compiler, much like the original Objective-C compiler was implemented as a preprocessor on top of C. The preprocessor simply looks for the few Objective-J syntax additions and replaces it with the raw JavaScript equivalent. A big reason this is possible is that Objective-J is a strict superset of JavaScript, thus all JavaScript code is valid Objective-J code.</p>
<p>Typically you don&#8217;t call objjc directly, but rather let steam manage the build process.</p>
<h3>steam</h3>
<p>Next up is steam, which is the main Objective-J and Cappuccino build tool. Currently it serves two purposes: &#8220;steam build&#8221; (similar to Xcode&#8217;s &#8220;xcodebuild&#8221;) and &#8220;steam create&#8221; (similar to Ruby on Rail&#8217;s &#8220;rails&#8221; command).</p>
<p>&#8220;steam build&#8221; runs the compilation process on an entire application or framework and outputs a single &#8220;.sj&#8221; file, vastly decreasing the number of HTTP requests required to load an application. These &#8220;.sj&#8221; files are archives of the compiled input &#8220;.j&#8221; files, along with information detailing each file&#8217;s required imports. This allows the Objective-J loading system to efficiently and asynchronously load a large application.</p>
<p style="text-align: center;"><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/steam.png"></a><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/steam1.png"><img class="aligncenter size-full wp-image-50" title="steam" src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/steam1.png" alt="" width="356" height="100" /></a></p>
<p>&#8220;steam create&#8221; copies all the files required for a new project to the directory specified.</p>
<h3>press</h3>
<p>The &#8220;press&#8221; tool takes in a full application and attempts to determine which code files are unecessary. It then strips those files and writes the results to another directory. This could be thought of as a &#8220;linker&#8221; though it works very differently than a traditional linker. On a simple project it will reduce the AppKit and Foundation frameworks size by approximately 30%, and we expect further improvements.</p>
<p style="text-align: center;"><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/press.png"></a><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/press1.png"><img class="aligncenter size-full wp-image-51" title="press" src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/press1.png" alt="" width="356" height="98" /></a></p>
<p>Optionally, it can run the <a href="http://pmt.sourceforge.net/pngcrush/">pngcrush</a> utility on all your png graphics, attempting to reduce their size. Eventually press will also automatically sprite images, further reducing the number of HTTP requests required to load your images.</p>
<h3>bake</h3>
<p>Finally, we have &#8220;bake&#8221;, the Cappuccino deployment tool (like <a href="http://www.capify.org/">&#8220;Capistrano&#8221;</a> but specialized for Cappuccino applications). Bake orchestrates all the above tools to produce, and optionally deploy, a highly optimized Cappuccino application. First it can pull both Cappuccino and your application code from git, svn, or a local or remote directory via rsync.</p>
<p><a href="http://cappuccino.org/discuss/wp-content/uploads/2008/10/bake1.png"><img class="alignright size-full wp-image-44" style="float: right;" title="bake1" src="http://cappuccino.org/discuss/wp-content/uploads/2008/10/bake1.png" alt="" width="382" height="698" /></a>It then copies pieces of the various &#8220;checkouts&#8221; to the &#8220;products&#8221; directory, first running a build process like &#8220;steam&#8221; or ant, if specified. For example, it can run steam on your application code, and copy the results to the product directory, then do the same for AppKit and Foundation, copying the results to the Frameworks/AppKit and Frameworks/Foundation directories to build the complete application.</p>
<p>Once an application is assembled, bake can run &#8220;press&#8221;, optimizing the application&#8217;s size.</p>
<p>Then bake sets up a directory structure and index.html file which allows for several important tricks: aggressive caching, keeping the client application in sync with the server backend, and atomic deployments, all while preserving a single user-facing URL for the application.</p>
<p>Finally, the application is archived and gzipped, scp&#8217;d to one or more servers, and atomically deployed to the specified path(s).</p>
<h3>Conclusion</h3>
<p>Cappuccino&#8217;s build tools are great at optimizing your deployed application, but there are further web server specific optimizations possible as well, including enabling <a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html">gzipping</a> and caching. These will be discussed in subsequent articles.</p>
]]></content:encoded>
			<wfw:commentRss>http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

