<?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>Ketan&#039;s Musings &#187; eclipse-meets-jruby</title>
	<atom:link href="http://ketan.padegaonkar.name/tag/eclipse-meets-jruby/feed" rel="self" type="application/rss+xml" />
	<link>http://ketan.padegaonkar.name</link>
	<description>Where he blogs about his eclipse musings</description>
	<lastBuildDate>Sat, 26 Feb 2011 18:24:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Cucumber On JRuby inside Eclipse</title>
		<link>http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html</link>
		<comments>http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html#comments</comments>
		<pubDate>Fri, 10 Apr 2009 03:55:22 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse-meets-jruby]]></category>
		<category><![CDATA[jruby]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/?p=293</guid>
		<description><![CDATA[Fredrick recently asked on the swtbot newsgroup: My goal is to be able to write some user acceptance tests (using Cucumber) to be able to tests some of my Eclipse plug-ins. Cucumber is a BDD framework written in (J)ruby. It executes plain text files as functional tests. As a first step, the goal was to [...]]]></description>
			<content:encoded><![CDATA[<p>Fredrick recently asked on the <a href="http://www.eclipse.org/newsportal/article.php?id=517&amp;group=eclipse.swtbot#517">swtbot newsgroup</a>:</p>
<blockquote><p>
My goal is to be able to write some user acceptance tests (using Cucumber) to be able to tests some of my Eclipse plug-ins.
</p></blockquote>
<p><a href="http://cukes.info">Cucumber</a> is a BDD framework written in (J)ruby. It executes plain text files as functional tests. As a first step, the goal was to be able to print a simple &#8216;hello world&#8217;:</p>
<p>This required being able to <a href="http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html">bundle jruby with the necessary gems</a>, the jruby jar is already OSGi-fied, so creating a manifest was not required.</p>
<p>First drop in the jruby-complete.jar that <a href="http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html">we just created</a> inside the target eclipse&#8217;s plugins directory.</p>
<p>Then create an eclipse application with the following in it:</p>
<pre>public class CucumberRunner implements IApplication {

    public Object start(IApplicationContext context) throws Exception {
        Bundle bundle = Platform.getBundle("org.jruby.jruby");

        URL jrubyHome = FileLocator.toFileURL(bundle.getEntry("/META-INF/jruby.home"));

        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setJRubyHome(jrubyHome.toString());
        Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(), config);
        RubyRuntimeAdapter evaler = JavaEmbedUtils.newRuntimeAdapter();
        evaler.eval(runtime, "p 'Hello, Eclipse World'");
        JavaEmbedUtils.terminate(runtime);

        return EXIT_OK;
    }

    public void stop() {
        // do nothing
    }
}
</pre>
<div id="attachment_302" class="wp-caption alignnone" style="width: 310px"><a href="http://ketan.padegaonkar.name/files/2009/04/jruby-hello-world.png"><img src="http://ketan.padegaonkar.name/files/2009/04/jruby-hello-world-300x204.png" alt="Hello, Eclipse World" width="300" height="204" class="size-medium wp-image-302" /></a><p class="wp-caption-text">Hello, Eclipse World</p></div>
<p>Now all we needed was to be able to execute the cucumber <a href="http://github.com/aslakhellesoy/cucumber/blob/bbce49bd66750b68418911f3294e07b0d8ed927b/bin/cucumber">executable</a> instead of printing hello world <img src='http://ketan.padegaonkar.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Import the <a href='http://ketan.padegaonkar.name/files/2009/04/orgeclipseswtbotcucumber.zip'>cucumber plugin</a> with a sample calculator to execute it:</p>
<div id="attachment_327" class="wp-caption alignnone" style="width: 310px"><a href="http://ketan.padegaonkar.name/files/2009/04/cucumber-calculator.png"><img src="http://ketan.padegaonkar.name/files/2009/04/cucumber-calculator-300x99.png" alt="Cucumber Output" width="300" height="99" class="size-medium wp-image-327" /></a><p class="wp-caption-text">Cucumber Output</p></div>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-googlebuzz">
			<a href="http://www.shareaholic.com/api/share/?title=Cucumber+On+JRuby+inside+Eclipse&amp;link=http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html&amp;notes=Fredrick%20recently%20asked%20on%20the%20swtbot%20newsgroup%3A%0A%0A%0AMy%20goal%20is%20to%20be%20able%20to%20write%20some%20user%20acceptance%20tests%20%28using%20Cucumber%29%20to%20be%20able%20to%20tests%20some%20of%20my%20Eclipse%20plug-ins.%0A%0A%0ACucumber%20is%20a%20BDD%20framework%20written%20in%20%28J%29ruby.%20It%20executes%20plain%20text%20files%20as%20functional%20tests.%20As%20a%20first%20step%2C%20the%20goal&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Cucumber+On+JRuby+inside+Eclipse&amp;link=http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html&amp;notes=Fredrick%20recently%20asked%20on%20the%20swtbot%20newsgroup%3A%0A%0A%0AMy%20goal%20is%20to%20be%20able%20to%20write%20some%20user%20acceptance%20tests%20%28using%20Cucumber%29%20to%20be%20able%20to%20tests%20some%20of%20my%20Eclipse%20plug-ins.%0A%0A%0ACucumber%20is%20a%20BDD%20framework%20written%20in%20%28J%29ruby.%20It%20executes%20plain%20text%20files%20as%20functional%20tests.%20As%20a%20first%20step%2C%20the%20goal&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=Cucumber+On+JRuby+inside+Eclipse&amp;link=http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html&amp;notes=Fredrick%20recently%20asked%20on%20the%20swtbot%20newsgroup%3A%0A%0A%0AMy%20goal%20is%20to%20be%20able%20to%20write%20some%20user%20acceptance%20tests%20%28using%20Cucumber%29%20to%20be%20able%20to%20tests%20some%20of%20my%20Eclipse%20plug-ins.%0A%0A%0ACucumber%20is%20a%20BDD%20framework%20written%20in%20%28J%29ruby.%20It%20executes%20plain%20text%20files%20as%20functional%20tests.%20As%20a%20first%20step%2C%20the%20goal&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=RT+%40ketanpkr+%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=Cucumber+On+JRuby+inside+Eclipse&amp;link=http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html&amp;notes=Fredrick%20recently%20asked%20on%20the%20swtbot%20newsgroup%3A%0A%0A%0AMy%20goal%20is%20to%20be%20able%20to%20write%20some%20user%20acceptance%20tests%20%28using%20Cucumber%29%20to%20be%20able%20to%20tests%20some%20of%20my%20Eclipse%20plug-ins.%0A%0A%0ACucumber%20is%20a%20BDD%20framework%20written%20in%20%28J%29ruby.%20It%20executes%20plain%20text%20files%20as%20functional%20tests.%20As%20a%20first%20step%2C%20the%20goal&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.shareaholic.com/api/share/?title=Cucumber+On+JRuby+inside+Eclipse&amp;link=http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html&amp;notes=Fredrick%20recently%20asked%20on%20the%20swtbot%20newsgroup%3A%0A%0A%0AMy%20goal%20is%20to%20be%20able%20to%20write%20some%20user%20acceptance%20tests%20%28using%20Cucumber%29%20to%20be%20able%20to%20tests%20some%20of%20my%20Eclipse%20plug-ins.%0A%0A%0ACucumber%20is%20a%20BDD%20framework%20written%20in%20%28J%29ruby.%20It%20executes%20plain%20text%20files%20as%20functional%20tests.%20As%20a%20first%20step%2C%20the%20goal&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=102&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Run JRuby From Within A Jar And Package Your Own Gems Along</title>
		<link>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html</link>
		<comments>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html#comments</comments>
		<pubDate>Fri, 10 Apr 2009 03:50:35 +0000</pubDate>
		<dc:creator>Ketan</dc:creator>
				<category><![CDATA[experiences]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[GNU & Linux]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse-meets-jruby]]></category>
		<category><![CDATA[jruby]]></category>

		<guid isPermaLink="false">http://ketan.padegaonkar.name/?p=323</guid>
		<description><![CDATA[Jruby-in a jar already bundles rspec and rake, so the goal was to find out where it gets packaged. Download the jruby source zip, extract it and open the build.xml file, search for &#8220;rspec&#8221; (there&#8217;s two occurences) and you&#8217;ll find that it&#8217;s passed in as an argument to the gem installer, add in another line [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dist.codehaus.org/jruby/1.2.0/jruby-complete-1.2.0.jar">Jruby-in a jar</a> already bundles <a href="http://rspec.info/">rspec</a> and <a href="http://rake.rubyforge.org/">rake</a>, so the goal was to find out where it gets packaged.</p>
<p>Download the <a href="http://dist.codehaus.org/jruby/1.2.0/jruby-src-1.2.0.zip">jruby source zip</a>, extract it and open the build.xml file, search for &#8220;rspec&#8221; (there&#8217;s two occurences) and you&#8217;ll find that it&#8217;s passed in as an argument to the gem installer, add in another line with &#8220;cucumber&#8221;:</p>
<pre>
&lt;target name="install-gems"&gt;
  &lt;property name="jruby.home" value="${basedir}"/&gt;
  &lt;java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true"&gt;
    &lt;classpath refid="build.classpath"/&gt;
    &lt;classpath path="${jruby.classes.dir}"/&gt;
    &lt;sysproperty key="jruby.home" value="${jruby.home}"/&gt;
    &lt;arg value="--command"/&gt;
    &lt;arg value="maybe_install_gems"/&gt;
    &lt;arg value="rspec"/&gt;
    &lt;arg value="rake"/&gt;
    <b>&lt;arg value="cucumber"/&gt; &lt;!-- add cucumber --&gt;</b>
    &lt;arg value="--env-shebang"/&gt;
  &lt;/java&gt;
&lt;/target&gt;
</pre>
<p>Then run ant:</p>
<pre><b>$ ant jar-complete</b></pre>
<p>To verify that everything is fine:</p>
<pre>$ <b>java -jar lib/jruby-complete.jar -S gem list</b>

*** LOCAL GEMS ***

builder (2.1.2)
cucumber (0.2.3)
diff-lcs (1.1.2)
polyglot (0.2.5)
rake (0.8.4)
rspec (1.2.2)
sources (0.0.1)
term-ansicolor (1.0.3)
treetop (1.2.5)</pre>
<p>Great we&#8217;ve now managed to package jruby-in-a-jar with some additional gems. Now to run <a href="http://ketan.padegaonkar.name/2009/04/10/cucumber-on-jruby-inside-eclipse.html">cucumber on jruby in eclipse</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-googlebuzz">
			<a href="http://www.shareaholic.com/api/share/?title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;link=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;notes=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://www.shareaholic.com/api/share/?title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;link=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;notes=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-twitter">
			<a href="http://www.shareaholic.com/api/share/?title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;link=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;notes=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=RT+%40ketanpkr+%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.shareaholic.com/api/share/?title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;link=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;notes=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-dzone">
			<a href="http://www.shareaholic.com/api/share/?title=Run+JRuby+From+Within+A+Jar+And+Package+Your+Own+Gems+Along&amp;link=http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html&amp;notes=Jruby-in%20a%20jar%20already%20bundles%20rspec%20and%20rake%2C%20so%20the%20goal%20was%20to%20find%20out%20where%20it%20gets%20packaged.%0A%0ADownload%20the%20jruby%20source%20zip%2C%20extract%20it%20and%20open%20the%20build.xml%20file%2C%20search%20for%20%22rspec%22%20%28there%27s%20two%20occurences%29%20and%20you%27ll%20find%20that%20it%27s%20passed%20in%20as%20an%20argument%20to%20the%20gem%20installer%2C%20add%20in%20anoth&amp;short_link=&amp;shortener=bitly&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=102&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to DZone">Add this to DZone</a>
		</li>
</ul><div style="clear: both;"></div><div class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div style="clear: both;"></div></div>

]]></content:encoded>
			<wfw:commentRss>http://ketan.padegaonkar.name/2009/04/10/run-jruby-from-within-a-jar-and-package-your-own-gems-along.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

