Distributing Rails applications in an OSX .app container
I want to distribute a Rails application within a .app package, so it can run from 10.4 to 10.6; is there any howto or hint on how to do that? Especially the following things make me twist my head:
I want to repackage the app with Ruby 1.8.6, so it would run even if there is an older version of Ruby installed on the system (such as 1.8.4 in Mac OS X Tiger) - how would I come around the universal binary problems? Can I just add Ruby and use this specific Ruby version to run my app?
IMPLEMENTATION: I want to have a .app that starts thin or mongrel when t开发者_如何学Gohe app is started and stops the app when it is closed. Is there any example OS X XCode project out there (or any other example)?
Is an XCode container the way to go? What are the other options I have?
How about using jRuby for your application, you could then package your whole application as a single .jar file and distribute it that way.
I've been able to run my Ruby on Rails appliations in jRuby without any major modifications to the application besides changing the native MySQL driver with a pure java JDBC implementation.
Also check out this similar question and the Kenai project for more information about jRuby.
The MacRuby people might have some ideas
It seems to be only a matter of time before you will be able to run Rails apps in MacRuby. With v0.5b2 it already supports Sinatra, Racks, RDoc and others. I would go for MacRuby if you can wait (or port your Rails app to Sinatra)
Otherwise I guess you could write a tool in Objective-C that runs an embedded Rails App via some terminal commands. You can find some pointers here.
Have you tried Crate? Actually it's a tool for packaging a generic ruby app, but you might be able to stick a rails app into there. A couple of links:
http://rubyconf2008.confreaks.com/crate-packaging-your-ruby-application.html http://www.copiousfreetime.org/articles/2008/11/30/package-an-application-with-crate.html
精彩评论