<?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 &#187; RubiGen</title>
	<atom:link href="http://drnicwilliams.com/category/rubigen/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, 03 Aug 2010 23:44:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>One-stop JavaScript Unit Testing for Rails 2.0</title>
		<link>http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/</link>
		<comments>http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 04:08:30 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[RubiGen]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[newjs]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/</guid>
		<description><![CDATA[Previously, I mentioned a multi-step/multi-project solution to doing JavaScript Unit Testing for Rails, including an autotest script to make TDD life easier for the autotest-addicted. It was too many steps, too many different projects, and too much dependence on prototypejs. So let&#8217;s fix this via the spanky new newjs (introduced here): Instead of several steps, [...]


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/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><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[<p><a href="http://drnicwilliams.com/2008/01/04/autotesting-javascript-in-rails/">Previously</a>, I mentioned a multi-step/multi-project solution to doing JavaScript Unit Testing for Rails, including an autotest script to make TDD life easier for the autotest-addicted.</p>
<p>It was too many steps, too many different projects, and too much dependence on <a href="http://prototypejs.org">prototypejs</a>. So let&#8217;s fix this via the spanky new <a href="http://newjs.rubyforge.org">newjs</a> (<a href="http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/">introduced here</a>):</p>
<p>Instead of several steps, there is now two steps:</p>
<pre>
cd myrailsapp                # rails 2.0 app
sudo gem install newjs       # v1.3.1+
script/generate javascript_test application
    create  vendor/plugins/javascript_unittest/lib
    create  vendor/plugins/javascript_unittest/tasks
    create  test/javascript/assets/jsunittest.js
    create  test/javascript/assets/unittest.css
    create  config/javascript_test_autotest.yml.sample
    create  vendor/plugins/javascript_unittest/lib/jstest.rb
    create  vendor/plugins/javascript_unittest/tasks/runner.rake
    create  vendor/plugins/javascript_unittest/tasks/autotest.rake
    create  vendor/plugins/javascript_unittest/README
    create  test/javascript/application_test.html
    create  script/rstakeout
    create  script/js_autotest
</pre>
<p>It installs all assets, gives you a <code>rake test:javascripts</code> task, gives you <code>script/js_autotest</code>, and finally (and most importantly), creates the <code>application_test.html</code> test stub.</p>
<p>As always, you can also run a single test file by loading it into a browser.</p>
<h3 id="prototype_independence">Prototype independence</h3>
<p>Previously, the test suite &#8211; unittest.js &#8211; had a dependency on <a href="http://prototypejs.org">prototypejs</a>. This was wonderful if you&#8217;re developing in prototypejs, but could cause some grief if you weren&#8217;t.</p>
<p><a href="http://newjs.rubyforge.org">newjs</a> now comes packed with an identical test suite &#8211; <a href="http://jsunittest.rubyforge.org">jsunittest</a> &#8211; but it is built without a dependency on prototypejs.</p>
<h3 id="merb_et_al_support">Merb et al support</h3>
<p>I wrote a rails generator because I used Rails. If a merb/other framework (Ruby or non-Ruby) wants a similar generator, just ask. Its pretty simple &#8211; I copy over the <code>rails_generators</code> folder into a <code>merb_generators</code> folder in <code>newjs</code> and change some things based on your frameworks&#8217; structure.</p>
<h3 id="alternate_test_suite_support">Alternate test suite support</h3>
<p>If you like another test suite, and want it included in the generators, this might require some additional effort on your part. It probably has different mechanisms for launching runners etc; whereas I was able to steal the rake tests + support libraries from prototypejs. But, it can be done.</p>
<h3 id="peepcode">Peepcode</h3>
<p>These tools will be discussed in animated detail in the forth coming Peepcode &#8220;JavaScript Unit Testing&#8221;.</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/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><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/2008/02/19/one-stop-javascript-unit-testing-for-rails2/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>newjs = newgem for JavaScript projects; free TDD suite</title>
		<link>http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/</link>
		<comments>http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 05:06:13 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[RubiGen]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/</guid>
		<description><![CDATA[Want to start a new JavaScript project for a library or widget/badge for your website? You know you should do TDD but wouldn&#8217;t know how to get started, what support libraries you need and where to get them from? You need tools to deploy your library, your website etc? You&#8217;d like a consistent structure to [...]


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/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><li><a href='http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/' rel='bookmark' title='Permanent Link: One-stop JavaScript Unit Testing for Rails 2.0'>One-stop JavaScript Unit Testing for Rails 2.0</a> <small>Previously, I mentioned a multi-step/multi-project solution to doing JavaScript Unit...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Want to start a new JavaScript project for a library or widget/badge for your website?</p>
<p>You know you should do TDD but wouldn&#8217;t know how to get started, what support libraries you need and where to get them from? </p>
<p>You need tools to deploy your library, your website etc?</p>
<p>You&#8217;d like a consistent structure to your project so that IDEs could provide support (toggle btw  src/person.js and test/unit/person_test.html) [I haven&#8217;t done this bit yet, I&#8217;m sure I&#8217;ll add it to the <a href="http://github.com/drnic/javascript-unittest-tmbundle/tree/master">JavaScipt Unit testing</a> textmate bundle one day soon].</p>
<p>I couldn&#8217;t find anything helpful like this, so I created <code>newjs</code> &#8211; the <a href="http://newjs.rubyforge.org">JavaScript Project Generator</a>.</p>
<h3 id="why">Why?</h3>
<p>But first, an brief history of everything&#8230;</p>
<p>I fell instantly in love with Rails for a couple reasons:</p>
<ul>
<li><code>rails</code> &amp; <code>script/generate</code> commands &#8211; they teach you what files you need<br />
and where they should go</li>
<li>Ajax support &#8211; the marketing phrase &#8220;its as easy to use Ajax as not to&#8221; took me<br />
away from ASP.NET where the new Ajax.NET library was non-trivial to use; RJS<br />
didn&#8217;t exist at this stage, but Rails&#8217; JavaScript support was still awesome</li>
<li>TextMate &#8211; though I didn&#8217;t get to use it for 18 mths til I bought a Mac</li>
</ul>
<p>Later I fell in love with Ruby, for its meta-programming, syntactical possibilities<br />
and free TDD support within Rails.</p>
<p>Then I fell out of love with JavaScript. Partly because Rails started generating JavaScript for me, and ultimately because I didn&#8217;t have test support. Whether you use Rails JavaScript helpers, or write your own unobtrusive JavaScript libraries you&#8217;re still living in an unhappy world without tests; let alone without TDD.</p>
<p>I still wrote JavaScript because it still needed writing. But a lot of my JavaScript<br />
became &#8220;write-once, modify-never&#8221; affairs. Not just because I had no tests,<br />
but each project had a different structure, different deployment processes, etc.</p>
<p>Finally, this year I figured out &#8220;TDD for JavaScript&#8221;. For every 1000 blog articles about Rails or Ruby, there is 0-1 article on unit testing JavaScript. Or perhaps I just don&#8217;t know how to use Google. Soon, the &#8220;JavaScript Unit Testing&#8221; <a href="http://peepcode.com">PeepCode</a> will be finished, so hopefully it will add to this lacking body of knowledge.</p>
<p>What I needed now was one-line starter-kit for new JavaScript projects that included:</p>
<ul>
<li>A standard structure for JavaScript libraries/projects</li>
<li>In-built testing support, with <code>rake</code> tasks and <code>script/generate unit_test</code><br />
generators</li>
<li>Tasks for deploying distribution files (via version numbers)</li>
<li>Tasks for managing the project website</li>
</ul>
<p>I don&#8217;t think there is one already, thus my hand was forced: <a href="http://newjs.rubyforge.org">newjs</a>.</p>
<h3 id="installation_getting_started">Installation &amp; Getting Started</h3>
<p>Installation and maintenance of generated JavaScript projects requires the installation of <a href="http://www.ruby-lang.org/">Ruby</a> and <a href="http://rubygems.org/">RubyGems</a>.</p>
<p>The command-line application <code>newjs</code> is installed as below, for any operating system (except the &#8216;sudo&#8217; part &#8211; use as necessary):</p>
<pre>sudo gem install newjs</pre>
<p>You&#8217;ll note it uses <a href="http://rubigen.rubyforge.org">RubiGen</a> because I like to cheat when it comes to generating things.</p>
<p>To kick-off your new project/library, run the command-line app <code>newjs</code>:</p>
<pre>$ newjs mylib -a "Dr Nic" -e "drnicwilliams@gmail.com" -u "http://mylib.rubyforge.org"
      create  config
      create  lib
      create  src
      create  script
      create  tasks
      create  test/assets
      create  test/assets/unittest.css
      create  test/assets/unittest.js
      create  test/assets/prototype.js
      create  tasks/javascript_test_autotest_tasks.rake
      create  tasks/environment.rake
      create  tasks/deploy.rake
      create  config/javascript_test_autotest.yml.sample
      create  lib/protodoc.rb
      create  lib/jstest.rb
      create  Rakefile
      create  README.txt
      create  History.txt
      create  License.txt
      create  src/HEADER
      create  src/mylib.js
      create  script/rstakeout
      create  script/js_autotest
  dependency  install_rubigen_scripts
      exists    script
      create    script/generate
      create    script/destroy
</pre>
<p>And you thought you wanted to create all that by hand&#8230;</p>
<h3 id="tdd_for_javascript">TDD for JavaScript</h3>
<p>Personally, I can never remember what basic HTML + JavaScript goes in the test HTML files. I quite like the <a href="http://drnicwilliams.com/2008/01/04/autotesting-javascript-in-rails/">javascript_test plugin</a> for Rails, which allows you to generate a test HTML stub. So I&#8217;ve included a version of it<br />
here.</p>
<p>Two actually: one for unit tests and one for functional tests.</p>
<pre>$ script/generate unit_test some_lib
  create  test/unit
  create  test/unit/some_lib_test.html
</pre>
<p>For functional tests, use <code>functional_test</code> generator. See the <a href="http://newjs.rubyforge.org">newjs site</a> for more details.</p>
<h3 id="lifecycle_of_javascript_files">Lifecycle of JavaScript files</h3>
<p>You create JavaScript files in <code>src/</code> and then when you run <code>rake dist</code><br />
they can compressed into <code>dist/project_name.js</code>. </p>
<p>To make this work, add new <code>src/</code> files into <code>src/project_name.js</code> via<br />
<code>&lt;%= include "file_name.js" %&gt;</code>.</p>
<p>This is the build mechanism used by <a href="http://prototypejs.org" alt="PrototypeJS">prototypejs</a> and I stole it. Actually, I stole nearly everything from the prototypejs source structure.</p>
<h3 id="other_stuff">Other stuff</h3>
<p>Like <a href="http://newgem.rubyforge.org">newgem</a> you can create a simple website (via textile files):</p>
<pre>script/generate install_website
</pre>
<p>BONUS: instead of the crap purple default theme for <code>newgem</code>, <code>newjs</code> websites have a nice yellow theme &#8211; <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers/" alt=" Dr Nic’s JavaScript Test Helpers">see example</a>.</p>
<h3 id="source">Source for newjs</h3>
<p>Get it via git: <a href="http://github.com/drnic/newjs/tree/master">master branch</a></p>
<h3 id="credits">Credits</h3>
<p>The generated structure, the unittest.js test suite, and its included help files mostly come from <a href="http://prototypejs.org PrototypeJS">prototypejs</a> and <a href="http://newgem.rubyforge.org">newgem</a>.</p>
<p>The generator mechanism is from <a href="http://rubigen.rubyforge.org">RubiGem</a> which comes from the Rails Generator created by Jeremy &#8220;<a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html">I made someone leave Rails for PHP</a>&#8221; Kemper.</p>
<p>Actually, I stole nearly everything from the prototypejs source structure. They are much cleverer than I am.</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/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><li><a href='http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/' rel='bookmark' title='Permanent Link: One-stop JavaScript Unit Testing for Rails 2.0'>One-stop JavaScript Unit Testing for Rails 2.0</a> <small>Previously, I mentioned a multi-step/multi-project solution to doing JavaScript Unit...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Merb 0.4 &#8211; Installing Edge Merb and using new Generators</title>
		<link>http://drnicwilliams.com/2007/11/05/merb-04-installing-edge-merb-and-using-new-generators/</link>
		<comments>http://drnicwilliams.com/2007/11/05/merb-04-installing-edge-merb-and-using-new-generators/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 20:44:12 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Merb]]></category>
		<category><![CDATA[RubiGen]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2007/11/05/merb-04-installing-edge-merb-and-using-new-generators/</guid>
		<description><![CDATA[Merb 0.4 will include generators (via RubiGen) to make it uber-easy for developers to create Merb apps. Here&#8217;s a HOWTO screencast (lifted from rubyconf talk) on getting the required gems from SVN, and setting up a Merb to use ActiveRecord. The video also shows how your generated model/controllers can either have test::unit OR rspec test [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2008/05/12/textmate-bundles-for-merb/' rel='bookmark' title='Permanent Link: TextMate bundles for Merb'>TextMate bundles for Merb</a> <small>If you are using TextMate (OS X) or E Text...</small></li><li><a href='http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/' rel='bookmark' title='Permanent Link: One-stop JavaScript Unit Testing for Rails 2.0'>One-stop JavaScript Unit Testing for Rails 2.0</a> <small>Previously, I mentioned a multi-step/multi-project solution to doing JavaScript Unit...</small></li><li><a href='http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/' rel='bookmark' title='Permanent Link: NewGem Generator &#8211; now with script/generate'>NewGem Generator &#8211; now with script/generate</a> <small>The New Gem Generator (0.13.0)&#8217;s newgem command now behaves like...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://merbivore.com">Merb 0.4</a> will include generators (via RubiGen) to make it uber-easy for developers to create Merb apps. Here&#8217;s a HOWTO screencast (lifted from <a href="http://drnicwilliams.com/2007/11/05/rubigen-meets-the-a-team-live-in-charlotte/">rubyconf talk</a>) on getting the required gems from SVN, and setting up a Merb to use ActiveRecord.</p>
<p>The video also shows how your generated model/controllers can either have test::unit OR rspec test files generated. </p>
<p>As Albert Einstein said &#8220;All your base belong to us.&#8221;</p>
<p><object type="application/x-shockwave-flash" width="550" height="440" data="http://vimeo.com/moogaloop.swf?clip_id=372998&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=01AAEA"><param name="quality" value="best" /><param name="allowfullscreen" value="true" /><param name="scale" value="showAll" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=372998&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=01AAEA" /></object><br /><a href="http://vimeo.com/372998/l:embed_372998">Installing Edge Merb and using new Generators</a> from <a href="http://vimeo.com/user138279/l:embed_372998">probablycorey</a> on <a href="http://vimeo.com/l:embed_372998">Vimeo</a>.</p>
<p>Alternately, download the <a href="http://drnicwilliams.com/wp-content/videos/Merb-0.4 demo.mov">800&#215;600 QuickTime version</a> (22Mb).</p>
<p><strong>Errata:</strong> </p>
<ol>
<li>To change between rspec and test::unit (or between different ORMs), use <code>Merb::GENERATOR_SCOPE</code> found in config/merb_init.rb, rather than hack script/generate as I do in the video <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>Prior to following the video tutorial, you need to checkout the two edge gem sources:</li>
</ol>
<pre>
svn co http://svn.devjavu.com/merb/trunk merb
svn co http://svn.devjavu.com/merb/plugins/merb_activerecord
</pre>
<p>The videos don&#8217;t have voice overs, because if I&#8217;d done that then I&#8217;d have been completely bored when I gave my talk. As it was, I think half my talk was videos and screencasts &#8211; I felt like a TV host&#8230; it was odd. But, you&#8217;ll get the gist.</p>
<p>For more step-by-step instructions, see the man who helped write the Merb generators &#8211; <a href="http://hassox.blogspot.com/2007/11/new-merb-generators.html">Daniel Neighman</a> (irc &#8211; hassox).</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2008/05/12/textmate-bundles-for-merb/' rel='bookmark' title='Permanent Link: TextMate bundles for Merb'>TextMate bundles for Merb</a> <small>If you are using TextMate (OS X) or E Text...</small></li><li><a href='http://drnicwilliams.com/2008/02/19/one-stop-javascript-unit-testing-for-rails2/' rel='bookmark' title='Permanent Link: One-stop JavaScript Unit Testing for Rails 2.0'>One-stop JavaScript Unit Testing for Rails 2.0</a> <small>Previously, I mentioned a multi-step/multi-project solution to doing JavaScript Unit...</small></li><li><a href='http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/' rel='bookmark' title='Permanent Link: NewGem Generator &#8211; now with script/generate'>NewGem Generator &#8211; now with script/generate</a> <small>The New Gem Generator (0.13.0)&#8217;s newgem command now behaves like...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2007/11/05/merb-04-installing-edge-merb-and-using-new-generators/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dr Nic at RubyConf 2007 &#8211; RubiGen &#8211; Teaser</title>
		<link>http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/</link>
		<comments>http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 23:44:22 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[RubiGen]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/</guid>
		<description><![CDATA[4th of November 2007 &#8211; 9am &#8211; main conference room &#8211; RubyConf 2007&#8230;. comes &#8230; RubiGen. Turn up the volume and enjoy that 80s theme music&#8230; Can&#8217;t see the video? Related posts:RubiGen meets the A-Team &#8211; live in Charlotte I previously posted the stunningly realistic teaser/trailer for my RubyConf...RubiGen video from RejectConf Berlin Go straight [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2007/11/05/rubigen-meets-the-a-team-live-in-charlotte/' rel='bookmark' title='Permanent Link: RubiGen meets the A-Team &#8211; live in Charlotte'>RubiGen meets the A-Team &#8211; live in Charlotte</a> <small>I previously posted the stunningly realistic teaser/trailer for my RubyConf...</small></li><li><a href='http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/' rel='bookmark' title='Permanent Link: RubiGen video from RejectConf Berlin'>RubiGen video from RejectConf Berlin</a> <small>Go straight to video below I took a video recorder...</small></li><li><a href='http://drnicwilliams.com/2007/05/10/rejectconf-at-railsconf/' rel='bookmark' title='Permanent Link: RejectConf at RailsConf'>RejectConf at RailsConf</a> <small>At last year&#8217;s RubyConf, Ryan Davis (zenspider) and Jacob Harris...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>4th of November 2007 &#8211; 9am &#8211; main conference room &#8211; RubyConf 2007&#8230;. comes &#8230; <a href="http://rubigen.rubyforge.org">RubiGen</a>.</p>
<p>Turn up the volume and enjoy that 80s theme music&#8230;</p>
<p><object width="550" height="453"><param name="movie" value="http://www.youtube.com/v/TB-hiJ8wMKM"></param> <embed src="http://www.youtube.com/v/TB-hiJ8wMKM" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
<p><a href="http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/">Can&#8217;t see the video?</a></p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2007/11/05/rubigen-meets-the-a-team-live-in-charlotte/' rel='bookmark' title='Permanent Link: RubiGen meets the A-Team &#8211; live in Charlotte'>RubiGen meets the A-Team &#8211; live in Charlotte</a> <small>I previously posted the stunningly realistic teaser/trailer for my RubyConf...</small></li><li><a href='http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/' rel='bookmark' title='Permanent Link: RubiGen video from RejectConf Berlin'>RubiGen video from RejectConf Berlin</a> <small>Go straight to video below I took a video recorder...</small></li><li><a href='http://drnicwilliams.com/2007/05/10/rejectconf-at-railsconf/' rel='bookmark' title='Permanent Link: RejectConf at RailsConf'>RejectConf at RailsConf</a> <small>At last year&#8217;s RubyConf, Ryan Davis (zenspider) and Jacob Harris...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>RubiGen video from RejectConf Berlin</title>
		<link>http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/</link>
		<comments>http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 19:06:37 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[NewGem]]></category>
		<category><![CDATA[RubiGen]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/</guid>
		<description><![CDATA[Go straight to video below I took a video recorder to the RejectConf, like I did in Portland. Unfortunately, there were two reasons I didn&#8217;t record any of them. Firstly, there didn&#8217;t seem to be any obvious place to position the camera. Secondly, it was deemed critical that everyone does their talks in the dark. [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/' rel='bookmark' title='Permanent Link: Dr Nic at RubyConf 2007 &#8211; RubiGen &#8211; Teaser'>Dr Nic at RubyConf 2007 &#8211; RubiGen &#8211; Teaser</a> <small>4th of November 2007 &#8211; 9am &#8211; main conference room...</small></li><li><a href='http://drnicwilliams.com/2007/06/02/ze-frank-at-railsconf-like-ted/' rel='bookmark' title='Permanent Link: Missed Ze Frank at Railsconf? [video]'>Missed Ze Frank at Railsconf? [video]</a> <small>Neat. Here is Ze Frank at TED 20062004 [thx Erik...</small></li><li><a href='http://drnicwilliams.com/2007/05/27/new-gem-generates-gets-rspec-video/' rel='bookmark' title='Permanent Link: New Gem Generator gets RSpec [video]'>New Gem Generator gets RSpec [video]</a> <small> One day you will be able to write a...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="#rubigen-rejectconf-video">Go straight to video below</a></p>
<p>I took a video recorder to the RejectConf, like I did in Portland. Unfortunately, there were two reasons I didn&#8217;t record any of them.</p>
<p>Firstly, there didn&#8217;t seem to be any obvious place to position the camera.</p>
<p>Secondly, it was deemed critical that everyone does their talks in the dark. The conference isn&#8217;t run in the dark, local Ruby groups don&#8217;t run meetings in the dark but consecutive RejectConfs have been run by adminstrators with a dark fetish. Great for drinking beer and heckling presenters. Bad for video recording.</p>
<p>The makers of the <a href="http://www.jvc.com/presentations/everio_g/">JVC HDD camcorder</a> &#8211; a nifty device with a 20G HDD in it &#8211; don&#8217;t make it possible to record in the dark. Not because it doesn&#8217;t have a &#8220;night time mode&#8221; &#8211; apparently it does &#8211; but when you are already in the dark, you can&#8217;t figure out how to turn it on.</p>
<p>Ok, fine, if I&#8217;d made an effort I could have figured it out. So, let&#8217;s use excuse #1 as the reason for not recording the presentations.</p>
<p>Its a valid excuse, the Pirate Cove was chock-a-block full of people. The local Berlin Ruby Group did an awesome job of finding a great &#8220;underground&#8221;-esque venue. </p>
<p>Fortunately a fellow Australian &#8211; <a href="http://redartisan.com/blog">Marcus Crafter</a> &#8211; had a front row position, and a MacBook Pro. With said device, he captured my talk on RubiGen (<a href="http://redartisan.com/2007/9/22/rejectconf-europe-2007">and John Barton&#8217;s</a>). </p>
<h3 id="rubigen-rejectconf-video">RejectConf video of RubiGen</h3>
<p>In 5 minutes, I make a Merb generator, using <a href="http://rubigen.rubyforge.org">RubiGen</a> and <a href="http://newgem.rubyforge.org">NewGem</a>. Nifty stuff indeed. </p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler"><param name="movie" value="http://www.viddler.com/player/b8b13c86/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/b8b13c86/" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler" ></embed></object></p>
<caption>Recorded and published by <a href="http://redartisan.com/2007/9/22/rejectconf-europe-2007">Marcus Crafter</a></caption>
<p>There were lots of other awesome presentations (that is perhaps a dubious inference that mine was awesome), but it was dark, I had beer in both hands, and I was too busy yelling &#8220;AUSTRALIA!!!&#8221; to write notes.</p>
<p>What a great night <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2007/10/25/dr-nic-at-rubyconf-2007-rubigen-teaser/' rel='bookmark' title='Permanent Link: Dr Nic at RubyConf 2007 &#8211; RubiGen &#8211; Teaser'>Dr Nic at RubyConf 2007 &#8211; RubiGen &#8211; Teaser</a> <small>4th of November 2007 &#8211; 9am &#8211; main conference room...</small></li><li><a href='http://drnicwilliams.com/2007/06/02/ze-frank-at-railsconf-like-ted/' rel='bookmark' title='Permanent Link: Missed Ze Frank at Railsconf? [video]'>Missed Ze Frank at Railsconf? [video]</a> <small>Neat. Here is Ze Frank at TED 20062004 [thx Erik...</small></li><li><a href='http://drnicwilliams.com/2007/05/27/new-gem-generates-gets-rspec-video/' rel='bookmark' title='Permanent Link: New Gem Generator gets RSpec [video]'>New Gem Generator gets RSpec [video]</a> <small> One day you will be able to write a...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2007/09/22/rubigen-video-from-rejectconf-berlin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NewGem Generator &#8211; now with script/generate</title>
		<link>http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/</link>
		<comments>http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 10:00:33 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[NewGem]]></category>
		<category><![CDATA[RubiGen]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/</guid>
		<description><![CDATA[The New Gem Generator (0.13.0)&#8217;s newgem command now behaves like the rails command thanks to RubiGen &#8211; a new project that is an extraction of the rails_generator. Developing a RubyGem? You can now have a script/generate command, just like Rails. Other projects, say like Merb, can do this too. Awesomeness with a Gold Star. (disclosure: [...]


Related posts:<ol><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><li><a href='http://drnicwilliams.com/2008/04/01/writing-c-extensions-in-rubygems/' rel='bookmark' title='Permanent Link: Writing C extensions in RubyGems using newgem generators (plus a free TextMate bundle)'>Writing C extensions in RubyGems using newgem generators (plus a free TextMate bundle)</a> <small>Already know C extensions in RubyGems? Cool &#8211; then just...</small></li><li><a href='http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/' rel='bookmark' title='Permanent Link: newjs = newgem for JavaScript projects; free TDD suite'>newjs = newgem for JavaScript projects; free TDD suite</a> <small>Want to start a new JavaScript project for a library...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://newgem.rubyforge.org/" title="New Gem Generator">New Gem Generator</a> (0.13.0)&#8217;s <code>newgem</code> command now behaves like the <code>rails</code> command thanks to <a href="http://rubigen.rubyforge.org" title="rubigen - Ruby Generator Framework">RubiGen</a> &#8211; a new project that is an extraction of the <code>rails_generator</code>.</p>
<p>Developing a RubyGem? You can now have a <code>script/generate</code> command, just like Rails. Other projects, say like Merb, can do this too.</p>
<p>Awesomeness with a Gold Star. (disclosure: Dr Nic awarded this Gold Star to himself)</p>
<h3>Warning</h3>
<p>This article can get confusing.</p>
<p>Especially around the heading &#8220;Generating Generators&#8221;. </p>
<p>Plus, this article talks about two projects &#8211; an update to <a href="http://newgem.rubyforge.org">New Gem Generator</a> (0.13.0) and the new <a href="http://rubigen.rubyforge.org">RubiGen</a> project.</p>
<p>So, give yourself time to digest it all, and then perhaps come back and read it again. </p>
<p>And then perhaps re-write the article for me. </p>
<p><strong>&#8220;A generator that can provide generators to your projects, so that you can write generators for your other projects.&#8221;</strong></p>
<p>Re-write it &#8211; I dare you.</p>
<h2 id="background">Background</h2>
<p>One of the killer features of Rails is the Rails Generator. </p>
<p>It does three things: </p>
<ul>
<li>generates an entire scaffold for your application, thus sharing with you its conventions (over configuration) methodology; and </li>
<li>it then allows you to generate <em>more</em> stuff, like models, controllers, plugins etc. Things that are relevant to a Rails app. Finally, </li>
<li>it allows you to write your own generators for Rails apps.</li>
</ul>
<p>Now you can do all this with New Gem.</p>
<h2 id="killer_feature_1_upgrade_path">Killer Feature #1 &#8211; upgrade path</h2>
<p>Never before have you been able to run &#8216;newgem&#8217; on top of an existing RubyGem. Why? It used to blow away the entire folder, and then start writing new files&#8230; not very friendly.</p>
<p>Now, just like the <code>rails</code> command, you can go into your RubyGem development directory, and run <code>newgem .</code> and you will be asked which files to override.</p>
<p>NOTE: Copy your Rakefile to Rakefile.old, and after running <code>newgem .</code> copy the configuration information into the new file <code>config/hoe.rb</code>.</p>
<p>If you&#8217;re using newgem already, I dare you to upgrade as above. (Ok, perhaps make a backup copy of your work first&#8230;)</p>
<h2 id="killer_feature_2_script_generate">Killer Feature #2 &#8211; script/generate</h2>
<p>Once you&#8217;ve upgraded, or create a new RubyGem (using <code>newgem gemname</code>), you&#8217;ll now have two scripts: <code>script/generate</code> and <code>script/destroy</code>, just like Rails has. (and matching generate.cmd and destroy.cmd for Windows users)</p>
<p>Try them out:</p>
<pre>
script/generate
...
Installed Generators
  Rubygems: application_generator, component_generator, executable, install_jruby, install_rspec, install_website
  Builtin: test_unit
</pre>
<p>Oh yeah, I&#8217;ve had some fun extracting things into generators.</p>
<ul>
<li>Install the dubious-looking NewGem website &#8211; <code>script/generate install_website</code>.</li>
<li>Install RSpec support &#8211; <code>script/generate install_rspec</code>.</li>
<li>Make the RubyGem a JRuby gem &#8211; <code>script/generate install_jruby</code> (the generated gem will have <code>-jruby.gem</code> in its name)</li>
<li>Create an executable Ruby app &#8211; <code>script/generate executable appname</code></li>
</ul>
<p>These generators are also reused via the newgem commands various options (Run <code>newgem</code> to see them.)</p>
<h2 id="killer_feature_3_generate_generators">Killer Feature #3 &#8211; generate generators</h2>
<p>I&#8217;ll post more about RubiGen later, but you can create a new <code>rails</code>-like command-line app that generates a whole stack load of directories and files using <code>script/generate application_generator appname</code>. </p>
<p>There is a large USAGE rundown if you run <code>script/generate application_generator</code>.</p>
<p>Want to create your own generators for developing RubyGems? (similar to creating a generator for a Rails app, but for RubyGems)</p>
<pre>
script/generate component_generator foobar rubygems
    create  rubygems_generators/foobar/templates
    exists  test
    create  rubygems_generators/foobar/foobar_generator.rb
    create  test/test_foobar_generator.rb
    create  test/test_generator_helper.rb
    create  rubygems_generators/foobar/USAGE
    readme  readme
</pre>
<p>Firstly, note <code>test/test_generatorname_generator.rb</code> &#8211; that&#8217;s right, you get a test stub for your new generator. Start there, write tests, then write your generator. There&#8217;s inline help for useful assertions.</p>
<p>Secondly, note <code>rubygems_generators</code> folder. This folder is the &#8220;scope&#8221; of the generator. As it starts with &#8220;rubygems&#8221; the generator will only be available when you are developing rubygems. It will not show up in Rails, nor Merb or Camping or any other place that may support RubiGen one day.</p>
<p>Similarly, if you want to write a Rails generator using the <code>component_generator</code> then specify the scope as <code>rails</code>.</p>
<pre>
script/generate component_generator booya rails
     create  rails_generators/booya/templates
     exists  test
     create  rails_generators/booya/booya_generator.rb
     create  test/test_booya_generator.rb
  identical  test/test_generator_helper.rb
     create  rails_generators/booya/USAGE
     readme  readme
</pre>
<p>In Edge Rails (and any Rails version <em>after</em> 1.2.3), the <code>script/generate</code> command in Rails will search all RubyGems for /rails_generator/* folders in addition to the existing search paths (<a href="http://dev.rubyonrails.org/ticket/8730" title="#8730 ([patch] rails_generator finds generators within RubyGems) - Rails Trac - Trac">ticket</a>).</p>
<h2 id="thanks_goes_to_rails_generator">Thanks goes to Rails Generator</h2>
<p>I&#8217;ve long been in love with the Rails Generator for what it does, the beautiful syntax for specifying a generator, etc. <strike>I don&#8217;t know who wrote what bit, e.g. if DHH wrote all of it, or others wrote nice chunks, but its awesome. Thanks DHH and co.</strike> Thanks to <a href="http://bitsweat.net/">Jeremy Kemper</a></p>
<p>RubiGen is 95% Rails Generator code, with extensions to support scoping. Setting Rails Generator free of its Rails constraints is a tribute to it.</p>
<p>Now RubyGems can use generators, and any other frameworks can integrate generators and their developers can write and distribute additional generators for those frameworks.</p>
<p>I award myself 2 gold stars, and a scratch-n-sniff</p>


<p>Related posts:<ol><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><li><a href='http://drnicwilliams.com/2008/04/01/writing-c-extensions-in-rubygems/' rel='bookmark' title='Permanent Link: Writing C extensions in RubyGems using newgem generators (plus a free TextMate bundle)'>Writing C extensions in RubyGems using newgem generators (plus a free TextMate bundle)</a> <small>Already know C extensions in RubyGems? Cool &#8211; then just...</small></li><li><a href='http://drnicwilliams.com/2008/02/17/newjs-javascript-project-generator/' rel='bookmark' title='Permanent Link: newjs = newgem for JavaScript projects; free TDD suite'>newjs = newgem for JavaScript projects; free TDD suite</a> <small>Want to start a new JavaScript project for a library...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
