<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ivan Porto Carrero</title>
	
	<link>http://flanders.co.nz</link>
	<description>thoughts.each { &amp;:propagandise }</description>
	<lastBuildDate>Fri, 12 Mar 2010 12:24:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/casualjim" /><feedburner:info uri="casualjim" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>casualjim</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Video of FOSDEM IronRuby presentation</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/_pwPVSmgD6U/</link>
		<comments>http://flanders.co.nz/2010/03/12/video-of-fosdem-ironruby-presentation/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 12:24:55 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/?p=371</guid>
		<description><![CDATA[At FOSDEM 2010 I got the chance to talk in the mono dev room about ironruby.
In this talk I extended the banshee application to work with IronRuby based plugins.
So without further ado here&#8217;s the link:
IronRuby: The .NET and Ruby love child
]]></description>
			<content:encoded><![CDATA[<p>At FOSDEM 2010 I got the chance to talk in the mono dev room about ironruby.</p>
<p>In this talk I extended the banshee application to work with IronRuby based plugins.</p>
<p>So without further ado here&#8217;s the link:<br />
<a href='http://andrius.six.lt/~bentkus/videos/mono-fosdem2010/mono-2010-02-07-1000-1100-(Ivan%20Porto%20Carrero)-(The%20Ruby%20and%20the%20.NET%20lovechild).mp4' >IronRuby: The .NET and Ruby love child</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=_pwPVSmgD6U:mpS6_7iYGOI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=_pwPVSmgD6U:mpS6_7iYGOI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=_pwPVSmgD6U:mpS6_7iYGOI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=_pwPVSmgD6U:mpS6_7iYGOI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=_pwPVSmgD6U:mpS6_7iYGOI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=_pwPVSmgD6U:mpS6_7iYGOI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=_pwPVSmgD6U:mpS6_7iYGOI:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/_pwPVSmgD6U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2010/03/12/video-of-fosdem-ironruby-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2010/03/12/video-of-fosdem-ironruby-presentation/</feedburner:origLink></item>
		<item>
		<title>Adding a console to your IronRuby application</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/J0hIHcXO3Qk/</link>
		<comments>http://flanders.co.nz/2009/12/01/adding-a-console-to-your-ironruby-application/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 10:00:44 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[IronRuby]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/12/01/adding-a-console-to-your-ironruby-application/</guid>
		<description><![CDATA[When building an application it might be very handy to have a REPL console that knows about the libraries of your application, but you don’t necessarily want to start your application to interact with it.&#160; In Rails they have a script/console command.&#160; Here’s how you create one that knows about ironruby. The example I’m going [...]]]></description>
			<content:encoded><![CDATA[<p>When building an application it might be very handy to have a REPL console that knows about the libraries of your application, but you don’t necessarily want to start your application to interact with it.&#160; In Rails they have a script/console command.&#160; Here’s how you create one that knows about ironruby. The example I’m going to use is taken from an IronRubyMVC application.</p>
<p>I started out by creating a folder script.</p>
<p>Then I created a file called console (on a unix system I would chmod +x this file). I also like to have completion in my console so I’ve added the irb/completion library.&#160; Then I’ll require the routes.rb file so that the libraries of my application get loaded.</p>
<pre class="ruby" name="code">#!/usr/bin/env ir
# File: script/console
irb = ENV['OS'] =~ /^Windows/iu ? 'CALL iirb.bat' : 'iirb'

libs =  &quot; -r irb/completion&quot;
# Perhaps use a console_lib to store any extra methods I may want available in the console
libs &lt;&lt;  &quot; -r #{File.dirname(__FILE__) + '/../routes'}&quot;
puts &quot;Loading Poll chat&quot;
exec &quot;#{irb} #{libs} --simple-prompt&quot;</pre>
<p>The 3rd line has CALL iirb.bat as a command on a windows system. The CALL command is needed for the next step because we’re going to execute a batch file from another batch file on windows. Otherwise it wouldn’t work for me.&#160;&#160; CALL is very similar to exec in ruby and gives control to another executable until its task is done.</p>
<p>For windows to be able to use script/console (script\console) instead of ir script/console you also need to create a batch file called console.bat in the script folder. </p>
<pre class="batch" name="code">@ECHO OFF
IF NOT &quot;%~f0&quot; == &quot;~f0&quot; GOTO :WinNT
@&quot;ir.exe&quot; &quot;script/console&quot; %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@&quot;ir.exe&quot; &quot;%~dpn0&quot; %*</pre>
<p>This is all there is to it to get rails like scripting abilities.</p>
<p>IronRuby has another really cool feature built into IronRuby is the ability to provide REPL’s for your application at run-time. All you need to do is use Repl.new and give it an output and input stream.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=J0hIHcXO3Qk:q-Vjg2YEuP4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=J0hIHcXO3Qk:q-Vjg2YEuP4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=J0hIHcXO3Qk:q-Vjg2YEuP4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=J0hIHcXO3Qk:q-Vjg2YEuP4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=J0hIHcXO3Qk:q-Vjg2YEuP4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=J0hIHcXO3Qk:q-Vjg2YEuP4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=J0hIHcXO3Qk:q-Vjg2YEuP4:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/J0hIHcXO3Qk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/12/01/adding-a-console-to-your-ironruby-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/12/01/adding-a-console-to-your-ironruby-application/</feedburner:origLink></item>
		<item>
		<title>A good url regular expression? (repost)</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/pD0LEvxDzFY/</link>
		<comments>http://flanders.co.nz/2009/11/08/a-good-url-regular-expression-repost/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 11:02:37 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[url regex]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/?p=366</guid>
		<description><![CDATA[I&#8217;m moving this post from http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx
I started out blogging on geeks with blogs but I can&#8217;t allow comments there anymore or I get too much spam, so I&#8217;m moving the post from there to this place.  Various people have contributed through the comments in the other blog post. So here I have better control over [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m moving this post from <a href="http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx">http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx</a></p>
<p>I started out blogging on geeks with blogs but I can&#8217;t allow comments there anymore or I get too much spam, so I&#8217;m moving the post from there to this place.  Various people have contributed through the comments in the other blog post. So here I have better control over the spam and can open the comments again.</p>
<p>I have been looking for a good first layer of validating an url to see if it is valid.</p>
<p>For checking the format of the url it seems to me to be the most logical approach to use regular expressions. Up until now I always discarded them as being to “geeky”, meaning i don&#8217;t consider it my life&#8217;s biggest goal to be typing (/?[]\w) all day long (so why did i become a programmer, aaaah yes to make life easier for other people)</p>
<p>Anyway.. to find a good regular expression to that validates urls not url domains. One that doesn&#8217;t allow spaces in the domainname and where the domain can be suffixed with the port number.  Also I need support for the ~/ paths</p>
<p>This is what I came up with.. if somebody as a better idea&#8230; or finds a mistake please let me know.. Always happy to learn something new.</p>
<p><span style="text-decoration: line-through;">^(((ht|f)tps?\:\/\/)|~/|/)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5})(:[\d]{1,5})?)/?(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&amp;\w+=\w+)*)?</span></p>
<p>I was a bit quickly in using this regex. Simeon pilgrim indicated that the ftp urls won&#8217;t validate when you add a username and a password.</p>
<p>I don&#8217;t really need to validate ftp so I should have removed the ftp protocol from the list of choices.  I need this just to validate urls for weblinks and the link element in an rss feed.  When I need them for ftp I will post the ftp version.. but for now I don&#8217;t have time to spend on elaborating the regex.</p>
<p>Anyway here is the right one : <span style="text-decoration: line-through;">^(http(s?)\:\/\/|~/|/)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?/?(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&amp;\w+=\w+)*)?</span></p>
<p>A full url validation would include resolving names through dns or making a webrequest to the provided url to see if we get a 200 response. The only way to be sure is to test if it is there in my opinion.</p>
<p>Thanks Simeon.</p>
<p>And for those who really want the ftp validation : <span style="text-decoration: line-through;">^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?/?(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&amp;\w+=\w+)*)?</span></p>
<p>I am not sure about numbers in the username but I believe you can have a username of numbers alone.</p>
<p>Comments don&#8217;t seem to work on this blog engine.. so just send me a mail through the contact form. thanks</p>
<p>Two days later &#8230;</p>
<p>I discovered there is still a problem with my regular expressions&#8230; folders don&#8217;t get parsed.</p>
<p>I&#8217;ve solved the path issue, so now it should be finding all url&#8217;s</p>
<p>Expression:</p>
<p><span style="text-decoration: line-through;">^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&amp;\w+=\w+)*)?</span></p>
<p>Should parse the url below</p>
<p><span style="text-decoration: underline;"><span style="color: #0000ff;"><a href="http://hh-1hallo.msn.blabla.com:80800/test/test/test.aspx?dd=dd&amp;id=dki">http://hh-1hallo.msn.blabla.com:80800/test/test/test.aspx?dd=dd&amp;id=dki</a></span></span></p>
<p>But not :</p>
<p><a href="http://hh-1hallo">http://hh-1hallo</a>. msn.blablabla.com:80800/test/test.aspx?dd=dd&amp;id=dki</p>
<p style="font-weight: bold;">Update 29/11/2008:</p>
<p>Joe posted what seems to be a great regular expression in the comments</p>
<p>he tested it with the following urls:</p>
<p>http://www.google.com/search?q=good+url+regex&amp;rls=com.microsoft:*&amp;ie=UTF-8&amp;oe=UTF-8&amp;startIndex=&amp;startPage=1</p>
<p>ftp://joe:password@ftp.filetransferprotocal.com</p>
<p>google.ru</p>
<p>https://some-url.com?query=&amp;name=joe?filter=*.*#some_anchor</p>
<p>Expression:</p>
<p style="font-weight: bold;"><span style="font-weight: normal; text-decoration: line-through;">^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&amp;(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?$</span></p>
<p style="font-weight: bold;">Update 8/11/2009:</p>
<p style="font-weight: bold;"><span style="font-weight: normal;">Expression</span>:</p>
<p style="font-weight: bold;">^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:\/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|\/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&amp;(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=?(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?$</p>
<p>There is a wave for this regex:</p>
<p><a href="https://wave.google.com/wave/?pli=1#restored:wave:googlewave.com!w%252BsFbGJUukA">https://wave.google.com/wave/?pli=1#restored:wave:googlewave.com!w%252BsFbGJUukA</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=pD0LEvxDzFY:x_OULEIcN0A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=pD0LEvxDzFY:x_OULEIcN0A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=pD0LEvxDzFY:x_OULEIcN0A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=pD0LEvxDzFY:x_OULEIcN0A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=pD0LEvxDzFY:x_OULEIcN0A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=pD0LEvxDzFY:x_OULEIcN0A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=pD0LEvxDzFY:x_OULEIcN0A:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/pD0LEvxDzFY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/11/08/a-good-url-regular-expression-repost/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/11/08/a-good-url-regular-expression-repost/</feedburner:origLink></item>
		<item>
		<title>Creating launcher scripts for IronRuby</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/1Hei_XkM_WM/</link>
		<comments>http://flanders.co.nz/2009/10/26/creating-launcher-scripts-for-ironruby/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 13:16:48 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[IronRuby]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/10/26/creating-launcher-scripts-for-ironruby/</guid>
		<description><![CDATA[It’s been a while since I blogged, I’ve been terribly busy going through some changes and prepping the book.
Anyway lately a lot of blog posts have been written on how to ironruby with cucumber to test your .NET code. While I think it’s great people are using ironruby and cucumber, the guide you can find [...]]]></description>
			<content:encoded><![CDATA[<p>It’s been a while since I blogged, I’ve been terribly busy going through some changes and prepping the book.</p>
<p>Anyway lately a lot of blog posts have been written on how to ironruby with cucumber to test your .NET code. While I think it’s great people are using ironruby and cucumber, the guide you can find on aslak’s github wiki isn’t the most ideal solution as it will&#160; only work for windows and it requires MRI to be installed on your system.&#160; So I thought I’d write up how I’ve been creating launchers that work both on windows .NET and mono systems.</p>
<p>Another problem the approach of setting the GEM_PATH to the MRI gem location is that if your gem requires a C-extension (which could easily be a C# extension in IronRuby) ruby will get confused about which one it’s going to need.</p>
<p>I’m going to use cucumber as an example but this counts for most ruby libraries. I’ve been using this for a few months already so it really doesn’t matter which version of IronRuby you’ve got installed. I’ve compiled a fresh version from github and deployed that to C:\ironruby on windows and added C:\ironruby\bin to my PATH environment variable. I installed my ironruby version on my *nix boxes in /usr/local/ironruby and added /usr/local/ironruby/bin, /usr/local/ironruby/silverlight/bin and /usr/local/ironruby/silverlight/scripts to my PATH environment variable.</p>
<h5>1. install the gem: igem install rspec cucumber &#8211;no-rdoc &#8211;no-ri</h5>
<p>this will install the rspec and cucumber gems with their dependencies. And the gems process will actually install the launcher scripts in C:\ironruby\lib\ironruby\gems\1.8\bin and we’re going to use those scripts to create our launcher script</p>
<h5>2. Get the launcher scripts into the bin dir</h5>
<p>On windows you can now go:</p>
<pre>copy C:\ironruby\lib\ironruby\gems\1.8\bin\cucumber C:\ironruby\bin\icucumber
copy C:\ironruby\lib\ironruby\gems\1.8\bin\cucumber.bat C:\ironruby\bin\icucumber.bat</pre>
<p>NTFS supports symlinks so you could also use the junction tool from the sysinternals toolkit to create those instead of copying the files. <a title="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx" href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx">http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx</a></p>
<p>On *nix based systems there is one more step to go through.</p>
<pre><strike>cp /usr/local/ironruby/lib/IronRuby/gems/1.8/bin/cucumber /usr/local/ironruby/bin/
mv /usr/local/ironruby/bin/cucumber /usr/local/ironruby/bin/icucumber</span></strike>
cp /usr/local/ironruby/lib/IronRuby/gems/1.8/bin/cucumber /usr/local/ironruby/bin/icucumber
chmod +x /usr/local/ironruby/bin/icucumber</pre>
<p>And this is the easier way to properly use installed gems from the ironruby distribution, it will also make it a lot easier to upgrade your gems in 2 different ruby installations at different times etc.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=1Hei_XkM_WM:v_QlpG6HXrA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=1Hei_XkM_WM:v_QlpG6HXrA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=1Hei_XkM_WM:v_QlpG6HXrA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=1Hei_XkM_WM:v_QlpG6HXrA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=1Hei_XkM_WM:v_QlpG6HXrA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=1Hei_XkM_WM:v_QlpG6HXrA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=1Hei_XkM_WM:v_QlpG6HXrA:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/1Hei_XkM_WM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/10/26/creating-launcher-scripts-for-ironruby/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/10/26/creating-launcher-scripts-for-ironruby/</feedburner:origLink></item>
		<item>
		<title>A rant on a talk falling to pieces</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/QGM_KuPZbLg/</link>
		<comments>http://flanders.co.nz/2009/07/02/a-rant-on-a-talk-falling-to-pieces/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 13:45:21 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[caricature]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[IronRuby MVC]]></category>
		<category><![CDATA[Presentation]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/07/02/a-rant-on-a-talk-falling-to-pieces/</guid>
		<description><![CDATA[Earlier this week I had the pleasure of doing a talk for the Belgian .NET user group.&#160; During this talk I ran in to all kinds of problems. I&#8217;ve done presentations where I was royally underprepared and to avoid that this time I actually started prepping for this talk on time. I was done on [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week I had the pleasure of doing a talk for the Belgian .NET user group.&#160; During this talk I ran in to all kinds of problems. I&#8217;ve done presentations where I was royally underprepared and to avoid that this time I actually started prepping for this talk on time. I was done on time, was prepared had 5 backups of my presentation and samples. What did I learn from this, if you&#8217;re prepared other things will go wrong.    <br />I&#8217;ll share the story of stuff that can go wrong. </p>
<p>Before starting the rant I have some links to share.</p>
<ul>
<li><a href="http://www.slideshare.net/casualjim/ruby-loves-dot-net" target="_blank">Slides</a> </li>
<li>IronRubyMvc sample – <a href="http://irtodo.koolkraft.net/" target="_blank">live demo</a> – <a href="http://github.com/casualjim/ironrubymvc-sample/tree/master" target="_blank">source</a> </li>
<li>Silverlight sample – <a href="http://samples.koolkraft.net/picture_view/" target="_blank">live demo</a> – <a href="http://samples.koolkraft.net/picture_view.zip" target="_blank">source</a> </li>
<li>IronRubyMVC specs – <a href="http://github.com/casualjim/ironrubymvc/tree" target="_blank">source</a> </li>
<li>Sinatra – <a href="http://samples.koolkraft.net/sinatra.zip" target="_blank">source</a></li>
<li>Metaprogramming &#8211; <a href="http://samples.koolkraft.net/metaprogramming.zip" target="_blank">source</a>&#160;</li>
</ul>
<p>I have a device that I call internet on a stick, which is a vodafone usb 3G modem that I plug in to my system and it gets me on the internet (mistake 1). Since I assumed that that thing would continue to work I made most of my demos internet enabled (mistake 2). For example I have a demo where I go download pics from flickr and then show them with some animations with silverlight.    <br />Before my presentation I changed the fonts, opened all the files I was going to talk about ran all the demos again to make sure they would work and everything went fine.     <br />I unplug the USB device and go into the room to hook up the projector etc. The presentation starts and for the first hour everything went really well (from my perspective at least don&#8217;t know about the people attending).     <br />We have a break and I plug the USB device in, at this point the vodafone program hangs (first time ever I swear). What&#8217;s more I can&#8217;t make it go away at all so I reboot my pc (this is still during the break). </p>
<p>Now I&#8217;m getting a little desperate because it still doesn&#8217;t work. With rebooting I also lost all my carefully opened files earlier (I&#8217;m showing code in about 3 different environments and 2 different OS&#8217;es).    <br />So during the presentation I apologise and try to reboot once more while taking questions from the audience and hoping somebody will try to start a discussion with me. After rebooting I got a message saying my date was set to 2001 which I thought was peculiar but clicked it away.&#160; I boot vmware fusion with windows 7 (this took fairly&#160; long and is a little bit funky as the screen resolution changes a lot during this process).     <br />Ok so far so good, by now I&#8217;ve already skipped the silverlight demo promising that it will be available as a download on my blog and will be moving on to the ironrubymvc sample. To prove I do actually use visual studio at times I wanted to open my demo project in visual studio. I open visual studio only for it to tell me that my trial has expired and I can either upgrade or close the application. Oooooookay this is completely weird because i get my software through my msdn subscription and I had been using it earlier that day. </p>
<p>Moral of the story: Either go vastly underprepared and wing it. Or don&#8217;t rely on the internet and always take at least 2 laptops that have identical configurations but I&#8217;m pretty sure those would or explode in my face or something will fall from the ceiling, building collapses or other mishaps. </p>
<p>Instead of having one demo go bad on me now I&#8217;m probably facing a reinstall of my mac because it lost a bunch of settings, for which I&#8217;m holding the vodafone responsible. At this moment I&#8217;m fairly certain that I should go less prepared and just wing it just out of fear for bigger disasters, people may die. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c3bf1872-2d44-4a67-91a3-8b41f485f175" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/IronRuby" rel="tag">IronRuby</a>,<a href="http://technorati.com/tags/IronRuby+MVC" rel="tag">IronRuby MVC</a>,<a href="http://technorati.com/tags/caricature" rel="tag">caricature</a>,<a href="http://technorati.com/tags/Presentation" rel="tag">Presentation</a></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=QGM_KuPZbLg:TRoK2n47cfs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=QGM_KuPZbLg:TRoK2n47cfs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=QGM_KuPZbLg:TRoK2n47cfs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=QGM_KuPZbLg:TRoK2n47cfs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=QGM_KuPZbLg:TRoK2n47cfs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=QGM_KuPZbLg:TRoK2n47cfs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=QGM_KuPZbLg:TRoK2n47cfs:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/QGM_KuPZbLg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/07/02/a-rant-on-a-talk-falling-to-pieces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/07/02/a-rant-on-a-talk-falling-to-pieces/</feedburner:origLink></item>
		<item>
		<title>Very simple IronRuby MVC sample application</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/TZyBa2mkibY/</link>
		<comments>http://flanders.co.nz/2009/06/09/very-simple-ironruby-mvc-sample-application/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 22:45:03 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[IronRuby MVC]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/06/09/very-simple-ironruby-mvc-sample-application/</guid>
		<description><![CDATA[Over the weekend I wrote a very simple task list application with IronRuby MVC and LightSpeed as an OR/M.&#160; And I’ve just put a demo live. This demo is running on a windows 2008 vps with IIS 7 as webserver. The source of this sample is also available.
 
At this moment I’m working on the [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I wrote a very simple task list application with IronRuby MVC and LightSpeed as an OR/M.&#160; And I’ve just put a demo live. This demo is running on a windows 2008 vps with IIS 7 as webserver. The source of this sample is also available.</p>
<p> <span id="more-359"></span>
<p>At this moment I’m working on the <a href="http://github.com/jschementi/ironrubymvc/" target="_blank">Ironruby mvc</a> sample for my book. And while I was playing around to get some samples together I tried building the simplest application possible that has some degree relations in the db and does some crud.&#160; And I came up with the original idea of creating a task list application.</p>
<p>As an OR/M I choose to use <a href="http://www.mindscape.co.nz/products/LightSpeed/" target="_blank">LightSpeed</a> and it runs on a sqlite database so it should be immediately usable after checking out.&#160; There is one caveat though. If you’re using a 32-bit OS you’ll need to replace the sqlite dll that is included in the dependencies tree with a 32-bit version of the dll and rebuild the solution.</p>
<p>The links:</p>
<p>Demo:    <br /><a href="http://irtodo.koolkraft.net/">http://irtodo.koolkraft.net/</a></p>
<p>Source of sample:   <br /><a href="http://github.com/casualjim/ironrubymvc-sample">http://github.com/casualjim/ironrubymvc-sample</a></p>
<p>IronRubyMVC source:</p>
<p><a href="http://github.com/jschementi/ironrubymvc">http://github.com/jschementi/ironrubymvc</a></p>
<p>LightSpeed:   <br /><a href="http://www.mindscape.co.nz/products/LightSpeed/">http://www.mindscape.co.nz/products/LightSpeed/</a></p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4d3a8ee4-af1e-4a71-8952-a2568042a958" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/IronRuby+MVC" rel="tag">IronRuby MVC</a>,<a href="http://technorati.com/tags/IronRuby" rel="tag">IronRuby</a>,<a href="http://technorati.com/tags/ASP.NET+MVC" rel="tag">ASP.NET MVC</a></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=TZyBa2mkibY:SA9-6_6OJnw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=TZyBa2mkibY:SA9-6_6OJnw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=TZyBa2mkibY:SA9-6_6OJnw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=TZyBa2mkibY:SA9-6_6OJnw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=TZyBa2mkibY:SA9-6_6OJnw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=TZyBa2mkibY:SA9-6_6OJnw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=TZyBa2mkibY:SA9-6_6OJnw:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/TZyBa2mkibY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/06/09/very-simple-ironruby-mvc-sample-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/06/09/very-simple-ironruby-mvc-sample-application/</feedburner:origLink></item>
		<item>
		<title>Getting started with Caricature and IronRuby</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/ZM9J0wZbdmc/</link>
		<comments>http://flanders.co.nz/2009/05/21/getting-started-with-caricature-and-ironruby/#comments</comments>
		<pubDate>Thu, 21 May 2009 13:52:17 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[Mocking]]></category>
		<category><![CDATA[caricature]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/05/21/getting-started-with-caricature-and-ironruby/</guid>
		<description><![CDATA[IronRuby 0.5 was released yesterday. You can download it on codeplex. This post will explain how you setup your ironruby environment to use it for testing existing CLR based assemblies.&#160; We’ll touch installing gems using rake and most importantly writing a test for a CLR based class where we’ll mock out the dependencies.
 
The first [...]]]></description>
			<content:encoded><![CDATA[<p>IronRuby 0.5 was released yesterday. You can download it on <a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25902#DownloadId=68919" target="_blank">codeplex</a>. This post will explain how you setup your ironruby environment to use it for testing existing CLR based assemblies.&#160; We’ll touch installing gems using rake and most importantly writing a test for a CLR based class where we’ll mock out the dependencies.</p>
<p> <span id="more-351"></span>
<p>The first thing you need to do is download <a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25902#DownloadId=68919" target="_blank">IronRuby</a>. After downloading you can extract it to a location on your hard drive. I extracted mine to C:\ironruby</p>
<p>Now we need to add the path to ir.exe to our PATH variable so we can use it from the command-line. And that is all there is to it to install ironruby on your machine. Now we need to get the necessary gems onto our system. We’ll need bacon and caricature.</p>
<p>Open a console and type the following:</p>
<p>igem list will show you a list of the gems you have installed on your system.</p>
<p>igem install will fetch and install a gem on your system. To install the gems we’re going to need we need to execute the command</p>
<p>igem install bacon caricature</p>
<p>That will result in the following output:</p>
<pre>

+ C:\tools
» cmd
Microsoft Windows [Version 6.1.7100]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\tools&gt;where ir
C:\ironruby\bin\ir.exe

C:\tools&gt;exit
+ C:\tools
» igem list

*** LOCAL GEMS ***

+ C:\tools
» igem install bacon caricature
Successfully installed bacon-1.1.0
Successfully installed caricature-0.6.0
3 gems installed
Installing ri documentation for bacon-1.1.0...
Installing ri documentation for caricature-0.6.0...
Installing RDoc documentation for bacon-1.1.0...
Installing RDoc documentation for caricature-0.6.0...
</pre>
<p>If you would try to execute ibacon at this point that would work. We’ll need to create 2 small files to get ibacon to work.&#160; In the bin directory of ironruby I created 2 files one called ibacon and the other one is ibacon.bat </p>
<p>ibacon</p>
<pre class="ruby" name="code">

#!C:/ironruby/bin/ir.exe
#
# This file was generated by RubyGems.
#
# The application 'bacon' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = &quot;&gt;= 0&quot;

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'bacon', version
load 'bacon'
</pre>
<p>ibacon.bat</p>
<pre name="code">

@ECHO OFF

@&quot;ir.exe&quot; &quot;%~dpn0&quot; %*
</pre>
<p>At this point you’re ready to start writing specs with bacon and caricature. Let’s look at an example I wrote for the controller factory for ironruby mvc.</p>
<p>We’re going to test the following C# code.</p>
<pre class="csharp" name="code">

public interface IWeapon{
    int Attack(IWarrior warrior);
    int Damage();
}

public interface IWarrior
{
    int Id { get; }
    string Name { get; set; }
    bool IsKilledBy(IWeapon weapon);
    int Attack(IWarrior target, IWeapon weapon);
    int SurviveAttackWith(IWeapon weapon);
}

public class Sword : IWeapon
{

    public int Attack(IWarrior warrior){
        return warrior.SurviveAttackWith(this);
    }

    public int Damage(){
        return 4;
    }
}
</pre>
<p>I generally create a bacon_helper.rb file where I group my requires and helper functions etc. In the case of this test I have the following in the bacon_helper.rb:</p>
<pre class="ruby" name="code">

# add some search paths to ironruby
# this first one adds the path with the assemblies
# this enables us not to have to specify a path to the assemblies everywhere.
$: &lt;&lt; File.dirname(__FILE__) + &quot;/bin&quot;
# adds the path to the caricature library.
$: &lt;&lt; File.dirname(__FILE__) + &quot;/../lib&quot;

# load the caricature library
require &quot;caricature&quot;
require 'caricature/clr'

# load the bacon library
require 'bacon'

# Add the .NET framework
require 'mscorlib'

# load the assembly with the C# code
load_assembly 'ClrModels'
</pre>
<p>At this point we’re ready to start writing the test. create a file called sword_spec.rb and we’ll add the following content to the file.</p>
<pre class="ruby" name="code">

require File.dirname(__FILE__) + &quot;/bacon_helper.rb&quot;

describe &quot;ClrModels::Sword&quot; do

  before do
    @warrior = Caricature::Isolation.for ClrModels::IWarrior
  end

  it &quot;should call survive_attack on the mock&quot; do
    @warrior.when_receiving(:survive_attack_with).return(5)

    sword = ClrModels::Sword.new
    sword.attack(@warrior).should.equal 5

    @warrior.did_receive?(:survive_attack_with).should.be.successful
  end

  it &quot;should return different results when expectation is defined with arguments&quot; do
    sword1 = ClrModels::Sword.new
    sword2 = ClrModels::Sword.new

    @warrior.when_receiving(:survive_attack_with).return(5)
    @warrior.when_receiving(:survive_attack_with).with(sword2).return(15)

    sword1.attack(@warrior).should.equal 5
    sword2.attack(@warrior).should.equal 15

    @warrior.did_receive?(:survive_attack_with).with(sword2).should.be.successful
  end

end
</pre>
<p>So now we’ve got 2 tests for our Sword class. The only thing that is left to do is to run the specs. You can do that by executing the ibacon command and passing it the file you want to test.</p>
<pre name="code">

+ C:\dev\caricature
(master) » ibacon spec/sword_spec.rb
ClrModels::Sword
- should call survive_attack on the mock
- should return different results when expectation is defined with arguments

2 specifications (5 requirements), 0 failures, 0 errors
</pre>
<p><div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e7a7ff6b-7e8d-4103-aea9-665298fa5cde" style="float:none; display:inline; margin:0px; padding:0px 0px 0px 0px;">Technorati Tags: <a href="http://technorati.com/tags/ironruby" rel="tag">ironruby</a>,<a href="http://technorati.com/tags/caricature" rel="tag">caricature</a>,<a href="http://technorati.com/tags/mocking" rel="tag">mocking</a></div></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=ZM9J0wZbdmc:MhSyxsztD5M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=ZM9J0wZbdmc:MhSyxsztD5M:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=ZM9J0wZbdmc:MhSyxsztD5M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=ZM9J0wZbdmc:MhSyxsztD5M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=ZM9J0wZbdmc:MhSyxsztD5M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=ZM9J0wZbdmc:MhSyxsztD5M:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=ZM9J0wZbdmc:MhSyxsztD5M:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/ZM9J0wZbdmc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/05/21/getting-started-with-caricature-and-ironruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/05/21/getting-started-with-caricature-and-ironruby/</feedburner:origLink></item>
		<item>
		<title>Caricature ready for beta</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/Rfs_OzTMfas/</link>
		<comments>http://flanders.co.nz/2009/05/19/caricature-ready-for-beta/#comments</comments>
		<pubDate>Tue, 19 May 2009 14:06:04 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[Mocking]]></category>
		<category><![CDATA[caricature]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/05/19/caricature-ready-for-beta/</guid>
		<description><![CDATA[The last couple of days I’ve been getting Caricature to a more releasable state. The code got a thorough cleanup and refactor. Caricature now knows how to be a full mocking framework for Ruby classes and CLR classes that only interact with ruby objects. When I apply the 80/20 rule to caricature it’s definitely beta [...]]]></description>
			<content:encoded><![CDATA[<p>The last couple of days I’ve been getting <a href="http://github.com/casualjim/caricature" target="_blank">Caricature</a> to a more releasable state. The code got a thorough cleanup and refactor. Caricature now knows how to be a full mocking framework for Ruby classes and CLR classes that only interact with ruby objects. When I apply the 80/20 rule to caricature it’s definitely beta worthy.</p>
<p>   <span id="more-349"></span>
<p>I’m not a huge fan of the 80/20 rule unless all the features I want are in the 80 part. In that case for me it’s a 100 rule <img src='http://flanders.co.nz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . </p>
<p>As for the latest changes:</p>
<p>Adding <em><strong>require ‘caricature’</strong></em> only gives you ruby mocking. If you want to use it to mock CLR classes or interact with the CLR you’ll need to add an extra require statement:<em><strong> require ‘caricature/clr’</strong></em>. I’ve done it this way so that I can still add Java and MacRuby support later on.</p>
<p>By default caricature will always give you an instance of an isolation, but there are times that you’ll want to substitute the result of a class method invocation. So the API got expanded with 2 methods, <strong><em>when_class_receives</em></strong> and<strong><em> did_class_receive?</em></strong>&#160; These methods enable you to setup substitutions for class method calls.</p>
<p>I’m still waiting for IronRuby 0.5 to be released to give you a blow-by-blow tutorial on how to setup your environment.</p>
<p>Basically you download the ironruby release from <a href="http://ironruby.codeplex.com/Release/ProjectReleases.aspx" target="_blank">Codeplex</a></p>
<p>Then you make sure the path to ir.exe is in your PATH variable</p>
<p>After that you should be able to do igem list and get an empty result back.</p>
<p>now you need to install bacon you can do that by executing</p>
<p>igem install bacon</p>
<p>next you need the caricature gem</p>
<p>igem install caricature</p>
<p>You will also need rake to be installed to build the cs files included in the sources.</p>
<p>igem install rake</p>
<p>ok now you should be good to to</p>
<pre class="ruby" name="code">

require 'rubygems'
require 'bacon'
require 'caricature'
require 'caricature/clr'

describe "when isolating Ruby classes with class members" do

  before do
    @dagger = Dagger.new
    @soldier = Caricature::Isolation.for(SoldierWithClassMembers)
  end

  it "should work without expectations" do
    result = @dagger.attack @soldier
    result.should.equal nil
    @soldier.did_receive?(:survive_attack_with).with(@dagger).should.be.successful
  end

  it "should work for expectations with an argument constraint" do
    @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
    @dagger.attack(@soldier).should.equal 5
    @soldier.did_receive?(:survive_attack_with).with(:any).should.be.successful
  end

end
</pre>
<p>you can get the gem from <a href="http://rubyforge.org/projects/caricature/" target="_blank">rubyforge</a>&#160;</p>
<p>Or from my github account: <a title="http://github.com/casualjim/caricature" href="http://github.com/casualjim/caricature">http://github.com/casualjim/caricature</a></p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5c7b90c5-1c5c-40e2-8aa3-b5a6fa638c0a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/caricature" rel="tag">caricature</a>,<a href="http://technorati.com/tags/ironruby" rel="tag">ironruby</a>,<a href="http://technorati.com/tags/mocking" rel="tag">mocking</a></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=Rfs_OzTMfas:tm0gA2iJ-NY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=Rfs_OzTMfas:tm0gA2iJ-NY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=Rfs_OzTMfas:tm0gA2iJ-NY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=Rfs_OzTMfas:tm0gA2iJ-NY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=Rfs_OzTMfas:tm0gA2iJ-NY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=Rfs_OzTMfas:tm0gA2iJ-NY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=Rfs_OzTMfas:tm0gA2iJ-NY:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/Rfs_OzTMfas" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/05/19/caricature-ready-for-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/05/19/caricature-ready-for-beta/</feedburner:origLink></item>
		<item>
		<title>An update on caricature</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/E_cP8Yi_bkw/</link>
		<comments>http://flanders.co.nz/2009/05/15/an-update-on-caricature/#comments</comments>
		<pubDate>Fri, 15 May 2009 22:34:46 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[caricature]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/05/15/an-update-on-caricature/</guid>
		<description><![CDATA[Yesterday I explained about caricature but I didn’t have it fully tested yet. Today I’ve written a bunch of integration specs for all the platform combinations Caricature currently supports so you should be able to use Caricature also for plain ruby object mocking in addition to CLR interop mocking.
After having a very brief twitter discussion [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I explained about caricature but I didn’t have it fully tested yet. Today I’ve written a bunch of integration specs for all the platform combinations Caricature currently supports so you should be able to use Caricature also for plain ruby object mocking in addition to CLR interop mocking.</p>
<p>After having a very brief twitter discussion with Scott I decided it would be a good idea to change the name of the methods <em>when\_told\_to</em> and <em>was\_told\_to?</em> . In ruby objects receive messages so the wording now becomes <em>when\_receiving</em> and <em>did\_receive? </em>. I have a problem with the should naming because there is nothing conditional about it. Either you want the method to return something or you want it to return a default value for CLR value types or nil.&#160; And if you’re asserting if a method it called that is deterministic; it is either called or not there is no gray area there. </p>
<pre name="code" class="ruby">

ninja = ClrModels::Ninja.new 

@weapon.when_receiving(:attack).with(ninja).return(5) 

@ninja.attack(ninja, @weapon).should.equal 5 

@weapon.did_receive?(:attack).with(:any).should.be.successful 
</pre>
<p>Before I call it 1.0 I want to at least give ruby objects also the ability to isolate static and sealed methods as well as mocking ruby class methods.&#160; So that for CLR to Ruby interaction you a get the full range of possibilities.</p>
<p>I have also <a href="http://casualjim.github.com/caricature/Caricature.html" target="_blank">set up a site on github</a> that contains the API documentation for Caricature. When IronRuby 0.5 releases I’ll publish a blog post that will talk you through testing your CLR assembly with IronRuby, bacon and Caricature. </p>
<p>For now you can take a look <a href="http://github.com/casualjim/caricature/blob/7ab1d513be74b26c95a1ca34cc1d01f6c850cc43/spec/integration_spec.rb" target="_blank">here</a> for example on how to use Caricature for isolating features.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=E_cP8Yi_bkw:h7eEsqtwQaA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=E_cP8Yi_bkw:h7eEsqtwQaA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=E_cP8Yi_bkw:h7eEsqtwQaA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=E_cP8Yi_bkw:h7eEsqtwQaA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=E_cP8Yi_bkw:h7eEsqtwQaA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=E_cP8Yi_bkw:h7eEsqtwQaA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=E_cP8Yi_bkw:h7eEsqtwQaA:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/E_cP8Yi_bkw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/05/15/an-update-on-caricature/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/05/15/an-update-on-caricature/</feedburner:origLink></item>
		<item>
		<title>IronRuby just got a mocking framework – kind of</title>
		<link>http://feedproxy.google.com/~r/casualjim/~3/5IKGh4U9xgA/</link>
		<comments>http://flanders.co.nz/2009/05/14/ironruby-just-got-a-mocking-framework-kind-of/#comments</comments>
		<pubDate>Thu, 14 May 2009 22:31:50 +0000</pubDate>
		<dc:creator>Ivan Porto Carrero</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[IronRuby]]></category>
		<category><![CDATA[caricature]]></category>
		<category><![CDATA[CLR interop]]></category>
		<category><![CDATA[Mocking]]></category>

		<guid isPermaLink="false">http://flanders.co.nz/2009/05/14/ironruby-just-got-a-mocking-framework-kind-of/</guid>
		<description><![CDATA[As I mentioned in a previous post.&#160; I started working on a small mocking framework. It has now progressed far enough to handle the most common mocking tasks.
Below I pasted the output of the integration tests for CLR interop.
when isolating CLR interfaces      - should work without expectations    [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in a previous <a href="http://flanders.co.nz/2009/05/03/mocking-for-ironruby/">post</a>.&#160; I started working on a small mocking framework. It has now progressed far enough to handle the most common mocking tasks.</p>
<p>Below I pasted the output of the integration tests for CLR interop.</p>
<blockquote><p>when isolating CLR interfaces      <br />- should work without expectations       <br />- should work with an expectation with any arguments       <br />- should work with an expectation getting different method call result       <br />- should work for an assertion on a specific argument </p>
<p>when isolating CLR classes      <br />- should work without expectations       <br />- should work with an expectation for any arguments       <br />- should work with an assertion for specific arguments       <br />- should fail for an assertion with wrong arguments </p>
<p>when isolating CLR instances      <br />- should work without expectations       <br />- should work with an expectation for any arguments       <br />- should fail for an assertion for specific arguments       <br />- should allow to delegate the method call to the real instance (partial mock)</p>
</blockquote>
<p>you will need bacon installed to run the specs. you should issue the command <em>igem install bacon</em> for that.</p>
<p>you can then install the caricature gem in ironruby by issueing</p>
<p><em>igem install caricature</em></p>
<p>To use it there are some examples in the file spec/integration_spec.rb </p>
<pre name="code" class="ruby">

require 'rubygems'
require 'bacon'
require 'caricature'

ninja.when_told_to(:survive_attack_with).return(5) 

weapon.attack(ninja).should.equal 5 

ninja.was_told_to?(:survive_attack_with).with(:any).should.be.successful
</pre>
<p>There is a gotcha though, when you use it in a CLR class you&#8217;re bound to CLR rules and it only overrides the methods that are marked as virtual. We also can&#8217;t isolate static or sealed types at the moment.<br />
  </p>
<p>I took the approach of doing away with the terminology of mocking and subbing and instead chose the much clearer Isolation. By default any method returns null or the default value of a value type. You can tell an isolation to return a specific value or raise an error etc.&#160; Later on you can then assert if the method was actually called.&#160; </p>
<p>This fits in better with the way you probably structure your tests. </p>
<p>I hope you like it.</p>
<p>You can find the source in my github account.<br />
  <br /><a href="http://github.com/casualjim/caricature">http://github.com/casualjim/caricature</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/casualjim?a=5IKGh4U9xgA:4wv3IRlr848:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=5IKGh4U9xgA:4wv3IRlr848:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/casualjim?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=5IKGh4U9xgA:4wv3IRlr848:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/casualjim?i=5IKGh4U9xgA:4wv3IRlr848:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=5IKGh4U9xgA:4wv3IRlr848:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/casualjim?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/casualjim?a=5IKGh4U9xgA:4wv3IRlr848:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/casualjim?i=5IKGh4U9xgA:4wv3IRlr848:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/casualjim/~4/5IKGh4U9xgA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://flanders.co.nz/2009/05/14/ironruby-just-got-a-mocking-framework-kind-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://flanders.co.nz/2009/05/14/ironruby-just-got-a-mocking-framework-kind-of/</feedburner:origLink></item>
	</channel>
</rss>
