Ant script to run rake tasks

We have a JRuby rails able that we war up with warbler.

Our client prefers to have ant tasks to do all there deployment,
building.

Has anyone created an ant task that executes rake tasks using JRuby?

I’m thinking it should not be too tough but thought I’d ask the question
before finding the gotchas myself :slight_smile:

Thanks in advance!

I am landing something soon (next couple of days) into jruby core
which will be able to do this and more. You can look at the source
for now at:
http://github.com/enebo/akakamiari

The rake importing code works well and once in jruby master it should
easily bootstrap without any environment tweaks.

-Tom

On Fri, Jan 29, 2010 at 8:53 AM, Homer S. [email protected]
wrote:

Thanks in advance!

Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks for the reply.

So, without this there is no way to simply run a rake task from ant?

I was thinking something like (though I haven’t tried it):

<target name="migrate">
    <java jar="jruby-complete-1.4.0.jar" fork="true">
       <arg value="-S rake db:migrate"/>

Regards

Thomas E Enebo wrote:

I am landing something soon (next couple of days) into jruby core
which will be able to do this and more. You can look at the source
for now at:
http://github.com/enebo/akakamiari

The rake importing code works well and once in jruby master it should
easily bootstrap without any environment tweaks.

-Tom

On Fri, Jan 29, 2010 at 8:53 AM, Homer S. [email protected]
wrote:

This approach will work fine too, it’s just more manual and verbose.
You can look at JRuby’s own build.xml, we currently have a number of
places where we launch JRuby from Ant.

/Nick

On Fri, Jan 29, 2010 at 10:30 AM, Homer S. [email protected]
wrote:

> easily bootstrap without any environment tweaks.

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I was close, I just needed to change this line to:

Migrate work great.

Trying to create the war (via warbler) with jruby-complete.jar now. If
I could get that working I’d be in great shape.

Getting an error like the one below. Works fine from the commandline
using the Jruby binaries, just not when trying to use jruby-complete.jar

java -jar jruby-complete-1.4.0.jar -S rake war

Cannot load gem at
[file:/C:/projects/X/build/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/cache/rails-2.3.5.gem]
in C:/projects/X/SVNROOT/src/rails/App

Nick S. wrote:

This approach will work fine too, it’s just more manual and verbose.
You can look at JRuby’s own build.xml, we currently have a number of
places where we launch JRuby from Ant.

/Nick

On Fri, Jan 29, 2010 at 10:30 AM, Homer S. [email protected]
wrote:

I see what is going on. When I run:

java -jar jruby-complete-1.4.0.jar -S gem env

I see:

  • GEM PATHS:

file:/C:/projects/X/build/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8
- C:/projects/X/SVNROOT/jruby

Warbler is using that first GEM PATH. The second path is what I want
and is what I have the GEM_PATH env set to.

Any idea how to get that first gem path out of there?

Thanks!

Homer S. wrote:

I was close, I just needed to change this line to:

Migrate work great.

Trying to create the war (via warbler) with jruby-complete.jar now. If
I could get that working I’d be in great shape.

Getting an error like the one below. Works fine from the commandline
using the Jruby binaries, just not when trying to use jruby-complete.jar

java -jar jruby-complete-1.4.0.jar -S rake war

Cannot load gem at
[file:/C:/projects/X/build/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/cache/rails-2.3.5.gem]
in C:/projects/X/SVNROOT/src/rails/App

On Fri, Jan 29, 2010 at 2:43 PM, Homer S. [email protected]
wrote:

Warbler is using that first GEM PATH. Â The second path is what I want
and is what I have the GEM_PATH env set to.

Any idea how to get that first gem path out of there?

Ahh interesting. I would guess we’re hardcoding this in the
jruby-complete logic for starting up rubygems inside the jar. Can you
file a bug for it? We should probably first check if there’s an ENV
var for GEM_PATH.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Ah, setting GEM_HOME does the trick :slight_smile:

Ok…if you think there’s a bug or improvement we could make here, do
file a bug. Sounds like you’re ok though.

On Mon, Feb 1, 2010 at 10:25 AM, Homer S. [email protected]
wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs