<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
>

<channel>
	<title>Enfranchised Mind &#187; Groovy</title>
	<atom:link href="http://enfranchisedmind.com/blog/categories/code-samples/groovy-code-samples/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Thu, 09 Sep 2010 14:25:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<!-- podcast_generator="Blubrry PowerPress/1.0.9" mode="advanced" entry="simple" -->
	<itunes:summary>programming, politics, &amp; other religious issues</itunes:summary>
	<itunes:author>Enfranchised Mind</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://enfranchisedmind.com/blog/wp-content/plugins/powerpress/itunes_default.jpg" />
	<itunes:subtitle>programming, politics, &amp; other religious issues</itunes:subtitle>
	<image>
		<title>Enfranchised Mind &#187; Groovy</title>
		<url>http://enfranchisedmind.com/blog/wp-content/plugins/powerpress/rss_default.jpg</url>
		<link>http://enfranchisedmind.com/blog/categories/code-samples/groovy-code-samples/</link>
	</image>
		<item>
		<title>log.debug { &quot;$toStringMe only if necessary!&quot; }</title>
		<link>http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/</link>
		<comments>http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 18:02:10 +0000</pubDate>
		<dc:creator>Robert Fischer</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=2359</guid>
		<description><![CDATA[I've just updated the <a href="http://enfranchisedmind.com/blog/posts/with-log-groovy-ast-transform/"><code>@WithLog</code> AST transform for Groovy</a> to defer evaluation of GStrings in logging messages.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just updated the <a href="http://enfranchisedmind.com/blog/posts/with-log-groovy-ast-transform/"><code>@WithLog</code> AST transform for Groovy</a>.  In case you don&#8217;t know, that&#8217;s <a href="http://github.com/RobertFischer/Groovy-WithLog">my project over at GitHub</a> which allows you to turn:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">org.apache.log4j.Logger</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Foo <span style="color: #66cc66;">&#123;</span> 
  <span style="color: #000000; font-weight: bold;">static</span> log <span style="color: #66cc66;">=</span> Logger.<span style="color: #006600;">getLogger</span><span style="color: #66cc66;">&#40;</span>Foo<span style="color: #66cc66;">&#41;</span>
  <span style="color: #808080; font-style: italic;">/* ... */</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>into</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">@WithLog
<span style="color: #000000; font-weight: bold;">class</span> Foo <span style="color: #66cc66;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* ... */</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Three big changes in the new release.  First, I switched to using Gradle for the build system, because Gradle is awesome.  Second, I OSGi-ified the archive and released it to the Maven repo at <a href="http://repo.smokejumperit.com">http://repo.smokejumperit.com</a>, so I&#8217;m now Java infrastructure compliant (thank you, Gradle, for making that a no-brainer).  Third, I provided the ability to use an enhanced <code>Logger</code> implementation (unoriginally called <a href="http://github.com/RobertFischer/Groovy-WithLog/blob/master/src/main/java/com/smokejumperit/sublog/WithLogLogger.java">WithLogLogger</a>) — see <a href="http://github.com/RobertFischer/Groovy-WithLog/blob/master/README.md">the README</a> for full details, but basically it means you can save the <code>toString()</code> evaluation on your logging messages if you wrap the logging GString in a Closure.  If you use this, though, you&#8217;ll have to schlep around the <code>Groovy-WithLog-0.2.jar</code> file with your runtime code.  If you&#8217;re using Maven/Ivy/Gradle/whatever, see the end of <a href="http://github.com/RobertFischer/Groovy-WithLog/blob/master/README.md">the README</a> for repo information.</p>
<p>The <code>@WithLog</code> code is still released under the <a href="http://sam.zoy.org/wtfpl/">WTFPL</a>.</p>
<hr />
This post was by <a href="http://www.robertcfischer.com">Robert Fischer</a>, written on March 19, 2010.<br />
Comment on this post: <a href="http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/#respond">http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/#respond</a><br />
Public Permalink: <a href="http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/">http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/</a>
<hr /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a><br />This article was a post on <a href="http://enfranchisedmind.com/blog">the EnfranchisedMind blog</a>.  <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dc:title" rel="dc:type">EnfranchisedMind Blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://enfranchisedmind.com/blog/" property="cc:attributionName" rel="cc:attributionURL">Robert Fischer, Brian Hurt, and Other Authors</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-Share Alike 3.0 United States License</a>.<p style="display:none;">(Digital Fingerprint: bcecb67d74ab248f06f068724220e340 (38.107.191.83) )</p></small>]]></content:encoded>
			<wfw:commentRss>http://enfranchisedmind.com/blog/posts/log-debug-tostringme-only-if-necessary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oh, Gradle, You Made My Heart Skip a Beat</title>
		<link>http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/</link>
		<comments>http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 15:28:59 +0000</pubDate>
		<dc:creator>Robert Fischer</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=2009</guid>
		<description><![CDATA[As I just mentioned, I&#8217;ve been working on some Gradle plugins. I&#8217;ve been using Gradle in my polyglot programming book, [...]]]></description>
			<content:encoded><![CDATA[<p>As I just mentioned, <a href="http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/">I&#8217;ve been working on some Gradle plugins</a>.  I&#8217;ve been using Gradle in my polyglot programming book, and there&#8217;s a stunt (namely, running Cucumber in a Java/Groovy/Scala build) that I&#8217;d like the user to be able to do without too much hassle.  The easiest way is to say, &#8220;Hey, use this plugin and let the magic fly&#8221;.</p>
<p>In doing development, I&#8217;m spending some time pushing through integration tests, and in so doing, I wanted to deploy various versions to a Maven repository and pull them back down.</p>
<p>Creating a Maven repository for SmokejumperIT was pretty simple.</p>
<ol>
<li>Create a space on the internet for the repository which is accessible via public-key-authenticated SCP.  In my case, it&#8217;s <a href="http://repo.smokejumperit.com">http://repo.smokejumperit.com</a>.</li>
<li>Create a configuration in the Gradle build file for the JARs needed to deploy:

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">configurations <span style="color: #66cc66;">&#123;</span>
    deployerJars
<span style="color: #66cc66;">&#125;</span>
&nbsp;
repositories <span style="color: #66cc66;">&#123;</span>
  mavenRepo urls: <span style="color: #ff0000;">&quot;file://${System.properties['user.home']}/.m2/repository/&quot;</span>
  mavenCentral<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
dependencies <span style="color: #66cc66;">&#123;</span>
  deployerJars <span style="color: #ff0000;">'org.apache.maven.wagon:wagon-ssh:1.0-beta-2'</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><b>Note:</b> The part in the <code>repositories</code> block is in every build file that I have, so I&#8217;m working on a plugin (working title <code>PreconfigPlugin</code>) that will automatically add that in.
</li>
<li>Configure the <code>uploadArchives</code> task.  I had it delegate to various <code>System</code> properties that I set when I run the build script.

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">uploadArchives <span style="color: #66cc66;">&#123;</span>
  repositories.<span style="color: #006600;">mavenDeployer</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">def</span> repoUser <span style="color: #66cc66;">=</span> <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sjit.repo.user'</span><span style="color: #66cc66;">&#93;</span>
    configuration <span style="color: #66cc66;">=</span> configurations.<span style="color: #006600;">deployerJars</span>
    repository<span style="color: #66cc66;">&#40;</span>url: <span style="color: #ff0000;">&quot;scp://repo.smokejumperit.com/home/$repoUser/repo.smokejumperit.com/&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      authentication<span style="color: #66cc66;">&#40;</span>
        userName: repoUser,
        privateKey: <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">File</span><span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sjit.repo.keyFile'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">absolutePath</span>,
        passphrase: <span style="color: #aaaadd; font-weight: bold;">System</span>.<span style="color: #006600;">properties</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'sjit.repo.passphrase'</span><span style="color: #66cc66;">&#93;</span>
      <span style="color: #66cc66;">&#41;</span>
      pom <span style="color: #66cc66;">&#123;</span>
        groupId<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'com.smokejumperit'</span>
        artifactId<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'gradle-plugins'</span>
        version<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'0.2-SNAPSHOT'</span>
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

</li>
<li>Run <code>gradle upload</code>.</li>
</ol>
<p>That&#8217;s all it took.  Even better, it does all the funky snapshot management on its own: see <a href="http://repo.smokejumperit.com/com/smokejumperit/gradle-plugins/0.2-SNAPSHOT/">http://repo.smokejumperit.com/com/smokejumperit/gradle-plugins/0.2-SNAPSHOT/</a> for the beautiful timestamped results!</p>
<p>This is how builds should be: stupid-simple to do the right thing.</p>
<hr /><h2>Comments</h2><ul><li><a href="http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#comment-37033">November 27, 2009</a>, <a href='http://hamletdarcy.blogspot.com' rel='external nofollow' class='url'>Hamlet D'Arcy</a> wrote: I'd like to hear what you think about Gradle being the result of applying Evans-style Domain Driven Design to build systems. Is a strong domain model for enterprise projects really a great benefit?</li><li><a href="http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#comment-37461">March 23, 2010</a>, <a href='http://lubospdiigo.wordpress.com/2010/03/24/blog-bookmarks-03242010/' rel='external nofollow' class='url'>Blog bookmarks 03/24/2010 &laquo; My Diigo bookmarks</a> wrote: [...] Oh, Gradle, You Made My Heart Skip a Beat [...]</li></ul><hr />
This post was by <a href="http://www.robertcfischer.com">Robert Fischer</a>, written on November 27, 2009.<br />
Comment on this post: <a href="http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#respond">http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/#respond</a><br />
Public Permalink: <a href="http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/">http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/</a>
<hr /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a><br />This article was a post on <a href="http://enfranchisedmind.com/blog">the EnfranchisedMind blog</a>.  <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dc:title" rel="dc:type">EnfranchisedMind Blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://enfranchisedmind.com/blog/" property="cc:attributionName" rel="cc:attributionURL">Robert Fischer, Brian Hurt, and Other Authors</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-Share Alike 3.0 United States License</a>.<p style="display:none;">(Digital Fingerprint: bcecb67d74ab248f06f068724220e340 (38.107.191.83) )</p></small>]]></content:encoded>
			<wfw:commentRss>http://enfranchisedmind.com/blog/posts/gradle-maven-repo-snapshots/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Announcing Gradle-Plugins</title>
		<link>http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/</link>
		<comments>http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 00:16:20 +0000</pubDate>
		<dc:creator>Robert Fischer</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=2004</guid>
		<description><![CDATA[A lot of people know that I have contributed a lot of Grails plugin work, even if my take on [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of people know that <a href="http://grails.org/plugin/search?q=Robert+Fischer">I have contributed a lot of Grails plugin work</a>, even if <a href="http://enfranchisedmind.com/blog/posts/open-source-users/">my take on contributing</a> is <a href="http://enfranchisedmind.com/blog/posts/open-letter-to-burt-beckwith/">somewhat controversial</a>.  Well, I&#8217;m continuing on with that approach of plugin contributions, but now for <a href="http://gradle.org">Gradle, the world&#8217;s most awesome build system</a>.  You can check out the plugins at <a href="http://github.com/RobertFischer/gradle-plugins/">http://github.com/RobertFischer/gradle-plugins/</a>.  Be sure to scroll down to see the README file with all of its goodness.</p>
<p>Currently, there are just two plugins: one to get at classloaders and one to execute shell commands.  I&#8217;ll probably have some JRuby/Cucumber, maybe JAVACC, and almost certainly some conventional development plugins sometime in the future.</p>
<p>Note that I&#8217;m releasing the Gradle plugins under the CC0 (which is a classier form of my beloved <a href="http://sam.zoy.org/wtfpl/">WTFPL</a>).  Here are the details:
<p xmlns:dct="http://purl.org/dc/terms/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"><a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/" style="text-decoration:none;"><img src="http://i.creativecommons.org/l/zero/1.0/88x31.png" border="0" alt="CC0" /></a><br />To the extent possible under law, <a href="http://smokejumperit.com/" rel="dct:publisher"><span property="dct:title">Robert Fischer</span></a> has waived all copyright and related or neighboring rights to <span property="dct:title">Smokejumper IT Gradle Plugins</span>.  This work is published from <span about="http://smokejumperit.com/" property="vcard:Country" datatype="dct:ISO3166" content="US">United States</span>.</p>
<hr /><h2>Comments</h2><ul><li><a href="http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/#comment-37023">November 25, 2009</a>, <a href='http://hamletdarcy.blogspot.com' rel='external nofollow' class='url'>Hamlet D'Arcy</a> wrote: great news. Why not just submit the plugins back to the Gradle project?</li><li><a href="http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/#comment-37024">November 25, 2009</a>, <a href='http://www.smokejumperit.com' rel='external nofollow' class='url'>Robert Fischer</a> wrote: @Hamlet

Is there a way to do that?  I wasn't exactly sure how plugins in the Gradle source code worked, but I'd be more than happy for the code to make it into Gradle core.</li></ul><hr />
This post was by <a href="http://www.robertcfischer.com">Robert Fischer</a>, written on November 25, 2009.<br />
Comment on this post: <a href="http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/#respond">http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/#respond</a><br />
Public Permalink: <a href="http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/">http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/</a>
<hr /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a><br />This article was a post on <a href="http://enfranchisedmind.com/blog">the EnfranchisedMind blog</a>.  <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dc:title" rel="dc:type">EnfranchisedMind Blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://enfranchisedmind.com/blog/" property="cc:attributionName" rel="cc:attributionURL">Robert Fischer, Brian Hurt, and Other Authors</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-Share Alike 3.0 United States License</a>.<p style="display:none;">(Digital Fingerprint: bcecb67d74ab248f06f068724220e340 (38.107.191.83) )</p></small>]]></content:encoded>
			<wfw:commentRss>http://enfranchisedmind.com/blog/posts/announcing-gradle-plugins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;Holy Crap, That Worked!&#8221;: Running JRuby/Cucumber from Gradle</title>
		<link>http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/</link>
		<comments>http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 00:23:52 +0000</pubDate>
		<dc:creator>Robert Fischer</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Ruby/JRuby]]></category>

		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1956</guid>
		<description><![CDATA[I&#8217;m working on some code for my book and I&#8217;m trying out Swinger, which is a Cucumber library for Swing. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on some code for my book and I&#8217;m trying out <a href="http://github.com/demetriusnunes/swinger">Swinger</a>, which is a <a href="http://cukes.info/">Cucumber</a> library for Swing.  I wanted to integrate it into my build (which is <a href="http://gradle.org">Gradle</a>), but was running into issues.  The problem is that I was pulling <a href="http://kenai.com/projects/jruby-embed">JRuby-Embed</a> from the central Maven repo, which meant that I could only use the JRuby classes by way of Gradle&#8217;s fancy classloader stunts.  The issue is that JRuby does some of its own classloader stunts, so there were classloader issues.  The issue resulted in error messages that looked like this:</p>
<pre style="font-size: small;">
Caused by: org.jruby.exceptions.RaiseException: library `enumerator' could not be loaded:
java.lang.ClassNotFoundException: org.jruby.libraries.EnumeratorLibrary
	at (unknown).new(:1)
	at (unknown).(unknown)(:1)
</pre>
<p>After tracking through <a href="http://kenai.com/projects/jruby/sources/main/content/src/org/jruby">the JRuby source code</a>, I found that <a href="http://kenai.com/projects/jruby/sources/main/content/src/org/jruby/RubyInstanceConfig.java">RubyInstanceConfig</a> was grabbing the thread context classloader instead of the classloader used to load itself.  I don&#8217;t know what that classloader was set to, but resetting it solved the issue.</p>
<p>Here&#8217;s the resulting Gradle script, which at least runs the gem installs and a Cucumber run:</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">org.jruby.Main</span> <span style="color: #000000; font-weight: bold;">as</span> JRuby
&nbsp;
buildscript <span style="color: #66cc66;">&#123;</span>
  repositories <span style="color: #66cc66;">&#123;</span>
    mavenCentral<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#125;</span>
  dependencies <span style="color: #66cc66;">&#123;</span>
    classpath <span style="color: #ff0000;">&quot;org.jruby.embed:jruby-embed:0.1.2&quot;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
task checkGradle <span style="color: #66cc66;">&lt;&lt;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #993399;">println</span> <span style="color: #ff0000;">&quot;OK&quot;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
task gems <span style="color: #66cc66;">&lt;&lt;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">def</span> gemsDir <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;./build/gems&quot;</span>
  <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">File</span><span style="color: #66cc66;">&#40;</span>gemsDir<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">exists</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    runJRuby<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;gem install -i $gemsDir --no-rdoc --no-ri cucumber&quot;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
task runTest<span style="color: #66cc66;">&#40;</span>dependsOn:gems<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&lt;&lt;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">def</span> cukeHome <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #aaaadd; font-weight: bold;">File</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'./build/gems/gems'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">listFiles</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #663399;">find</span> <span style="color: #66cc66;">&#123;</span>
    it.<span style="color: #006600;">name</span>.<span style="color: #006600;">startsWith</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'cucumber-'</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#125;</span>
  runJRuby<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;$cukeHome/bin/cucumber src/test/features&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">def</span> runJRuby<span style="color: #66cc66;">&#40;</span>cmdArg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #aaaadd; font-weight: bold;">Thread</span>.<span style="color: #006600;">currentThread</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">setContextClassLoader</span><span style="color: #66cc66;">&#40;</span>JRuby.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">classLoader</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #993399;">println</span> <span style="color: #ff0000;">&quot;Running JRuby: $cmdArg&quot;</span>
  JRuby.<span style="color: #006600;">main</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;-S $cmdArg&quot;</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<hr />
This post was by <a href="http://www.robertcfischer.com">Robert Fischer</a>, written on October 31, 2009.<br />
Comment on this post: <a href="http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/#respond">http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/#respond</a><br />
Public Permalink: <a href="http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/">http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/</a>
<hr /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a><br />This article was a post on <a href="http://enfranchisedmind.com/blog">the EnfranchisedMind blog</a>.  <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dc:title" rel="dc:type">EnfranchisedMind Blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://enfranchisedmind.com/blog/" property="cc:attributionName" rel="cc:attributionURL">Robert Fischer, Brian Hurt, and Other Authors</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-Share Alike 3.0 United States License</a>.<p style="display:none;">(Digital Fingerprint: bcecb67d74ab248f06f068724220e340 (38.107.191.83) )</p></small>]]></content:encoded>
			<wfw:commentRss>http://enfranchisedmind.com/blog/posts/jruby-cucumber-gradle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>null Sucks: A Case in Point</title>
		<link>http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/</link>
		<comments>http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 19:30:57 +0000</pubDate>
		<dc:creator>Robert Fischer</dc:creator>
				<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Programming Language Punditry]]></category>

		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1920</guid>
		<description><![CDATA[Take a look at this API: ClassNode#addProperty. Turns out that if you pass null into getterBlock and setterBlock, you get [...]]]></description>
			<content:encoded><![CDATA[<p>Take a look at this API: <a href="http://bit.ly/addProperty">ClassNode#addProperty</a>.  Turns out that if you pass <code>null</code> into <code>getterBlock</code> and <code>setterBlock</code>, you get the default implementations.  Maybe<small><sup>1</sup></small>.  Normally passing <code>null</code> around blows up in unhelpful ways, but here <code>null</code> is a useful value.  How is a programmer to know?</p>
<p>I&#8217;m increasingly convinced that immutability<small><sup>2</sup></small> and strong type systems in languages aren&#8217;t just about concurrency or letting the computer optimize or catching bad code early.  Increasingly, I&#8217;m convinced that the key value they provide is clear, meaningful, and maintainable code.  Which is really the key problem in software development these days, isn&#8217;t it?</p>
<p><small><sup>1</sup> As of this writing, it&#8217;s an outstanding question if the compile phase of the AST transformation impacts whether or not the <code>null</code> values are translated: <a href="http://www.nabble.com/Adding-a-Property-via-AST-%28ClassNode%29-td25939507.html">mailing list conversation</a>.</small><br />
<small><sup>2</sup> See <a href="http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey">this nice presentation</a> from Rich Hickey, author of Clojure.</small></p>
<hr /><h2>Comments</h2><ul><li><a href="http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/#comment-36993">November 6, 2009</a>, <a href='http://enfranchisedmind.com/blog/posts/periodicalupdater-and-mutable-data/' rel='external nofollow' class='url'>New PeriodicalUpdater Feature, and, Mutable Data Sucks: A Case in Point | Enfranchised Mind</a> wrote: [...] said before that null sucks, but now I&#8217;ve got a case in point for why mutable data sucks, [...]</li></ul><hr />
This post was by <a href="http://www.robertcfischer.com">Robert Fischer</a>, written on October 17, 2009.<br />
Comment on this post: <a href="http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/#respond">http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/#respond</a><br />
Public Permalink: <a href="http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/">http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/</a>
<hr /><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png" /></a><br />This article was a post on <a href="http://enfranchisedmind.com/blog">the EnfranchisedMind blog</a>.  <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dc:title" rel="dc:type">EnfranchisedMind Blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://enfranchisedmind.com/blog/" property="cc:attributionName" rel="cc:attributionURL">Robert Fischer, Brian Hurt, and Other Authors</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons Attribution-Share Alike 3.0 United States License</a>.<p style="display:none;">(Digital Fingerprint: bcecb67d74ab248f06f068724220e340 (38.107.191.83) )</p></small>]]></content:encoded>
			<wfw:commentRss>http://enfranchisedmind.com/blog/posts/null-sucks-a-case-in-point/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
