First material result of running Lift with JRuby

166 views
Skip to first unread message

David Pollak

unread,
Jan 27, 2011, 7:25:47 PM1/27/11
to liftweb, d...@jruby.codehaus.org
Folks,

I spent the afternoon pairing with Aaron Blohowiak on integrating Lift and JRuby.

We've got our first running JRuby app... it's a simple Snippet that is pretty much the hello world in Lift... but it works.

You can grab runnable code from https://github.com/lift/liftjr

Basically, Lift can dispatch snippets to JRuby and take the result from JRuby as a hash that's converted into a CSS Selector Transform (see http://stable.simply.liftweb.net/#sec:CSS-Selector-Transforms )

There's lots more work to be done, but Aaron and I were blown away at the quality and ease of use of the JRuby APIs.  It made our job super-simple.

Thanks,

David


--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

Diego Medina

unread,
Jan 27, 2011, 9:40:41 PM1/27/11
to lif...@googlegroups.com

Great news!!

Diego Medina

> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>

Mads Hartmann Jensen

unread,
Jan 28, 2011, 4:39:59 AM1/28/11
to lif...@googlegroups.com, d...@jruby.codehaus.org
Awesome, 

Congratulations David and Aaron 

Indrajit Raychaudhuri

unread,
Jan 28, 2011, 5:08:29 AM1/28/11
to lif...@googlegroups.com, d...@jruby.codehaus.org
Awesome indeed! So simple, it hurts ;)

- Indrajit

Mads Hartmann Jensen wrote:
> Awesome,
>
> Congratulations David and Aaron
>
> On Jan 28, 2011, at 1:25 AM, David Pollak wrote:
>
>> Folks,
>>
>> I spent the afternoon pairing with Aaron Blohowiak on integrating Lift
>> and JRuby.
>>
>> We've got our first running JRuby app... it's a simple Snippet that is
>> pretty much the hello world in Lift... but it works.
>>
>> You can grab runnable code from https://github.com/lift/liftjr
>>
>> Basically, Lift can dispatch snippets to JRuby and take the result
>> from JRuby as a hash that's converted into a CSS Selector Transform
>> (see http://stable.simply.liftweb.net/#sec:CSS-Selector-Transforms )
>>
>> There's lots more work to be done, but Aaron and I were blown away at
>> the quality and ease of use of the JRuby APIs. It made our job
>> super-simple.
>>
>> Thanks,
>>
>> David
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net

>> <http://liftweb.net/>

>> Blog: http://goodstuff.im <http://goodstuff.im/>


>> Surf the harmonics
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Lift" group.
>> To post to this group, send email to lif...@googlegroups.com

>> <mailto:lif...@googlegroups.com>.


>> To unsubscribe from this group, send email to
>> liftweb+u...@googlegroups.com

>> <mailto:liftweb+u...@googlegroups.com>.

Aaron Blohowiak

unread,
Jan 28, 2011, 2:02:46 PM1/28/11
to Lift
Most of the relevant code is here:
https://github.com/lift/liftjr/blob/master/src/main/scala/code/lib/JRuby.scala
(commit-specific version of that file is here:
https://github.com/lift/liftjr/blob/07a39d24e6b6444c5e76d84302fb3739ba30e856/src/main/scala/code/lib/JRuby.scala
)

A brief overview of what we did:

1) Embed threadsafe JRuby
2) Resolve the class name to JRuby files & classes
3) Instantiate the ruby class and set up the partial function that
will call the appropriate method when needed
4) Use the hashgator ( #> ) on coerced ruby strings to finalize the
conversion of things into the Lift paradigm

Caveats:

1) Your ruby method must currently return a Hash where the keys'
toString will return the css selector and the values' toString will
return the content for substitution.

2) Array values dont yet work like they do in regular lift, we're
working on it.

3) The class name of the ruby file must match the file name, for now.

4) We're using `respond_to?` so method_missing-style method dispatch
won't work.

Lessons learned:

1) I need to learn me some emacs for great goodness. (though my .vimrc
might get jealous.)

2) You'll want to bump your permgen

3) JRuby easily upsets rebel, forcing a restart of the proc

4) Archer is a fantastic dog, yes he is, who's a good dog? That's
right, you are. yes you are... http://archerdog.com/


Let me know if you have any questions about this!

- Aaron


On Jan 27, 4:25 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> Folks,
>
> I spent the afternoon pairing with Aaron Blohowiak on integrating Lift and
> JRuby.
>
> We've got our first running JRuby app... it's a simple Snippet that is
> pretty much the hello world in Lift... but it works.
>
> You can grab runnable code fromhttps://github.com/lift/liftjr
>
> Basically, Lift can dispatch snippets to JRuby and take the result from
> JRuby as a hash that's converted into a CSS Selector Transform (seehttp://stable.simply.liftweb.net/#sec:CSS-Selector-Transforms)
>
> There's lots more work to be done, but Aaron and I were blown away at the
> quality and ease of use of the JRuby APIs.  It made our job super-simple.
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Antonio Salazar Cardozo

unread,
Jan 28, 2011, 2:56:28 PM1/28/11
to lif...@googlegroups.com
This looks awesome!

FWIW, I've been using ensime with vim and liftweb (using this: https://github.com/MarcWeber/ensime and some simple bindings for the vim statusline and a couple of handy keyboard shortcuts I've put up at https://github.com/Shadowfiend/liftweb-vim/ ) and it's been working relatively well.
Antonio
On Jan 27, 4:25 pm, David Pollak <feeder.of...@gmail.com>

Aaron Blohowiak

unread,
Jan 29, 2011, 3:59:12 AM1/29/11
to Lift
very cool! will check this out.

On Jan 28, 11:56 am, Antonio Salazar Cardozo <savedfastc...@gmail.com>
wrote:
> This looks awesome!
>
> FWIW, I've been using ensime with vim and liftweb (using
> this:https://github.com/MarcWeber/ensimeand some simple bindings for the
> vim statusline and a couple of handy keyboard shortcuts I've put up athttps://github.com/Shadowfiend/liftweb-vim/) and it's been working
> relatively well.
> Antonio
>
>
>
>
>
>
>
> On Friday, January 28, 2011 2:02:46 PM UTC-5, Aaron Blohowiak wrote:
>
> > Most of the relevant code is here:
> >https://github.com/lift/liftjr/blob/master/src/main/scala/code/lib/JR...
>
> > (commit-specific<https://github.com/lift/liftjr/blob/master/src/main/scala/code/lib/JR...>version of that file is here:
>
> >https://github.com/lift/liftjr/blob/07a39d24e6b6444c5e76d84302fb3739b...
> > )
>
> > A brief overview of what we did:
>
> >   1) Embed threadsafe JRuby
> >   2) Resolve the class name to JRuby files & classes
> >   3) Instantiate the ruby class and set up the partial function that
> > will call the appropriate method when needed
> >   4) Use the hashgator ( #> ) on coerced ruby strings to finalize the
> > conversion of things into the Lift paradigm
>
> > Caveats:
>
> > 1)  Your ruby method must currently return a Hash where the keys'
> > toString will return the css selector and the values' toString will
> > return the content for substitution.
>
> > 2) Array values dont yet work like they do in regular lift, we're
> > working on it.
>
> > 3) The class name of the ruby file must match the file name, for now.
>
> > 4) We're using `respond_to?` so method_missing-style method dispatch
> > won't work.
>
> > Lessons learned:
>
> > 1) I need to learn me some emacs for great goodness. (though my .vimrc
> > might get jealous.)
>
> > 2) You'll want to bump your permgen
>
> > 3) JRuby easily upsets rebel, forcing a restart of the proc
>
> > 4) Archer is a fantastic dog, yes he is, who's a good dog? That's
> > right, you are. yes you are...http://archerdog.com/
Reply all
Reply to author
Forward
0 new messages