Forum: JRuby Embedding Jruby + Rails + Foreman + GUI on OSX (hard?)

51a397f6562a4410b35c263f6a84415a?d=identicon&s=25 Ruben Fonseca (rubenfonseca)
on 2012-04-19 19:17
(Received via mailing list)
Hello all, first time posting to this list. Thanks or all the amazing
work on JRuby!

I'm trying to solve a problem for a client, and trying to see if jRuby
could be a good alternative.

Basicly, I need to run a self-hosted, single-instance web application
on OSX machines. The client is dumb
and the requirement is that I only have one double-click .app and all
the magick happens:

- the app shows a window with a start / stop / status information
- start and stop manages a foreman (Procfile) instance that starts a
Rails app and other nifty stuff (like some kind of Bonjour service
advertiser)

So my question is: is this feasable with JRuby? I know Rails runs with
no problems on JRuby. I could
possible write some Java stuff to advertise the Bonjour service.

Other than that, I still have to write some UI code (Swing? SWT? what
is used today?) and embed all this stuff into a double-click .app OSX
file, that only requires Java on the system.

I've looked into Warbler and it seems it solves a lot of problemes,
but I ran into problems as soon as
I wanted to integrate it with "foreman" (to use a Procfile and start
various bits of the app).

Any help on this is very much appreciated :) Thanks!
Ruben

--
Will work for bandwidth
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2012-06-09 16:31
It's probably possible, though rails startup time might be a bugger.
Since you're using a .app you can install all sorts of stuff in there.
That being said I've never done it, so don't know how easy/hard it is
right now.  I do intend on writing some "distro helpers" and also some
"UI helpers" to make it easier eventually but until then...rawr might
help, dunno.
974b3d592f78510db0227e528841ccb9?d=identicon&s=25 Robin McKay (robin2)
on 2012-06-20 20:54
Ruben Fonseca wrote in post #1057427:

> Basicly, I need to run a self-hosted, single-instance web application
> on OSX machines. The client is dumb
> and the requirement is that I only have one double-click .app and all
> the magick happens:
>

As far as I can see if you follow these steps
(1) include a copy of JRuby (all the stuff you extract from the .zip
file you download from the JRuby website) in your app
(2) write a short shell script to set add the JRuby/bin directory to
your path and open a terminal
(3) gem install all the necessary gems (which will be stored within the
JRuby directory structure)
(4) write a shell script that sets the path and starts the app (e.g.
jruby myapp.rb or whatever) when the shell script is double clicked.
(5) copy the whole thing to any other PC with the JVM and it works
(there are no external dependencies apart from the JVM)

I have tried this successfully with simple JRuby stuff, a JRuby/Java GUI
app and a simple Rails app on Linux and Windows XP and 7, but I don't
have access to a Mac. I used Mizuno as the web server for the Rails app
- simpler than Trinidad.

By the way this works for me without Warbler or anything like that.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.