<?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>Dr Nic</title>
	<atom:link href="http://drnicwilliams.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<lastBuildDate>Tue, 01 Jun 2010 12:54:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Validate and Save your Ruby in TextMate &#8211; with secret Rubinus superpowers</title>
		<link>http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/</link>
		<comments>http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 12:54:18 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TextMate]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=751</guid>
		<description><![CDATA[In some TextMate bundles, if you save a file it will also validate the file and show any syntax errors in a tooltip. This is awesome. (e.g. JavaScript and CoffeeScript) So I added the same thing to my Ruby.tmbundle. Install this, save a dodgy Ruby file and you&#8217;ll now see something like: Rubinius superpowers Do [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/11/future-proofing-your-ruby-code/' rel='bookmark' title='Permanent Link: Future proofing your Ruby code. Ruby 1.9.1 is coming.'>Future proofing your Ruby code. Ruby 1.9.1 is coming.</a> <small> Bugger. I&#8217;m a Ruby monogamist. I use the Ruby...</small></li><li><a href='http://drnicwilliams.com/2008/10/09/textmate-easter-egg-find-bundle-commands-by-key-combo/' rel='bookmark' title='Permanent Link: TextMate easter egg: find bundle commands by key combo'>TextMate easter egg: find bundle commands by key combo</a> <small>I&#8217;ve dreamed of the ability to ask TextMate &#8220;what frigging...</small></li><li><a href='http://drnicwilliams.com/2008/08/19/my-attempt-at-sake-task-management/' rel='bookmark' title='Permanent Link: My attempt at sake task management'>My attempt at sake task management</a> <small> I&#8217;ve used sake intermittently in my workflow. It competes...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>In some TextMate bundles, if you save a file it will also validate the file and show any syntax errors in a tooltip. This is awesome. (e.g. <a href="http://github.com/subtleGradient/javascript-tools.tmbundle">JavaScript</a> and <a href="http://github.com/jashkenas/coffee-script-tmbundle">CoffeeScript</a>)</p>
<p>So I added the same thing to my <a href="http://github.com/drnic/ruby-tmbundle">Ruby.tmbundle</a>. Install this, save a dodgy Ruby file and you&#8217;ll now see something like:</p>
<p><img src="http://img.skitch.com/20100601-eiw1ugr2ma8xwxbecjfbbpfgpk.jpg" style="width: 90%" alt="Validate and Save - No Rubinius" /></p>
<h3 id="rubinius_superpowers">Rubinius superpowers</h3>
<p>Do you think the following syntax error tooltip is more useful?</p>
<p><img src="http://img.skitch.com/20100601-r66y9yr8nb14br4esi436prn1p.jpg" style="width: 90%" alt="Validate and Save - Rubinius installed" /></p>
<p>Yes it lovely, and the new Ruby.tmbundle will automatically do this if it can find <code>rbx</code> in your TextMate&#8217;s <code>$PATH</code>. Yeah yeah.</p>
<p>If you have <a href="http://github.com/mxcl/homebrew">Homebrew</a> installed:</p>
<pre><code>brew install rubinius
</code></pre>
<p>Then in TextMate, add your homebrew <code>bin</code> folder to the $PATH.</p>
<ul>
<li>Go to TextMate&#8217;s Preferences (Cmd+,)</li>
<li>Go to &#8220;Advanced&#8221;, then &#8220;Shell Variables&#8221;</li>
<li>Edit the <code>PATH</code> variable, and add &#8220;:/path/to/homebrew/bin&#8221;</li>
</ul>
<p>For example, if you have homebrew installed in <code>~/.homebrew</code> then you might add <code>:/Users/drnic/.homebrew/bin</code></p>
<p>. My complete <code>$PATH</code> in TextMate is:</p>
<pre>/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/bin/:/Users/drnic/.homebrew/bin</pre>
<p>Save a dodgy Ruby file and see the beautifully helpful syntax message.</p>
<h3 id="install_rubytmbundle">Install Ruby.tmbundle</h3>
<p>To install via Git:</p>
<pre><code>mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/drnic/ruby-tmbundle.git "Ruby.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'
</code></pre>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/11/future-proofing-your-ruby-code/' rel='bookmark' title='Permanent Link: Future proofing your Ruby code. Ruby 1.9.1 is coming.'>Future proofing your Ruby code. Ruby 1.9.1 is coming.</a> <small> Bugger. I&#8217;m a Ruby monogamist. I use the Ruby...</small></li><li><a href='http://drnicwilliams.com/2008/10/09/textmate-easter-egg-find-bundle-commands-by-key-combo/' rel='bookmark' title='Permanent Link: TextMate easter egg: find bundle commands by key combo'>TextMate easter egg: find bundle commands by key combo</a> <small>I&#8217;ve dreamed of the ability to ask TextMate &#8220;what frigging...</small></li><li><a href='http://drnicwilliams.com/2008/08/19/my-attempt-at-sake-task-management/' rel='bookmark' title='Permanent Link: My attempt at sake task management'>My attempt at sake task management</a> <small> I&#8217;ve used sake intermittently in my workflow. It competes...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Showcase of CoffeeScript &#8211; 2.5 mins for your next Dev Group meeting</title>
		<link>http://drnicwilliams.com/2010/05/28/showcase-of-coffeescript-2-5-mins-for-your-next-dev-group-meeting/</link>
		<comments>http://drnicwilliams.com/2010/05/28/showcase-of-coffeescript-2-5-mins-for-your-next-dev-group-meeting/#comments</comments>
		<pubDate>Fri, 28 May 2010 12:20:08 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=733</guid>
		<description><![CDATA[If you are giving an &#8220;Introduction to CoffeeScript&#8221; talk at your local developer group in the future, I have a 2:30min video you might find exciting to show. CoffeeScript is so cool that I thought it really needed to be put to music. Hard rock music. AC/DC. I finished my session at NordicRuby with this [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>
<object id="sample-video" class="alignright" style="float: right" width="320" height="195" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" value="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20streaming.mov" /><param name='autoplay' value="false" /><param name='controller' value="true" /><param name='loop' value="false" /><embed src="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20streaming.mov" width="320" height="195" controller="true" autoplay="false" loop="false" scale="tofit" cache="true" pluginspage="http://www.apple.com/quicktime/download/"></embed></object></p>
<p>If you are giving an &#8220;Introduction to CoffeeScript&#8221; talk at your local developer group in the future, I have a 2:30min video you might find exciting to show. <a href="http://coffeescript.org/" target="_blank">CoffeeScript</a> is so cool that I thought it really needed to be put to music. Hard rock music. AC/DC.</p>
<p>I finished my session at <a href="http://nordicruby.com" target="_blank">NordicRuby</a> with this video and I think it helped get lots of people excited about CoffeeScript.</p>
<p>Because of it&#8217;s heavy dependence of the backing song &#8211; the screencast is boring without it &#8211; I&#8217;m kind of screwed as to how to distribute it to other presenters. The licensing rules of including music and it&#8217;s 600Mb size are prohibitive.</p>
<p>What the hell. I&#8217;ve included an inline sample above; and the links to the 600Mb version is below. All self-promotional &#8220;Dr Nic made this shiny video&#8221; bits have been removed. Go for gold. Share the CoffeeScript excitement.</p>
<h3 id="nordicruby">NordicRuby</h3>
<p><a href="http://nordicruby.com">NordicRuby</a> finished 5 days ago, but many of the attendees and speakers are only finally winding down. Executed with the style, excitement and pizazz of Unspace&#8217;s RubyFringe and FutureRuby conferences, I had a brilliant time in Gothenburg. If NordicRuby&#8217;s organiser&#8217;s <a href="http://elabs.se/">Elabs</a> host the event again in 2011 I highly recommend attending. Carefully selected and sequenced speakers from around the world, 30 minute talks with 30 minute breaks over two days, an hour of lightning talks each day, and parties every night. Phew.</p>
<p>To CJ and Lilly, the organisers, the other speakers and all the attendees, thanks for an awesome experience in Sweden. Looking forward to coming back next year.</p>
<h3 id="why_coffeescript">Why CoffeeScript?</h3>
<p>JavaScript has a wonderful feature or two: it&#8217;s everywhere and it&#8217;s getting really fast. Unfortunately, its syntax was heavily influenced by Java/C++ and other popular goliaths of the time. But the JavaScript runtime is sweet. JavaScript syntax, not so sweet. </p>
<p>Like .NET and it&#8217;s selection of languages, the JVM and it&#8217;s growing smorgasbord of languages, I think the JavaScript runtime could benefit from more experimentation with alternate languages and/or syntaxes. Objective-J was one attempt. CoffeeScript is another.</p>
<p>Of the two, I like CoffeeScript. A lot.</p>
<h3 id="demonstrating_coffeescript_at_dev_meetups">Demonstrating CoffeeScript at Dev meetups</h3>
<p>The video flies through core ideas pretty quickly, so I ran through syntax examples on a slide first, and then said &#8220;You know, I think this would go better to music,&#8221; and played the video.</p>
<p><img src="http://img.skitch.com/20100528-cf2ts4uqmn91dy8h7m7hj26iwy.png" width="500px"></p>
<h3 id="download_and_demo">Download and Demo</h3>
<p>The purpose of offering the 600Mb video version is for the growing number of people doing CoffeeScript talks at their local software dev groups. The music in it is not licensed, not mine, but sounds awesome.</p>
<p>Please play the video with speakers. AC/DC on mute is a cruel act. Also watching the text jump around without the music is probably weird to watch. AC/DC and CoffeeScript. Perfect match, I think.</p>
<p><a href="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20Dr%20Nic%20-%20Mocra.mov?torrent"><img src="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20cover.png" width="500px"></a></p>
<p>Formats: <a href="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20Dr%20Nic%20-%20Mocra.mov?torrent">Torrent</a> | <a href="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20Dr%20Nic%20-%20Mocra.mov">Download</a> (600Mb)</p>
<h3 id="tack_s_mycket">Tack så mycket</h3>
<p>Swedish for &#8220;Thank you very much,&#8221; pronounced like &#8220;tuck sa-meekeh&#8221; or thereabouts.</p>
<p>If you use the video at all, I&#8217;d really appreciate it if you left a comment below! </p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2010/05/28/showcase-of-coffeescript-2-5-mins-for-your-next-dev-group-meeting/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
<enclosure url="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20streaming.mov" length="2832999" type="video/quicktime" />
<enclosure url="http://s3.amazonaws.com/screencasts.drnicwilliams/Summary%20of%20CoffeeScript%20-%20Dr%20Nic%20-%20Mocra.mov" length="599670164" type="video/quicktime" />
		</item>
		<item>
		<title>How to make a good home-made Open Source</title>
		<link>http://drnicwilliams.com/2010/04/09/how-to-make-a-good-home-made-open-source/</link>
		<comments>http://drnicwilliams.com/2010/04/09/how-to-make-a-good-home-made-open-source/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 13:38:12 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=725</guid>
		<description><![CDATA[Want to be the funniest person at the next hacker&#8217;s picnic? Point at a bottle of red ketchup with its lid next to it on the table and pronounce &#8220;Hey look, Open Source.&#8221; Be ready with follow-ups like &#8220;Can you pass me the Haml?&#8221; If you&#8217;ve used Ruby on Rails, Apache, Emacs, or Linux then [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/' rel='bookmark' title='Permanent Link: Home'>Home</a> <small>...</small></li><li><a href='http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/' rel='bookmark' title='Permanent Link: FutureRuby talk: Living With 1000 Open Source Projects'>FutureRuby talk: Living With 1000 Open Source Projects</a> <small>The FutureRuby conference has been (and still is, as of...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20100409-nek2u3tdff55dn2w2sreys4314.png" style="float: right"></p>
<p>Want to be the funniest person at the next hacker&#8217;s picnic? Point at a bottle of red ketchup with its lid next to it on the table and pronounce &#8220;Hey look, Open Source.&#8221;</p>
<p>Be ready with follow-ups like &#8220;Can you pass me the Haml?&#8221; </p>
<p>If you&#8217;ve used Ruby on Rails, Apache, Emacs, or Linux then you would have been impressed by the awesome quality of these free bits of software which are so important to us. They are free, they are important, and they are awesome.</p>
<p>Paying money for poor commercial software makes awesome, important free software appear even more awesome and important.</p>
<p>The facts seem gloomy. You are a humble developer. Awesome, important free software is a Herculean achievement.</p>
<p>Conclusion? You implicitly believe you will never write awesome, important free software.</p>
<p>But &#8220;never&#8221; is an awfully long time. And is the only goal &#8220;awesome, important free software&#8221;?</p>
<h3 id="reasons_to_write">Reasons to write?</h3>
<p>Personally, I don&#8217;t think I&#8217;ve ever created an open source project that is either important or awesome. I think my motivations for open source &#8212; my own projects or stuff added to other&#8217;s projects &#8212; is either: </p>
<p>&#8220;Wouldn&#8217;t it be cool if you could do XYZ?&#8221; or &#8220;Seriously. Why can&#8217;t I do XYZ?&#8221;</p>
<p>I was either amused or annoyed. <a href="http://magicmodels.rubyforge.org/">Dr Nic&#8217;s Magic Models</a> was a joke. <a href="http://drnic.github.com/choctop/">ChocTop</a> was vented frustration.</p>
<p>Perhaps there are different reasons. I find the following examples inspiring.</p>
<p>I think the late Why the Lucky Stiff created <a href="http://camping.rubyforge.org/files/README.html">entertaining</a> free software.</p>
<p><a href="http://toolmantim.com/thoughts">Tim Lucas</a> created <a href="http://railscampteev5.toolmantim.com/">artistic</a> free software (&#8216;View Source&#8217; to see the header comment)</p>
<p><a href="http://chneukirchen.org/">Christian Neukirchen</a> created <a href="http://rack.rubyforge.org/">liberating</a> free software.</p>
<p><a href="http://blog.zenspider.com/">Ryan Davis</a> created free <a href="http://seattlerb.rubyforge.org/hoe/">tools</a>.</p>
<p><a href="http://ozmm.org/">Chris Wanstrath</a> <a href="http://hellorip.com/about.html">ports</a> free software.</p>
<p>Is there a muse that you can choose?</p>
<p>What other reasons are there for writing examples? Perhaps leave comments below and I&#8217;ll add them to the list above.</p>
<h3 id="who_me">Who? Me?</h3>
<p>And &#8220;awesome&#8221; sounds awfully challenging to aim for. Surely, &#8220;Awesome&#8221; is just one end of a scale with &#8220;Worthless&#8221; at the other end. &#8220;Moderately Good&#8221;, &#8220;Average&#8221;, &#8220;Below Average&#8221;, and &#8220;Where are the test cases?!&#8221; are in the middle.</p>
<p>Have you ever visited a friend who you find putting on the finishing touches to a 6&#8217; by 4&#8217; canvas painting of their entire family from their last Christmas dinner together, and they say &#8220;want to help?&#8221; Unlikely. Fortunately open source software &#8220;paintings&#8221; are a free-for-all.</p>
<p>You can write Libraries, Adaptors, Applications, Frameworks, Tools, Extensions and Services.</p>
<p>You don&#8217;t even need to create new free software. Fix something that someone else broke. Add a feature that was missing. Write documentation after you eventually figured out what to do.</p>
<h3 id="mid_year8217s_resolution">Mid-Year&#8217;s Resolution</h3>
<p>It&#8217;s now April. If you&#8217;re still looking for a 2010 New Year&#8217;s Resolution, borrow this one: &#8220;Write some open source software.&#8221;</p>
<p>If you&#8217;re going to RailsConf, perhaps come along to my tutorial <a href="http://en.oreilly.com/rails2010/public/schedule/detail/14174">The 8 Steps to Contributing to OSS</a> or let&#8217;s catch up in the corridors. It&#8217;s going to be a great RailsConf!</p>
<p><a href="http://en.oreilly.com/rails2010/public/schedule/detail/14174"><img src="http://img.skitch.com/20100409-tjw5twwex9n4hnsffbpkyyj59k.jpg" alt="rails2010_header_bg" width="100%"/></a></p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/' rel='bookmark' title='Permanent Link: Home'>Home</a> <small>...</small></li><li><a href='http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/' rel='bookmark' title='Permanent Link: FutureRuby talk: Living With 1000 Open Source Projects'>FutureRuby talk: Living With 1000 Open Source Projects</a> <small>The FutureRuby conference has been (and still is, as of...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2010/04/09/how-to-make-a-good-home-made-open-source/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using CoffeeScript in Rails and even on Heroku</title>
		<link>http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/</link>
		<comments>http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 12:46:52 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=713</guid>
		<description><![CDATA[I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for pure JavaScript. What is CoffeeScript? Imagine all the syntactical delights of Ruby and Haml for your JavaScript. You write in a nice language, but get normal JavaScript at runtime. All whilst having full access to 3rd-party JavaScript libraries (jQuery, PrototypeJS), debugging support (it becomes pure, [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/' rel='bookmark' title='Permanent Link: Validate and Save your Ruby in TextMate &#8211; with secret Rubinus superpowers'>Validate and Save your Ruby in TextMate &#8211; with secret Rubinus superpowers</a> <small>In some TextMate bundles, if you save a file it...</small></li><li><a href='http://drnicwilliams.com/2010/05/28/showcase-of-coffeescript-2-5-mins-for-your-next-dev-group-meeting/' rel='bookmark' title='Permanent Link: Showcase of CoffeeScript &#8211; 2.5 mins for your next Dev Group meeting'>Showcase of CoffeeScript &#8211; 2.5 mins for your next Dev Group meeting</a> <small> If you are giving an &#8220;Introduction to CoffeeScript&#8221; talk...</small></li><li><a href='http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/' rel='bookmark' title='Permanent Link: Dead simple JavaScript Unit Testing in Rails'>Dead simple JavaScript Unit Testing in Rails</a> <small> Formats: Video/Screencast (410 Mb, torrent) | Video only (vimeo)...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty excited about <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> as a clean-syntax replacement for pure JavaScript. </p>
<h3 id="what_is_coffeescript">What is CoffeeScript?</h3>
<p><img src="http://img.skitch.com/20100315-mq3h882gd6742tixy78mnbc5jt.png" width="550px"></p>
<p>Imagine all the syntactical delights of Ruby and Haml for your JavaScript. You write in a nice language, but get normal JavaScript at runtime. All whilst having full access to 3rd-party JavaScript libraries (jQuery, PrototypeJS), debugging support (it becomes pure, readable JavaScript), existing support from test suites (it&#8217;s normal JavaScript) and growing support from various text editors (<a href="http://github.com/jashkenas/coffee-script-tmbundle">TextMate</a>, <a href="http://github.com/jashkenas/coffee-script/blob/master/extras/coffee.vim">Vim</a>, <a href="http://github.com/defunkt/coffee-mode">Emacs</a>).</p>
<p>What simple delights?</p>
<p>No trailing semi-colons. No <code>{ some_code() }</code> function/closure brackets. String interpolation. Multi-line strings. Explicit <code>class</code> syntax. Array slicing. An existential ? operator.</p>
<p>Scroll down the <a href="http://jashkenas.github.com/coffee-script/">home page</a> for awesome example after example.</p>
<p>These aren&#8217;t library extensions. This is clean, purposeful syntax.</p>
<p>You can play with the joyful syntax of CoffeeScript on the website. After reading the basic examples on the <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript home page</a>, press &#8220;TRY COFFEESCRIPT&#8221; in the header menu.</p>
<p>As you play with the syntax, the equivalent JavaScript is printed on the right hand side (see image above).</p>
<p>How nice is that syntax? Very.</p>
<h3 id="installing_coffeescript">Installing CoffeeScript</h3>
<ol>
<li>Install NodeJS</li>
<li>Install CoffeeScript</li>
</ol>
<p>For NodeJS (<a href="http://nodejs.org/#download">get latest release URL</a>; using 0.1.31 as 0.1.32 doesn&#8217;t unpack for me):</p>
<pre><code>cd /usr/local/src
wget http://nodejs.org/dist/node-v0.1.31.tar.gz
tar xfv node-v0.1.31.tar.gz
cd node-v0.1.31
./configure
make
sudo make install
</code></pre>
<p>For CoffeeScript (<a href="http://jashkenas.github.com/coffee-script/#installation">get latest release URL</a>):</p>
<pre><code>cd /usr/local/src
wget http://github.com/jashkenas/coffee-script/tarball/0.5.5
tar xfv jashkenas-coffee-script-bcf7b3f.tar.gz
cd jashkenas-coffee-script-bcf7b3f
sudo bin/cake install
</code></pre>
<p>Now test that everything is in place:</p>
<pre><code>$ coffee --version
CoffeeScript version 0.5.5
$ coffee -e "sys: require 'sys'; sys.puts 'hello world\n'"
hello world
</code></pre>
<p>Phew!</p>
<p>Note, in the command-line/on the server, you are using the NodeJS JavaScript environment. It supports the <a href="http://commonjs.org/">CommonJS</a> API for loading modules (normal JavaScript: <code>var sys = require('sys')</code>).</p>
<h3 id="um_but_how_do_i_use_it_in_my_web_app">Um, but how do I use it in my web app?</h3>
<p>Your application source code will have <code>*.coffee</code> files containing your sexy, short CoffeeScript. But at runtime, the browser needs the generated JavaScript.</p>
<p>I&#8217;ve been using the Jonas Nicklas&#8217; <a href="http://github.com/jnicklas/bistro_car">bistro_car</a> gem:</p>
<pre><code>gem install bistro_car
mkdir -p app/scripts
</code></pre>
<p>In your Rails <code>config/environment.rb</code> file, add:</p>
<pre><code>config.gem 'bistro_car'
</code></pre>
<p>And in your layouts, such as <code>app/views/layouts/application.html.erb</code> add to the <code>&lt;head&gt;</code> or the bottom:</p>
<pre><code>&lt;%= coffee_script_bundle %&gt;
</code></pre>
<p>Now you&#8217;re good to go. Add your CoffeeScript files in <code>app/scripts/*.coffee</code> and they will be automatically available as JavaScript.</p>
<h3 id="warning_check_your_version_of_coffeescript">WARNING: Check your version of CoffeeScript</h3>
<p>Check that this hasn&#8217;t happened:</p>
<pre><code>$ coffee --version
CoffeeScript version 0.3.2
$ which coffee
/usr/bin/coffee
</code></pre>
<p>Arrgh, we should be using <code>/usr/local/bin/coffee</code>. <code>bistro_car</code> currently installs the old rubygem-based version of coffee-script; and you might be unlucky to have your $PATH find the wrong one first.</p>
<p>Either delete it (<code>sudo rm /usr/bin/coffee</code> and restart your shell) or make sure <code>/usr/local/bin</code> is earlier in your <code>$PATH</code> than <code>/usr/bin</code>, where RubyGems installed the old, unnecessary version of <code>coffee</code> command.</p>
<h3 id="let8217s_drink_the_coffeescript">Let&#8217;s drink the CoffeeScript</h3>
<p>Create a file <code>app/scripts/application.coffee</code> with contents:</p>
<pre><code>powers: [1,2,3,4].map (i) -&gt; i * i
alert powers
</code></pre>
<p>Load up a view in a browser and see <code>[1,4,9,16]</code>. You win! Throw in some jQuery/PrototypeJS/whatever. Beautiful.</p>
<p>View the source of the page, navigate to <code>public/javascripts/bundle/default.js</code> and you&#8217;ll see the generated source:</p>
<pre class="sh_javascript"><code>(function(){
  var powers;
  powers = [1, 2, 3, 4].map(function(i) {
    return i * i;
  });
  alert(powers);
})();
</code></pre>
<h3 id="the_problem_heroku_doesn8217t_have_coffeescript_installed">The problem: Heroku doesn&#8217;t have CoffeeScript installed</h3>
<p>Heroku is a great place to host apps. Though it doesn&#8217;t have CoffeeScript installed so it cannot dynamically convert the <code>*.coffee</code> files into JavaScript.</p>
<p>If you want to use Heroku I guess we need to perform the conversion locally and deploy it.</p>
<p>But. In development and integration testing I want bistro_car&#8217;s dynamically generated <code>default.js</code>. In production, I need a cached version.</p>
<p>In <code>application.html.haml</code> I use (I can&#8217;t keep pretending I use erb):</p>
<pre class="sh_ruby"><code>- if Rails.env.production?
  = javascript_include_tag "coffeescripts"
- else
  = coffee_script_bundle
</code></pre>
<p>Now we&#8217;re just left with the hassle of automatically generating <code>public/javascripts/coffeescripts.js</code>.</p>
<p>First, a rake task. Second, a git pre-commit hook.</p>
<p>Create <code>lib/tasks/bistro_car.rake</code>:</p>
<pre class="sh_ruby"><code>desc "Generate the cached bundle/default.js file from app/scripts/*.coffee files"
task :bistro_car =&gt; :environment do
  path = "public/javascripts/coffeescripts.js"
  puts "Building *.coffee -&gt; #{path}"
  File.open(path, "w") { |file| file &lt;&lt; BistroCar::Bundle.new('default').to_javascript }
end

file "public/javascripts/coffeescripts.js" =&gt; Dir[File.join(Rails.root, 'app/scripts/*.coffee')] do |t|
  Rake::Task["bistro_car"].invoke
end
</code></pre>
<p>Now you can create <code>coffeescripts.js</code> and add it to the repo with:</p>
<pre><code>rake public/javascripts/coffeescripts.js
git add public/javascripts/coffeescripts.js
git commit -m "Initial bundled coffeescripts file"
</code></pre>
<p>Now create <code>.git/hooks/pre-commit</code>:</p>
<pre class="sh_sh"><code>#!/bin/sh

exec rake public/javascripts/coffeescripts.js
</code></pre>
<p>And make it executable (and <code>git commit</code> will invoke it automatically):</p>
<pre><code>chmod +x .git/hooks/pre-commit
</code></pre>
<p>Phew.</p>
<p>Now, whenever you change a *.coffee script and you are about to commit it, the cached-production-only <code>coffeescripts.js</code> is automatically updated and included in the same commit.</p>
<p>Seems like a clean hack.</p>
<h3 id="summary">Summary</h3>
<p>Why not make a library to do this? Well I&#8217;m hoping there is a better, cleaner way. Perhaps <code>bistro_car</code> can include a rails generator to package these bits and pieces itself, if my approach happens to be the best way.</p>
<p>Nonetheless, let history record that CoffeeScript is very cool though in the world of Heroku living with it is non-trivial at the moment.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/' rel='bookmark' title='Permanent Link: Validate and Save your Ruby in TextMate &#8211; with secret Rubinus superpowers'>Validate and Save your Ruby in TextMate &#8211; with secret Rubinus superpowers</a> <small>In some TextMate bundles, if you save a file it...</small></li><li><a href='http://drnicwilliams.com/2010/05/28/showcase-of-coffeescript-2-5-mins-for-your-next-dev-group-meeting/' rel='bookmark' title='Permanent Link: Showcase of CoffeeScript &#8211; 2.5 mins for your next Dev Group meeting'>Showcase of CoffeeScript &#8211; 2.5 mins for your next Dev Group meeting</a> <small> If you are giving an &#8220;Introduction to CoffeeScript&#8221; talk...</small></li><li><a href='http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/' rel='bookmark' title='Permanent Link: Dead simple JavaScript Unit Testing in Rails'>Dead simple JavaScript Unit Testing in Rails</a> <small> Formats: Video/Screencast (410 Mb, torrent) | Video only (vimeo)...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Customized Google Forms</title>
		<link>http://drnicwilliams.com/2010/02/25/customized-google-forms/</link>
		<comments>http://drnicwilliams.com/2010/02/25/customized-google-forms/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 11:30:24 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Trick]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=688</guid>
		<description><![CDATA[Google Forms are a great, free way to collect information from anyone, stored directly into a Google Spreadsheet, and then have Google notify you each time a form is submitted (optionally). The downside is that you can only use one of their pre-packaged themes. You can&#8217;t have your company logo and corporate &#8220;look&#8221;. Pooey to [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20100225-rm11rdpj6qib6ukbwdi87ewd76.preview.jpg" alt="Google Form Customized" style="float: right; width: 200px"/></p>
<p>Google Forms are a great, free way to collect information from anyone, stored directly into a Google Spreadsheet, and then have Google notify you each time a form is submitted (optionally). The downside is that you can only use one of their pre-packaged themes. You can&#8217;t have your company logo and corporate &#8220;look&#8221;.</p>
<p>Pooey to Google, we say. So we wrote <a href="http://github.com/mocra/custom_google_forms">custom_google_forms</a>.</p>
<p>Want to truly customized Google Forms? Fork this repository, customize the CSS, DOM and images, and deploy to Heroku. You can then host/customize any number of Google Forms.</p>
<p>For example, here is an original <a href="http://spreadsheets.google.com/a/mocra.com/viewform?formkey=dFo0LXQyYmlEV2dXcVJ6WjRweW9vRnc6MA">bare Google Form</a> and here is a <a href="http://forms.mocra.com/railsdev">fully customized version</a>, including form validation and thank you page.</p>
<p>It&#8217;s fully a dynamic, thin layer on top of Google Forms. If you change your Google Form, your custom form application automatically changes.</p>
<h2 id="how_to_use_google_forms">How to use Google Forms?</h2>
<p>Perhaps read <a href="http://docs.google.com/support/bin/answer.py?hl=en&amp;answer=87809">this docco</a>? Essentially if you can access Google Spreadsheets, you can create a Google Form (which automatically creates and updates a Google Spreadsheet based on the fields and form submissions).</p>
<h2 id="fork_and_customize">Fork and Customize</h2>
<p>It&#8217;s really simple to play with and customize Google Forms. Clone the <a href="http://github.com/mocra/custom_google_forms">GitHub project</a> and fire up the Rails server:</p>
<pre><code>gem install github
cd ~/Sites
gh clone mocra/custom-google-forms yourdomain-google-forms
cd yourdomain-google-forms
script/server
</code></pre>
<p>Go to <a href="http://localhost:3000/google_forms/new">http://localhost:3000/google_forms/new</a> and add a Google Form:</p>
<p><img src="http://img.skitch.com/20100225-msfc5a8gk5rnm5pm7qdy9fd6x6.jpg" alt="My Google Forms - New" style="width: 100%"/></p>
<p>The &#8220;Slug&#8221; is the URL path people will follow. That is, a slug &#8220;railsdev&#8221; maps to <a href="http://forms.mocra.com/railsdev">http://forms.mocra.com/railsdev</a>.</p>
<p>The &#8220;Form Key&#8221; field takes either the <a href="http://spreadsheets.google.com/a/mocra.com/viewform?hl=en&amp;formkey=dFo0LXQyYmlEV2dXcVJ6WjRweW9vRnc6MA">Form URL</a> or just the formkey parameter (e.g. dFo0LXQyYmlEV2dXcVJ6WjRweW9vRnc6MA) from when you view the live form.</p>
<p>Press &#8220;Create&#8221; and follow the slug url to view your Google Form through your own customized style.</p>
<p>Well, initially you&#8217;ll see the Mocra style. Let&#8217;s fix that.</p>
<h1 id="default_theme">Default Theme</h1>
<p>First, fork the github repository so that you can push your style changes to your own repo.</p>
<pre><code>gh fork
mate public/stylesheets/style.css
</code></pre>
<p>Now, edit <a href="http://github.com/mocra/custom_google_forms/blob/master/public/stylesheets/style.css">public/stylesheets/style.css</a> to your tastes.</p>
<p>Please don&#8217;t reuse our style. Aside from you looking a bit silly having the :mocra logo at the top, it would be weird if your forms looked like our forms. I guess you might as well have used the default Google Form themes?</p>
<h1 id="heroku_deployment">Heroku Deployment</h1>
<p>Let&#8217;s not get fancy, let&#8217;s just deploy your fork to Heroku. It&#8217;s free. It&#8217;s simple. You&#8217;ll be done in two minutes.</p>
<p>To get your copy of the application deployed to <a href="http://heroku.com">heroku</a>:</p>
<pre><code>gem install heroku
heroku create yourdomain-google-forms
git push heroku master
heroku rake db:migrate
</code></pre>
<p>Two optional environment variables:</p>
<pre><code>heroku config:add GOOGLE_ANALYTICS='YOURCODE'
</code></pre>
<p>If specified, Google Analytics will be included on all pages (including the custom Google Forms page).</p>
<pre><code>heroku config:add EXPECTED_DOMAIN='some.yourdomain.com'
</code></pre>
<p>If specified, &#8216;yourdomain-google-forms.heroku.com/someform&#8217; automatically redirects to &#8216;some.domain.com/someform&#8217;. </p>
<p>For example, for http://forms.mocra.com we used:</p>
<pre><code>heroku config:add GOOGLE_ANALYTICS='UA-5370510-4'
heroku config:add EXPECTED_DOMAIN='forms.mocra.com'
</code></pre>
<h1 id="getting_started">Getting Started</h1>
<p>Once deployed, go to the /google_forms/new URL and add your first form. Once it is validated and added, you can start using it using the links shown.</p>
<h1 id="summary">Summary</h1>
<p>Yay for free, customized Google Forms! Yay for free Heroku hosting!</p>
<p>Bonus: you can configure your Google Forms/Spreadsheet to notify you when new forms are submitted. That&#8217;s handy.</p>
<p>Thanks to Odin Dutton, our resident designer at Mocra, who did a great job applying our new theme to the Google Forms DOM structure. It&#8217;s wonderful having him on the team!</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2010/02/25/customized-google-forms/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>First 5 Minutes of Stand Up Comedy</title>
		<link>http://drnicwilliams.com/2009/12/03/first-5-minutes-of-stand-up-comedy/</link>
		<comments>http://drnicwilliams.com/2009/12/03/first-5-minutes-of-stand-up-comedy/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 23:05:28 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=673</guid>
		<description><![CDATA[I thought you might be interested to see the fruits of my new hobby: stand up comedy. It should be running in &#8220;HD&#8221; for 20% more laughs. Video taken by Greg Fairbrother, my awesome Mocra Off Railers co-driver. I discovered a local Stand Up Comedy Course which started 6 weeks ago. The final &#8220;night&#8221; of [...]]]></description>
			<content:encoded><![CDATA[<p>I thought you might be interested to see the fruits of my new hobby: stand up comedy.</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/2RM18SzE33M&amp;hl=en_US&amp;fs=1&amp;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2RM18SzE33M&amp;hl=en_US&amp;fs=1&amp;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>It should be running in &#8220;HD&#8221; for 20% more laughs. Video taken by Greg Fairbrother, my awesome <a href="http://mocraoffrailers.com">Mocra Off Railers</a> co-driver.</p>
<p>I discovered a local <a href="http://www.standupcomedycourse.com.au/">Stand Up Comedy Course</a> which started 6 weeks ago. The final &#8220;night&#8221; of the course was for the 8 of us to do a show for family and friends. I don&#8217;t remember reading about that on the sales brochure.</p>
<p>Nonetheless, knowing you had a 5 minute set to perform in front of your family and friends sets the expectation in your mind from day one that you don&#8217;t want to be shit. So we listened up, wrote as many jokes as we could think of, and hoped desperately we wouldn&#8217;t be a blubbering mess on the night.</p>
<p>It&#8217;s not all left to chance. Each week, the funny woman who ran the course, Fiona McGary, made us use the microphone on the stage. Either talk about our week, or list all the funny things you can think of about frogs. Or any other European people.</p>
<p>Each week we boldly attempted to make our other classmates laugh. At the start, they don&#8217;t. So I quickly learned to edit and then how to present comedy on stage. I tried to learn it fast because it&#8217;s weird telling a punch line, waiting for the laughs, and only being rewarded with a uncomfortable shared silence.</p>
<p>All my jokes started out crappy. So I attempted to edit them into &#8220;setup-punchline format&#8221;. Another phrase for &#8220;edit&#8221; is &#8220;delete half&#8221;. I&#8217;m a verbose writer. This turns out to suck awfully for stand up comedy. Or perhaps I should be a concise writer too. Oh the novelty of the idea.</p>
<p>Another way to edit a joke so it is ready for an audience is to delete all of it. Turns out, just because I thought of something funny doesn&#8217;t mean anyone else thinks it&#8217;s funny. Ewwww, that was an uncomfortable life lesson.</p>
<p>I don&#8217;t know anything else and the above is probably wrong too. The last six weeks have been a blur. Lots of practise, lots of editing, lots of writing, lots of testing ideas on Mocra staff when they aren&#8217;t expecting it, and weekly doses of disturbing reality at the Tuesday workshops when I realise I still have 10 years of more practise to go before David Letterman might ask me to come on his show. He&#8217;ll only be 112 years old by then, so fingers crossed.</p>
<p>I&#8217;m very appreciative of the 20+ family and friends who came along for the show. All the comedians were very appreciative of especially Lucas and Chendo who sat at the front and giggled like little girls all night.</p>
<p>Spending the last six weeks with the other noob comedians has been wonderful. It will be fun seeing everyone around the Open Mic rooms in Brisbane.</p>
<p>Finally, and most importantly, thanks to Fiona for running the course, and bumping us forward each week with the subtle phrase &#8220;that&#8217;s good; though it will need more editing.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/12/03/first-5-minutes-of-stand-up-comedy/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Making a pretty Firefox Beta application icon</title>
		<link>http://drnicwilliams.com/2009/11/16/making-a-pretty-firefox-beta-application-icon/</link>
		<comments>http://drnicwilliams.com/2009/11/16/making-a-pretty-firefox-beta-application-icon/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 22:41:25 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=661</guid>
		<description><![CDATA[Here&#8217;s the problem: I install OS X Firefox 3.6b2 along side Firefox 3.5. They are both in my dock. Their icons are the same. Um, which is which? How about a sexy Firefox Beta icon to separate what&#8217;s-what in the dock, Quicksilver, Spotlight etc? This post shows how to create a &#8220;beta Firefox&#8221; icon, install [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/06/easy-scheduling-by-location-tasks-and-people-a-case-study-of-a-client-application-from-mocra/' rel='bookmark' title='Permanent Link: Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra'>Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra</a> <small> UPDATE: Orchestrate was reported in TechCrunch Several years ago...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20091113-xhgyhxk8eiuanrs1au27k1pnmd.png" style="float: right"></p>
<p>Here&#8217;s the problem: I install OS X Firefox 3.6b2 along side Firefox 3.5. They are both in my dock. Their icons are the same. Um, which is which?</p>
<p>How about a sexy Firefox Beta icon to separate what&#8217;s-what in the dock, Quicksilver, Spotlight etc?</p>
<p>This post shows how to create a &#8220;beta Firefox&#8221; icon, install it into the Firefox 3.6b2 OS X application, and live long and prosperously.</p>
<h2 id="installing_firefox_36b2_along_side_firefox_35">Installing Firefox 3.6b2 along side Firefox 3.5</h2>
<p>I think these are the instructions for having two Firefoxes:</p>
<p>Download the Beta DMG. Open it. <strong>Don&#8217;t just drag</strong> the Firefox icon into the provided Application symlink folder.</p>
<p><a href="http://www.mozilla.com/en-US/firefox/all-beta.html" target="_blank"><img src="http://img.skitch.com/20091113-ka45x4rutq43ifnwbdfnkyiksj.jpg" alt="firefox beta" /></a></p>
<p>Create in your Applications folder, create &#8220;beta&#8221; folder for all things beta (your you could rename the Firefox beta application or whatever). From the DMG window, drag the Firefox application icon into your &#8220;beta&#8221; folder.</p>
<p>To run it, close down Firefox if it&#8217;s running, and launch the new one. Done.</p>
<h2 id="creating_new_application_icons">Creating new Application icons</h2>
<p><a href="http://mocra.com/projects/iconmerge/" target="_blank">iConMerge</a> is a nice OS X tool to create composite application icons and install them. It is freeware from <a href="http://mocra.com/">Mocra</a>.</p>
<p><a href="http://mocra.com/project_downloads/iconmerge/iConMerge.dmg"><img src="http://img.skitch.com/20091113-nqy7gqe6n7rwqj6wpua8cibsf8.png"></a></p>
<p>You drag images or existing Applications into the two left slots and it automatically creates a composite icon. Press the <code>&lt;--&gt;</code> arrow to switch them.</p>
<p>See the project home page for instructions.</p>
<p>The &#8220;beta&#8221; sub-icon I used is below. Download it OR try dragging it directly from the browser into iConMerge.</p>
<p><img src="http://img.skitch.com/20091113-87ucaiauf1jy764i4qrmmh5utd.png" style="width: 80px"></p>
<h2 id="applying_new_icon_to_firefox_beta">Applying new icon to Firefox Beta</h2>
<p><img src="http://img.skitch.com/20091113-xhgyhxk8eiuanrs1au27k1pnmd.png" style="float: right"></p>
<p>Click &#8220;Export&#8221; and select the Firefox beta Application. Done.</p>
<p>When you restart Firefox beta, you&#8217;ll see it&#8217;s Dock icon has changed. </p>
<p>Right click on the Dock icon, select &#8220;Keep in Dock&#8221; and them drag the icon next to your existing Firefox 3.5 application. Two Firefoxes, two different icons, happy times.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/06/easy-scheduling-by-location-tasks-and-people-a-case-study-of-a-client-application-from-mocra/' rel='bookmark' title='Permanent Link: Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra'>Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra</a> <small> UPDATE: Orchestrate was reported in TechCrunch Several years ago...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/16/making-a-pretty-firefox-beta-application-icon/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dead simple JavaScript Unit Testing in Rails</title>
		<link>http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/</link>
		<comments>http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 03:30:23 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=650</guid>
		<description><![CDATA[Formats: Video/Screencast (410 Mb, torrent) &#124; Video only (vimeo) Start downloading the torrent now, read this article 37 times and the video might be ready to watch. Writing tests are great for helping you design and think out your code, and the bonus is you end up with a test suite to aide in fighting [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li><li><a href='http://drnicwilliams.com/presentations/' rel='bookmark' title='Permanent Link: Presentations'>Presentations</a> <small> RailsConf 2010: Contributing to Open Source Not sure how...</small></li><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li></ol>]]></description>
			<content:encoded><![CDATA[<div style="padding: 10px; background-color: black">
<a href="http://drnicwilliams.com/wp-content/uploads/torrents/Dead Simple Unit Testing - Dr Nic Williams - Rails Underground 2009.torrent"><img style="width: 100%" src="http://img.skitch.com/20091112-chanatee6aucyjqnxi54iaae3x.png" alt="Skills Matter : Rails Underground 2009: on Dead simple JavaScript Testing" /></a>
</div>
<p>Formats: <a href="http://drnicwilliams.com/wp-content/uploads/torrents/Dead Simple Unit Testing - Dr Nic Williams - Rails Underground 2009.torrent">Video/Screencast</a> (410 Mb, torrent) | <a href="http://skillsmatter.com/podcast/ajax-ria/dead-simple-javascript-unit-tests-in-rails-with-blue-ridge-and-screw-unit">Video only</a> (vimeo)</p>
<div class="notice">
<p>Start downloading the <a href="http://drnicwilliams.com/wp-content/uploads/torrents/Dead Simple Unit Testing - Dr Nic Williams - Rails Underground 2009.torrent">torrent</a> now, read this article 37 times and the video might be ready to watch.</p>
</div>
<p>Writing tests are great for helping you design and think out your code, and the bonus is you end up with a test suite to aide in fighting against regressions. Why? It&#8217;s embarrassing when your JavaScript doesn&#8217;t work in production.</p>
<p>But how do you get started with testing JavaScript? How do you make it easy? I mean, so easy that you&#8217;d feel stupid to not write tests?</p>
<p>And how do you know if your designer/HTML-chopper has broken your JavaScript? How do you find out if JavaScript is broken in CI builds? And what is the appropriate punishment for designers who break JavaScript?</p>
<p>Finally, it is now uber easy to get started: the <a href="http://github.com/relevance/blue-ridge">blue-ridge</a> plugin for Rails. (I previously <a href="http://drnicwilliams.com/2009/06/07/tdd-for-greasemonkey-scripts-and-introducing-ninja-search-js/">discussed it</a> near the bottom)</p>
<p>To spread the word, I travelled to London, England for the <a href="http://www.rails-underground.com/">Rails Underground</a> conference a few months ago. The presentation is <a href="http://skillsmatter.com/podcast/ajax-ria/dead-simple-javascript-unit-tests-in-rails-with-blue-ridge-and-screw-unit">now online</a> (recorded and published by SkillsMatter).</p>
<p>I was also recording the screen during the presentation and we&#8217;ve composited the two together (a la <a href="http://www.confreaks.com/">confreaks</a>) and it&#8217;s available via <a href="http://drnicwilliams.com/wp-content/uploads/torrents/Dead Simple Unit Testing - Dr Nic Williams - Rails Underground 2009.torrent">BitTorrent</a>. If you can seed for the next few days, that would be greatly appreciated too.</p>
<p>The talk is 45 minutes and questions are 6 mins. (I sadly don&#8217;t repeat into the microphone some of the questions because the room acoustics were good and everyone could hear everyone else&#8217;s questions. Sorry.)</p>
<p><a href="http://drnicwilliams.com/wp-content/uploads/torrents/Dead Simple Unit Testing - Dr Nic Williams - Rails Underground 2009.torrent">Go get it now</a>.</p>
<h2 id="why_blue_ridge">Why Blue Ridge?</h2>
<p>This recording was done in July 2009, a few months ago. Is Blue Ridge still the bees-knees? I think so. It has issues, edge cases and bugs, but I don&#8217;t think there is a similar nor better Rails extension that includes (out of the box) a headless test runner, a bundle of test libraries (Screw.Unit, Smoke, etc), Rails generators, and automated discovery of &#8220;the designer broke our JavaScript!&#8221; lynch-mobbing (see my branch below).</p>
<p>These are the things I want. If there&#8217;s a better testing environment (say on HTMLUnit instead of env.js), then I think the killer packaging is to bundle it all up, with the features above, so it is drop-in, dead simple to use.</p>
<h2 id="my_history_with_javascript_testing">My history with JavaScript testing</h2>
<p>In the introduction I talk about my life with JavaScript and testing. Here is the extended summary if it&#8217;s interesting to you at all:</p>
<ul>
<li>2005:
<ul>
<li>ASP.NET + Ajax == &#8220;crapola&#8221;</li>
<li>Rails promo: &#8220;easier to do Ajax than not to&#8221;</li>
<li>Inline JavaScript helpers</li>
</ul>
</li>
<li>2006:
<ul>
<li>RJS to generate JavaScript</li>
</ul>
</li>
<li>2007:
<ul>
<li>JavaScript only in its own files</li>
<li>Unobtrusive JavaScript</li>
<li>Got myself into terrible mess with MyConfPlan</li>
<li>How to test JavaScript?</li>
</ul>
</li>
<li>2008:
<ul>
<li>Figured out how to test it</li>
<li>Write a PeepCode but never published it</li>
<li>Wrote <a href="http://newjs.rubyforge.org/">newjs</a> and <a href="http://jsunittest.com/">jsunittest</a></li>
</ul>
</li>
<li>2009:
<ul>
<li>Found <a href="http://github.com/relevance/blue-ridge">BlueRidge plugin for Rails</a></li>
<li>Headless test runner</li>
<li>BDD tests via Screw.Unit</li>
<li>Generators</li>
</ul>
</li>
</ul>
<h2 id="miscellaneous">Miscellaneous</h2>
<p>I mention a couple of miscellaneous things. Here&#8217;s a summary.</p>
<p><a href="http://github.com/drnic/blue-ridge">My fork of blue-ridge</a> has the feature to render sample HTML from your templates. It wasn&#8217;t accepted into the primary blue-ridge library because it was rspec only. Perhaps someone can make it work for test/unit etc.</p>
<p>I alias the <code>script/generate</code> command:</p>
<pre><code>alias gen="script/generate"
</code></pre>
<p>I&#8217;m extending TextMate with Ciarán Walsh&#8217;s <a href="http://ciaranwal.sh/projectplus">ProjectPlus</a> plug-in (<a href="http://github.com/ciaran/projectplus/">source</a>). It&#8217;s sweet.</p>
<h2>Thanks</h2>
<p>Thanks to Mark Coleman for organising <a href="http://www.rails-underground.com/">Rails Underground</a>, inviting me over, and having the sessions recorded. And to SkillsMatter for recording and publishing the raw footage.</p>
<p>Thanks to <a href="http://bjeanes.com/">Bo Jeanes</a> for helping to get Final Cut Pro to mash the screencast and the SkillsMatter video into one video.</p>
<p>Thanks to Jack Chen for hacking some code to push the video up to s3 (when Transmit and BaconDrop were failing me)</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li><li><a href='http://drnicwilliams.com/presentations/' rel='bookmark' title='Permanent Link: Presentations'>Presentations</a> <small> RailsConf 2010: Contributing to Open Source Not sure how...</small></li><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Hacking someone&#8217;s gem with github and gemcutter</title>
		<link>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/</link>
		<comments>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 06:44:17 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Gems]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=635</guid>
		<description><![CDATA[Ever used a rubygem, found a bug, and just wanted to quickly bust out the big guns and fix it quickly? The gem command doesn&#8217;t come packed with a way to find the original source repository for a gem. At best, most gems at least come bundled with the complete source, tests and documentation. Some [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/21/migrating-project-websites-to-github-pages-with-sake-tasks-new-websites-with-jekyll_generator/' rel='bookmark' title='Permanent Link: Migrating project websites to github pages with sake tasks, new websites with jekyll_generator'>Migrating project websites to github pages with sake tasks, new websites with jekyll_generator</a> <small> Its almost Christmas time and that means presents. It...</small></li><li><a href='http://drnicwilliams.com/2008/12/11/future-proofing-your-ruby-code/' rel='bookmark' title='Permanent Link: Future proofing your Ruby code. Ruby 1.9.1 is coming.'>Future proofing your Ruby code. Ruby 1.9.1 is coming.</a> <small> Bugger. I&#8217;m a Ruby monogamist. I use the Ruby...</small></li><li><a href='http://drnicwilliams.com/2008/10/31/newgem-100-all-thanks-to-cucumber/' rel='bookmark' title='Permanent Link: newgem 1.0.0 all thanks to Cucumber'>newgem 1.0.0 all thanks to Cucumber</a> <small>The New Gem Generator (newgem) was exciting, moderately revolutionary, and...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20091104-fthwimr335wsm3rfgad9a7jh5k.jpg" alt="gemcutter" style="float: right"/></p>
<p>Ever used a rubygem, found a bug, and just wanted to quickly bust out the big guns and fix it quickly?</p>
<p>The <code>gem</code> command doesn&#8217;t come packed with a way to find the original source repository for a gem. At best, most gems at least come bundled with the complete source, tests and documentation. Some gems <a href="http://github.com/notahat/machinist/issues#issue/14">don&#8217;t</a>. Fair enough, since having access to the complete source via the gem still doesn&#8217;t allow you to fix a bug and share it with the world.</p>
<p>For that you access to the repo, a quick way to fork it, and a post-github way to share a gem version from yours truly.</p>
<p>The <code>github</code> gem and gemcutter are the modern day tools of master hackermanship.</p>
<h1 id="instant_forking_fun">Instant forking fun</h1>
<p>Let&#8217;s say you find a bug in a gem, say <code>rails</code>, and you want to go to town on its source.</p>
<p>You know the gem is called <code>rails</code> but you&#8217;ve no idea what the github repo is called. Never fear. </p>
<pre><code>$ gem sources -a http://gemcutter.org
$ sudo gem install github
$ gh clone --search rails
Select a repository to clone:
1.  rails/rails                         # Ruby on Rails
2.  technoweenie/restful-authentication # Generates common user ...
3.  justinfrench/formtastic             # A Rails form builder plugin ...
?
</code></pre>
<p>Press <code>1</code> and you&#8217;ll get a clone of <code>rails/rails</code>.</p>
<p>Alternately, if you want a fork or you know the exact user/repo already:</p>
<pre><code>$ gh clone rails/rails
</code></pre>
<p>Now, fork your own version:</p>
<pre><code>$ cd rails
$ gh fork
</code></pre>
<p>You now have your own fork. The <code>origin</code> remote also now points to your fork rather than the <code>rails/rails</code> repository:</p>
<pre><code>$ git remote show origin
* remote origin
  Fetch URL: git@github.com:drnic/rails.git
  Push  URL: git@github.com:drnic/rails.git
</code></pre>
<p>So, make your changes, push them. Send a pull request or github issue or lighthouse ticket or what have you.</p>
<p>Want to get to the github project home page for your fork?</p>
<pre><code>$ gh home
</code></pre>
<h1 id="instant_gem_sharing">Instant gem sharing</h1>
<p>Let&#8217;s say you patched the <code>rails</code> gem <a href="http://github.com/drnic/rails/commit/3c26910cfd5aa4b484d63e912b3881c31f19782a">itself</a> but you want to share your changes via your own gem.</p>
<p>In the olden days, github did this for you. Now you use <a href="http://gemcutter.org/">gemcutter</a>, and a little manual effort to do your own renaming.</p>
<p>First, install the gems locally, use them, and make sure all is good.</p>
<p>For rails, you install the edge gems (3.0.pre) with:</p>
<pre><code>$ rake install
</code></pre>
<p>You can&#8217;t see &#8216;rake install&#8217; in the <code>rake -T</code> list (hence my patch), but I think the following expression displays all tasks regardless if they have a description or not:</p>
<pre><code>$ rake -P | grep "^r"
</code></pre>
<p>Rails is composed of several gems, unlike most projects that are distributed as a single gem. Here we want to share our commit within a new <code>drnic-rails</code> gem, but not touch the others.</p>
<p>Edit the <code>railties/rails.gemspec</code> file from:</p>
<pre><code>Gem::Specification.new do |s|
  s.platform = Gem::Platform::RUBY
  s.name = 'rails'
  s.version = '3.0.pre'
...
</code></pre>
<p>and give your personal gem a new name:</p>
<pre><code>Gem::Specification.new do |s|
  s.platform = Gem::Platform::RUBY
  s.name = 'drnic-rails'
  s.version = '3.0.pre'
</code></pre>
<p>To build and distribute the new gem:</p>
<pre><code>$ gem build railties/rails.gemspec
$ sudo gem install gemcutter
$ gem push drnic-rails-3.0.pre.gem
  Pushing gem to Gemcutter...
  Successfully registered gem: drnic-rails (3.0.pre)
</code></pre>
<p>Follow any first-time gemcutter instructions and SUCCESS! Now I have my own <a href="http://gemcutter.org/gems/drnic-rails">drnic-rails</a> gem.</p>
<h1 id="summary">Summary</h1>
<p>To find, clone, and fork any rubygem that is hosted on github:</p>
<pre><code>$ sudo gem install drnic-github
$ gh clone --search rails
$ gh fork
</code></pre>
<p>To personalise the gem and share it on gemcutter:</p>
<pre><code>&gt; edit the project.gemspec to have a unique name, e.g. yourname-project
$ gem build project.gemspec
$ sudo gem install gemcutter
$ gem push yourname-project-1.0.0.gem
</code></pre>
<p>I think this makes it much easier, faster and more fun to hack other people&#8217;s stuff.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/21/migrating-project-websites-to-github-pages-with-sake-tasks-new-websites-with-jekyll_generator/' rel='bookmark' title='Permanent Link: Migrating project websites to github pages with sake tasks, new websites with jekyll_generator'>Migrating project websites to github pages with sake tasks, new websites with jekyll_generator</a> <small> Its almost Christmas time and that means presents. It...</small></li><li><a href='http://drnicwilliams.com/2008/12/11/future-proofing-your-ruby-code/' rel='bookmark' title='Permanent Link: Future proofing your Ruby code. Ruby 1.9.1 is coming.'>Future proofing your Ruby code. Ruby 1.9.1 is coming.</a> <small> Bugger. I&#8217;m a Ruby monogamist. I use the Ruby...</small></li><li><a href='http://drnicwilliams.com/2008/10/31/newgem-100-all-thanks-to-cucumber/' rel='bookmark' title='Permanent Link: newgem 1.0.0 all thanks to Cucumber'>newgem 1.0.0 all thanks to Cucumber</a> <small>The New Gem Generator (newgem) was exciting, moderately revolutionary, and...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>First look at rails 3.0.pre</title>
		<link>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/</link>
		<comments>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 04:05:16 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=630</guid>
		<description><![CDATA[This article is out of date in some aspects. See comments, and perhaps this summary of reading materials about Rails 3. Today I had my first look at rails 3.0.pre and below are the sequence of steps I had to take to create a rails 3.0.pre application, and get it&#8217;s generators to work. Why was [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li><li><a href='http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/' rel='bookmark' title='Permanent Link: Dead simple JavaScript Unit Testing in Rails'>Dead simple JavaScript Unit Testing in Rails</a> <small> Formats: Video/Screencast (410 Mb, torrent) | Video only (vimeo)...</small></li><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="notice">
<p>This article is out of date in some aspects. See <a href="http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/#comments">comments</a>, and perhaps this summary of <a href="http://mediumexposure.com/rails-3-reading-material/">reading materials</a> about Rails 3.</p>
</div>
<p><img src="http://img.skitch.com/20091103-q3w8qjy8wmr3e9wasjqc95nf6g.jpg" alt="3.pre" style="float: right" /></p>
<p>Today I had my first look at rails 3.0.pre and below are the sequence of steps I had to take to create a rails 3.0.pre application, and get it&#8217;s generators to work.</p>
<p>Why was I looking at the top-secret, yet open-source Rails 3.0? Their generators are being migrated over to Thor and I wanted to see them in action. I was thinking I might migrate newgem to use Thor too.</p>
<p>Here&#8217;s a quick poke around of getting started and interesting things I found. Any hiccups and workarounds are meant as a guide to pre-pre-3.0 users/developers and not as a criticism of rails-core. Rails 3.0 is looking shiny and awesome.</p>
<p>NOTE: Since this is a &#8220;how to install and use&#8221; rails 3.0 edge, which is still in heavy development, this set of instructions might break. Let&#8217;s hope not.</p>
<h2 id="getting_started">Getting Started</h2>
<p>As of today, you cannot install 3.0.pre from rubygems [1]. So, let&#8217;s install them from source. Which is handy, you might like to patch something.</p>
<pre><code>$ cd ~/gems
$ git clone git://github.com/rails/rails.git
use_ruby_191 *
</code></pre>
<p>[*] If you are on OS X Snow Leopard I think you can ignore this. Otherwise, since you don&#8217;t have the 3.0.pre gems installed, you&#8217;re about to hit bump #1. Ruby 1.8.6 doesn&#8217;t have <code>Symbol#to_proc</code> but it&#8217;s required to create a rails app. This means you&#8217;ll need to be able to switch to another version of ruby temporarily if you&#8217;re on ruby 1.8.6 [2].</p>
<pre><code>cd ~/Sites
ruby ~/gems/rails/railties/bin/rails
</code></pre>
<p>Oooh, look at all the new options! Some new ones are:</p>
<pre><code>-F, [--freeze]             # Freeze Rails in vendor/rails from the gems
-O, [--skip-activerecord]  # Skip ActiveRecord files
-T, [--skip-testunit]      # Skip TestUnit files
-J, [--skip-prototype]     # Skip Prototype files
</code></pre>
<p>The <code>-D, --with-dispatchers</code> flags have been removed. <code>--freeze</code> isn&#8217;t new, but <code>-F</code> is.</p>
<p>So, to create an app, I dutifully used:</p>
<pre><code>ruby ~/gems/rails/railties/bin/rails edgerailsapp -F
</code></pre>
<p>BAM! Fail. The -F option to freeze/vendor rails fails without the gems installed. So don&#8217;t use it.</p>
<pre><code>ruby ~/gems/rails/railties/bin/rails edgerailsapp
ln -s ~/gems/rails vendor/rails
</code></pre>
<p>If you&#8217;re on Windows without the symlink command <code>ln</code>, then copy the downloaded rails source into <code>vendor/rails</code>.</p>
<h3 id="fetch_rails8217_dependencies">Fetch Rails&#8217; dependencies</h3>
<p>Rails 3.0 source uses the new bundler project to describe its own dependencies. From <a href="http://litanyagainstfear.com/blog/2009/10/14/gem-bundler-is-the-future/">Nick Quaranto&#8217;s article on bundler</a>, get the latest:</p>
<pre><code>cd ~/gems
git clone git://github.com/wycats/bundler
cd bundler
sudo rake install
</code></pre>
<p>Now, back in your app, you need to install some rails dependencies here too. It&#8217;s a good chance to see how you&#8217;ll bundle gem dependencies in the future.</p>
<pre><code>$ cd ~/Sites/edgerailsapp
</code></pre>
<p>Change the <code>Gemfile</code> in your project to the following:</p>
<pre><code>gem "rack",          "1.0.1"
gem "rack-mount",    :git =&gt; "git://github.com/rails/rack-mount.git"
gem "rack-test",     "~&gt; 0.5.0"
gem "erubis",        "~&gt; 2.6.0"
gem "arel",          :git =&gt; "git://github.com/rails/arel.git"
gem "sqlite3-ruby"
gem "rails", "3.0.pre", :git =&gt; "git://github.com/rails/rails.git"
</code></pre>
<p>Welcome to the future of gem dependencies for rails apps. Ultimately you won&#8217;t need to manually add these lines yourself. When rails is distributed as gems it will automatically install these for you, I assume/hope/guess. But for today, you seem to need them.</p>
<p>Now locally (within your app) install these gems:</p>
<pre><code>$ gem bundle
</code></pre>
<p>If you get &#8220;can&#8217;t convert Pathname into String&#8221; then revert to ruby 1.8.X and reinstall bundler into your 1.8 gem cache.</p>
<p>Phew. Ooh, my god. Phew. Only now will <code>script/generate</code> work.</p>
<pre><code>$ script/generate
</code></pre>
<p>For me, this outputs:</p>
<pre><code>Please select a generator.
Builtin: app, controller, generator, helper, integration_test, mailer, metal, migration, model, model_subclass, observer, performance_test, plugin, resource, scaffold, scaffold_controller, session_migration, stylesheets.
Others: app_layout:app_layout, check_migration_version:check_migration_version, home_route:home_route.
</code></pre>
<p>The &#8220;Builtin&#8221; generators are the latest and greatest in Thor technology. Rails 3.0 no longer uses its own generator but is built upon Thor.</p>
<p>For example, our old favourite <code>model</code> generator works thusly:</p>
<pre><code>$ script/generate model Post title:string --no-fixture
    invoke  active_record
    create    db/migrate/20091103030824_create_posts.rb
    create    app/models/post.rb
    invoke    test_unit
    create      test/unit/post_test.rb
</code></pre>
<p>Interestingly, <code>--no-fixture</code> isn&#8217;t mentioned in the usage information for <code>script/generate model</code>. It mentions the <code>--fixture</code> flag, but I had to guess that <code>--no-fixture</code> was also supported.</p>
<p>Hmm, I want to use rspec. So, let&#8217;s destroy these files:</p>
<pre><code>$ script/destroy model Post title:string
      invoke  active_record
.../vendor/gems/dirs/rails/railties/lib/rails/generators/active_record.rb:14:in
  `next_migration_number': uninitialized constant ActiveRecord::Base (NameError)
</code></pre>
<p>Oh well.</p>
<p>What if I wanted to run rspec and cucumber generators, for example, against an edge rails app?</p>
<h2 id="rails_2_generators">Rails 2 generators</h2>
<p>The &#8220;Others&#8221; generators are my own local generators from <code>~/.rails/generators</code>. Amusingly, instead of <code>app_layout</code> it is called <code>app_layout:app_layout</code>. Not surprisingly at all, if I try to run the rails 2 generator it fails:</p>
<pre><code>$ script/generate app_layout:app_layout
[WARNING] Could not load generator at "/Users/drnic/.rails/generators/app_layout/app_layout_generator.rb". Error: uninitialized constant Rails::Generator
Could not find generator app_layout:app_layout.
</code></pre>
<p>Poop. </p>
<p>Note, I have rspec, rspec-rails and cucumber gems installed locally but I cannot see their rails generators above. Rails 3 doesn&#8217;t look for generators in the same way and old Rails 2 generators don&#8217;t work anymore.</p>
<p>That&#8217;s the news: every rails 2 generator is broken. </p>
<p>When I start to migrate some of mine I&#8217;ll post about it. In the meantime, <a href="http://twitter.com/josevalim">José Valim</a> has written some introduction thoughts on <a href="http://blog.plataformatec.com.br/2009/07/creating-your-own-generators-with-thor/">using Thor as a generator</a>.</p>
<p>You can also probably learn about how to write rails 3.0 generators by looking at the source code for the new generators like <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/app_generator.rb">rails</a>, model (see <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/model/model_generator.rb">main</a> and  <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/test_unit/model/model_generator.rb">test_unit</a>), and <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/resource/resource_generator.rb">scaffold/resource</a>.</p>
<p>Finally, José Valim has a <a href="http://github.com/josevalim/third_rails">sample Rails 3 app</a> with some vendored generators in it.</p>
<p>These are the things I&#8217;m researching now.</p>
<h2 id="summary">Summary</h2>
<p>This article is long, mostly because rails 3.0.pre hasn&#8217;t been released as a set of RubyGems. If it had, then all the dependencies would be installed automatically.</p>
<p>It also introduces gem/plugin writers to the first upgrade issue: your current generators are neither discovered nor work by a rails 3.0 app. We&#8217;re all clever cookies, so here&#8217;s hoping we can figure out the upgrade path and that it&#8217;s simple enough to not be the topic of Dan Brown&#8217;s next book.</p>
<h2 id="footnotes">Footnotes</h2>
<p>[1] Two portions of rails 3.0.pre are available as pre-release gems: activesupport (which is now very modularised and only loads up the parts that you require) and activemodel (which is shiny and new and hence completely safe for rails-core to release).</p>
<p>[2] There are two popular ways to have easy, non-intrusive access to alternate versions of ruby: <a href="http://www.rubyinside.com/rvm-ruby-version-manager-2347.html">rvm</a> and <a href="http://blog.thinkrelevance.com/2009/7/29/ruby-switcher-working-with-multiple-ruby-versions-has-never-been-this-easy">ruby_switcher.sh</a>.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2010/03/15/using-coffeescript-in-rails-and-even-on-heroku/' rel='bookmark' title='Permanent Link: Using CoffeeScript in Rails and even on Heroku'>Using CoffeeScript in Rails and even on Heroku</a> <small>I&#8217;m pretty excited about CoffeeScript as a clean-syntax replacement for...</small></li><li><a href='http://drnicwilliams.com/2009/11/12/dead-simple-javascript-unit-testing-in-rails/' rel='bookmark' title='Permanent Link: Dead simple JavaScript Unit Testing in Rails'>Dead simple JavaScript Unit Testing in Rails</a> <small> Formats: Video/Screencast (410 Mb, torrent) | Video only (vimeo)...</small></li><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
	</channel>
</rss>
