Skip to content

updating embedded jruby gems with ant

Recently I have been using cuke4duke on a java project (which I’ll discuss in a later article). We have jruby running from jruby-lib/jruby-complete.jar. Our gems are embedded in the project with the GEM_HOME/GEM_PATH being set to jruby-lib/gems. All of this is under source control. We don’t have jruby installed at all on the system, it is only in this project. I’ve mainly been the one on the team (of 4 total) who has been maintaining the jruby stuff as none of the other devs have jruby experience.

So one of the problems I had recently was how to update the gems that are checked into source. One of the other devs wanted to use multi-line strings in cucumber and found that it didn’t work with cuke4duke until cucumber-0.4.4. We had 0.4.2. So what I needed was an easy way for the other devs to be able to update the gems without relying on jruby being “installed” on the machine. Since these are java guys, ant seemed the best solution.

Here is the ant task I used:

<path id="jruby.classpath">
	<fileset dir="jruby-lib">
		<include name="**/*.jar" />
		<exclude name="gems/*" />
	</fileset>
</path>
<target name="update.gems" description="update the installed gems">
	<!-- this updates the gems on the system -->
	<java classname="org.jruby.Main" fork="true" failonerror="true">
		<classpath refid="jruby.classpath" />
		<env key="GEM_PATH" value="jruby-lib/gems" />
		<env key="GEM_HOME" value="jruby-lib/gems" />
		<arg value="-S" />
		<arg value="gem" />
		<arg value="update" />
	</java>
	<!-- this removes any obsoleted / previous version of all gems -->
	<java classname="org.jruby.Main" fork="true" failonerror="true">
		<classpath refid="jruby.classpath" />
		<env key="GEM_PATH" value="jruby-lib/gems" />
		<env key="GEM_HOME" value="jruby-lib/gems" />
		<arg value="-S" />
		<arg value="gem" />
		<arg value="cleanup" />
	</java>
</target>

8 Comments

  1. Good stuff. Will steal this if you’re ok with it: http://github.com/aslakhellesoy/cuke4duke/issues/#issue/43

    Tuesday, December 8, 2009 at 3:16 pm | Permalink
  2. instituiré wrote:

    Pero te echamos un cable para que consigas alcanzar el propósito de superar este goloso juego de plataformas,
    y te enumeramos una serie de trucos, esencialmente
    para iniciados, que te vendrán como anillo al dedo
    para ser el genuino ‘number one’ de Candy Crush Saga.

    Friday, October 10, 2014 at 2:06 pm | Permalink
  3. Thank you, I have recently been looking for info approximately
    this topic for ages and yours is the greatest I’ve found out till now.

    However, what in regards to the conclusion? Are yoou positive concerning the supply?

    Wednesday, June 10, 2015 at 4:04 pm | Permalink
  4. Shana wrote:

    This is rеally inteгesting, Yoou aгe a very skilled blogger.
    I’ve joined yoսr rss feed аnd lοoқ forwar tⲟ seeking mοrе ⲟf yoᥙr excellent
    post. Αlso, I’vе shared yоur web site in my social networks!

    Tuesday, May 24, 2016 at 10:07 am | Permalink
  5. It’s a shame you don’t have a donate button! I’d definitely donate to this outstanding blog!
    I guess for now i’ll settle for bookmarking and adding your
    RSS feesd too mmy Google account. I look forward to
    brand new updates and will talk about this website with my Facebook group.
    Talk soon!

    Wednesday, December 7, 2016 at 6:41 pm | Permalink
  6. Do exact slugs (URL) help get more website traffic?.….

    Monday, January 2, 2017 at 8:13 am | Permalink
  7. It’s awesome in support of me to have a site, which is useful in support of my know-how.
    thanks admin

    Monday, January 2, 2017 at 2:01 pm | Permalink
  8. This piece of writing provides clear idea in support of
    the new viewers of blogging, that truly how to do
    blogging and site-building.

    Saturday, January 7, 2017 at 5:22 am | Permalink

3 Trackbacks/Pingbacks

  1. Gooder Code on Wednesday, February 24, 2010 at 9:57 am

    JRuby 1.5 to provide native support for Ant…

    In case you haven’t heard, the next version of JRuby will provide native support for Ant.  Much like antwrap, you will be able to call ant tasks straight from Ruby.  There are some pretty good examples here, but no examples of how to get it…..

  2. Chiropractors Near Me Reviews Santa Monica on Tuesday, December 13, 2016 at 8:28 am

    Chiropractors Near Me Reviews Santa Monica

    confabulus › updating embedded jruby gems with ant

  3. Culver City Chiropractor on Wednesday, March 1, 2017 at 6:14 am

    Culver City Chiropractor

    confabulus › updating embedded jruby gems with ant

Post a Comment

Your email is never published nor shared.