<?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>Foognostic blogs &#187; GPLv3</title>
	<atom:link href="http://blogs.foognostic.net/topics/license/gplv3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.foognostic.net</link>
	<description>Seeking knowledge of foo</description>
	<lastBuildDate>Fri, 23 Apr 2010 12:45:34 +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>Juggling versions of Clojure?</title>
		<link>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/</link>
		<comments>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 23:35:15 +0000</pubDate>
		<dc:creator>Seth Schroeder</dc:creator>
				<category><![CDATA[GPLv3]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[clojuggle]]></category>

		<guid isPermaLink="false">http://blogs.foognostic.net/?p=297</guid>
		<description><![CDATA[Clojuggle is a small tool to help people track and use various versions of Clojure with Slime/Swank.]]></description>
			<content:encoded><![CDATA[<p>(Standard disclaimer: <a href="http://blogs.foognostic.net/disclaimer-clojure-is-a-new-hobby/">Clojure is a new hobby.</a>)</p>

<p>EDIT: also try rake clojure:new:repl</p>

<p>I am looking forward to trying <a href="http://www.assembla.com/wiki/show/clojure/Datatypes">datatypes</a> on <a href="http://bitbucket.org/seths/pokerepl/">Pokerepl</a>. However, that means using the <a href="http://github.com/richhickey/clojure/tree/new">new branch of Clojure</a>, and indirectly, more work on my part to clone/track/build/deploy the new branch.</p>

<p>Almost everyone would and should use <a href="http://github.com/technomancy/leiningen">Leiningen</a> to experiment with the new branch. Simply update your project.clj something like this:</p>

<div class="codecolorer-container clojure vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="clojure codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;:dependencies <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span>org.clojure/clojure <span style="color: #ff0000;">&quot;1.1.0-new-SNAPSHOT&quot;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>org.clojure/clojure-contrib <span style="color: #ff0000;">&quot;1.1.0-new-SNAPSHOT&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span></div></div>

<p>At the moment though, updating ~/.clojure was beyond the ken of any automated tool I knew of. So I wrote a Rakefile and gave it a cheesy name... juggling Clojure... hmm... howzabout <a href="http://bitbucket.org/seths/clojuggle/src/">Clojuggle</a>? Well... yeah...  sorry for that.</p>

<p>Back to the point: automating thorough (~/.m2 and ~/.clojure) updates and deployments of various versions of Clojure. Supporting common tasks (wipe, clone, build, &amp;c.) for several branches of several repositories means a thousand tasks will bloom and make the tool hard to use.</p>

<p>Ruby and the Rake API make it easy to define or show tasks only when relevant. I really enjoyed writing this code. Anyways, typing rake brings you to this:</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake<br />
Welcome<span style="color: #000000; font-weight: bold;">!</span> Try <span style="color: #ff0000;">'rake -T'</span> <span style="color: #000000; font-weight: bold;">for</span> a list of useful tasks, or try<br />
&nbsp; &nbsp; rake clojure:master:all clojure-contrib:master:all</div></div>

<p>The default task provides some basic usage. Let's take a look at the initial set of tasks:</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span style="color: #660033;">-T</span><br />
rake clojure-contrib:master:all &nbsp;<span style="color: #666666; font-style: italic;"># Do everything for master branch of clojure-contrib</span><br />
rake clojure-contrib:new:all &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Do everything for new branch of clojure-contrib</span><br />
rake clojure:master:all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Do everything for master branch of clojure</span><br />
rake clojure:new:all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Do everything for new branch of clojure</span><br />
rake default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># HOWTO use this file</span></div></div>

<p>Fine, let's give it a whirl.</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #000000; font-weight: bold;">time</span> rake clojure:new:all<br />
<span style="color: #666666; font-style: italic;"># oodles of lines omitted</span><br />
ci-build:<br />
<br />
BUILD SUCCESSFUL<br />
Total <span style="color: #000000; font-weight: bold;">time</span>: 25 seconds<br />
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>.clojure<span style="color: #000000; font-weight: bold;">/</span>clojure.jar<br />
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>clojuggle<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>clojure-new<span style="color: #000000; font-weight: bold;">/</span>clojure.jar <span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>.clojure<span style="color: #000000; font-weight: bold;">/</span>clojure.jar<br />
<br />
real&nbsp; &nbsp; 0m55.306s<br />
user&nbsp; &nbsp; 1m10.544s<br />
sys 0m6.873s</div></div>

<p>Three subtle points here. First, the "ci-build" line is the clue that the local Maven2 repository was updated:</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> ~<span style="color: #000000; font-weight: bold;">/</span>.m2<span style="color: #000000; font-weight: bold;">/</span>repository<span style="color: #000000; font-weight: bold;">/</span>org<span style="color: #000000; font-weight: bold;">/</span>clojure<span style="color: #000000; font-weight: bold;">/</span>clojure<span style="color: #000000; font-weight: bold;">/</span><br />
total 8<br />
drwxr-xr-x &nbsp;7 seths &nbsp;staff &nbsp;238 Jan &nbsp;3 17:57 1.1.0-new-SNAPSHOT<br />
<span style="color: #660033;">-rw-r--r--</span> &nbsp;<span style="color: #000000;">1</span> seths &nbsp;staff &nbsp;<span style="color: #000000;">322</span> Jan &nbsp;<span style="color: #000000;">3</span> <span style="color: #000000;">17</span>:<span style="color: #000000;">57</span> maven-metadata-local.xml</div></div>

<p>Point #2: the ~/.clojure directory has a symlink pointing into the clojuggle/src/clojure-new directory.</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> ~<span style="color: #000000; font-weight: bold;">/</span>.clojure<span style="color: #000000; font-weight: bold;">/</span><br />
total <span style="color: #000000;">8</span><br />
lrwxr-xr-x &nbsp;<span style="color: #000000;">1</span> seths &nbsp;staff &nbsp;<span style="color: #000000;">70</span> Jan &nbsp;<span style="color: #000000;">3</span> <span style="color: #000000;">17</span>:<span style="color: #000000;">57</span> clojure.jar -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>...<span style="color: #000000; font-weight: bold;">/</span>clojuggle<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>clojure-new<span style="color: #000000; font-weight: bold;">/</span>clojure.jar</div></div>

<p>Point #3: a few more commands have surfaced from the Rakefile (e.g. clojure:new:update)</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span style="color: #660033;">-T</span><br />
<span style="color: #666666; font-style: italic;"># ... omitted</span><br />
rake clojure:blast:it &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Removes files for clojure from $HOME/.clojure and .m2</span><br />
rake clojure:new:publish &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Push build to local m2 repo and ~/.clojure</span><br />
rake clojure:new:update &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Update the new branch of clojure</span></div></div>

<p>So that's all well and good, but what if you wanted to support <a href="http://technomancy.us/">Technomancy's</a> <a href="http://github.com/technomancy/clojure">fork</a> of Clojure? You would do two things. First this:</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> user.yml<br />
technomancy-clojure:<br />
&nbsp; clone-from: git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>technomancy<span style="color: #000000; font-weight: bold;">/</span>clojure.git<br />
&nbsp; branches: <span style="color: #7a0874; font-weight: bold;">&#91;</span>master, new<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
&nbsp; use-jar: clojure.jar</div></div>

<p>And then something like this:</p>

<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ rake <span style="color: #660033;">-T</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># ... omitted</span><br />
rake technomancy-clojure:master:all &nbsp;<span style="color: #666666; font-style: italic;"># Do everything for master branch of technomancy-clojure</span><br />
rake technomancy-clojure:new:all &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Do everything for new branch of technomancy-clojure</span></div></div>

<h1>DANGER!</h1>

<p>Do <b>NOT</b> use this tool to develop on various versions of Clojure. The wipe task always deletes files, so eventually you will lose changes unintentionally. Eventually 'git status' will be used to prevent wiping changes but not yet.</p>

<p>Penultimately, despite all this I still don't have the new branch working with Slime/Swank. It doesn't help that the pom.xml of contrib on the new branch wants 1.1.0-alpha of Clojure. Minor nits though that can be worked out.</p>

<p>Finally, if anyone is still reading <b>and</b> cares about these sort of things, I picked Ruby, v3 of the GPL, and Mercurial/BitBucket because I have strong feelings about those things.</p>

<p>Please respond in some way if you have any questions!</p>

<p>tl;dr: Leiningen is great -- try using it with the new branch of Clojure!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.foognostic.net/2010/01/juggling-versions-of-clojure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>introducing jawarepl</title>
		<link>http://blogs.foognostic.net/2009/01/introducing-jawarepl/</link>
		<comments>http://blogs.foognostic.net/2009/01/introducing-jawarepl/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 19:57:16 +0000</pubDate>
		<dc:creator>Seth Schroeder</dc:creator>
				<category><![CDATA[GPLv3]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[jawarepl]]></category>

		<guid isPermaLink="false">http://blogs.foognostic.net/?p=66</guid>
		<description><![CDATA[JAWAREPL is a JAva Web Application Read Eval Print Loop. It loads a Spring-based Java .war file into groovysh, and then makes its fully actived Spring beans easy to use. Here's a quick example. It uses 'petclinic', one of the sample apps included with Spring: $ groovysh . /Users/moi/Documents/code/jawarepl/jawarepl.groovy inst = new JAWAREPL(); Here's how [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bitbucket.org/seths/jawarepl/overview/">JAWAREPL</a> is a JAva Web Application Read Eval Print Loop. It loads a <a href="http://www.springsource.org/">Spring</a>-based Java .war file into <a href="http://groovy.codehaus.org/Groovy+Shell">groovysh</a>, and then makes its fully actived Spring beans easy to use.</p>

<p>Here's a quick example. It uses 'petclinic', one of the sample apps included with Spring:</p>

<p><pre>
$ groovysh
. /Users/moi/Documents/code/jawarepl/jawarepl.groovy
inst = new JAWAREPL();
</pre></p>

<p>Here's how you configure it:</p>

<p><pre>
inst.war_path = "/path/to/petclinic/dist/petclinic.war";
inst.context_paths = [ "WEB-INF/applicationContext-hibernate.xml" ];
ctx = inst.context;
</pre></p>

<p>After that, the sky's the limit! Start grabbing beans out and call all the methods you want. Put this into groovysh:</p>

<p><pre>
clinic = ctx.getBean("clinic");
clinic.vets.each {
   println "vet = ${it.lastName}, ${it.firstName}";
   it.specialties.each {
       println "    $it";
   }
}
</pre></p>

<p>And this should come out:</p>

<p><pre>
vet = Carter, James
vet = Douglas, Linda
    dentistry
    surgery
vet = Jenkins, Sharon
vet = Leary, Helen
    radiology
vet = Ortega, Rafael
    surgery
vet = Stevens, Henry
    radiology
</pre></p>

<p>Just to demonstrate that it's not only for reading data, here is another sample where it adds a visit to the petclinic.</p>

<p><pre>
owner = clinic.findOwners("Schroeder")[0];
owner.pets.visits.each { println "$it.date, $it.description" }
[2009-01-24, 2009-01-24], [JAWAREPL test, JAWAREPL test]
visit = new org.springframework.samples.petclinic.Visit();
visit.date = new Date();
visit.pet = pets[0];
visit.description = "JAWAREPL test2";
clinic.storeVisit(visit);
...
Hibernate: insert into visits (visit_date, description, pet_id) values (?, ?, ?)
owner = clinic.findOwners("Schroeder")[0];
owner.pets.visits.each { println "$it.date, $it.description" }
[2009-01-24, 2009-01-24, 2009-01-24], [JAWAREPL test,
JAWAREPL test2, JAWAREPL test]
</pre></p>

<p>More detailed instructions are available on <a href="http://bitbucket.org/seths/jawarepl/src/123872d5dc2f/samples.txt">bitbucket</a>.</p>

<p>JAWAREPL has been tested on three of the sample Spring apps and a basic Grails app. Those are pretty trivial samples and even so, it was a minor task to make them all work; the Grails war had none of the GORM mojo stitched in so it was really not very useful (patches anyone?) That being said, I would <b>not</b> expect a complex war file to load smoothly. I seem to recall some sort of mock/mini JNDI provider in Spring if that what goes wrong. I will try to look at any <a href="http://bitbucket.org/seths/jawarepl/issues/">bug reports</a>, or much better yet <a href="http://bitbucket.org/seths/jawarepl/src/">patches</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.foognostic.net/2009/01/introducing-jawarepl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
