Search posterous

Search all posts and users. Type a name, type a favorite song title, whatever! See what comes up.
  

More posterous blogs











More recommended blogs »

Here are posterous posts filed under jruby...

luth3r says...

Checking out JRuby … there were an awful lot of dynamic language presentations at The Strange Loop this past weekend.

Filed under: jruby

abhi says...

It's early in the morning so I thought I'd write some thoughts before I continue on with my day. I've been working on abooklog as a side project to help keep track of reading for school. When deploying it I decided to go with JRuby as I really like its speed as well as its native threaded nature.

When choosing a deployment option mod_passenger does not work as it relies on the native MRI interpreter. So I decided to go with a combination of nginx and the glassfish gem. By using the glassfish gem I can avoid having to use a full blown Java Application Server. So basically deployment is relatively boring in that it's really similar to how you would deploy a mongrel application.

I am using Capistrano to deploy my application so here is the deploy.rb script:

Filed under: jruby

Diego says...

Your life of Ruby + Java is going to be fun and painful. I hope this will get you started quickly so you can move on to the more annoying stuff. (JRuby is still amazing though. JVM is also quite lovely from what I've read.)

Required: Make sure you have a Java VM and Postgresql setup.

Download JRuby 1.3.1. (Archived. Already built.):
http://kenai.com/projects/jruby/pages/Home

Extract the contents.

Go to that folder:
cd jruby-1.3.1

Check everything is ok:
bin/jruby -v

Now do:
bin/jruby -S gem install sequel

Now go to: http://jdbc.postgresql.org/download.html
Download a driver (.jar file) where it says "Current Version."

Remember the location.

Now to test if it works:

# FILE NAME:  quick_start.rb
require 'rubygems'

require '/Path/To/Driver/postgres-..-..jdbc4.jar' # Put the path/filename of the driver you downloaded.

require 'sequel'

host = 'localhost'
db_name = 'my-database' # <=== Change this.
user = 'my-username' # <=== Change this.
pass = 'my-password' # <=== Change this.
DB = Sequel.connect( "jdbc:postgresql://%s/%s?user=%s&password=%s" % [ host, db_name, user, pass] )

my_table = :schema_info # <=== Change this.

puts DB[ my_table ].all.inspect

Now do:
bin/jruby ~/Path/To/quick_start.rb

If it works, you can go and properly install and integrate JRuby into your system: http://kenai.com/projects/jruby/pages/Home
(Go to:  "JRuby Basics" > "Getting Started")
There is also: "JRuby Basics" > "Walkthroughs and Tutorials"

COMMON MISTAKES:

  • The equlivalent of "gem install" is "jruby -S gem" (with a capital 'S')
  • Write a proper Sequel connection string: jdbc:postgresql://HOST/DB?user=USER&password=PASS
    Notice how it differs from other connections strings in regular Ruby + Sequel.
    More info. on Sequel + JRuby + connection strings: http://sequel.rubyforge.org/rdoc/classes/Sequel/JDBC.html
  • An alternative to downloading the .jar/jdbc driver for postgresql is to install the JDBC-Postgresql gem:
    bin/jruby -S gem install jdbc-postgres
    (It uses a slightly older JDBC driver. It's compatiable for Postgresql 8.2).

Eventually, I gave up JRuby for Ruby Enterprise Edition. http://www.rubyenterpriseedition.com/

Filed under: jruby

http://blog.thinkrelevance.com/2008/9/24/java-next-overview

Filed under: jruby

abhi says...

Here is the code for Mephisto to Posterous. Hmm seems all my code on this blog is about Posterous. Need to diversify.

Filed under: jruby