Package Ruby to a standalone Mac OS X application?
I know Python h开发者_C百科as py2app. I was wondering if Ruby has anything like that. I know there is OCRA (One-Click Ruby Application builder) for Windows, but what about for Mac OS X?
Take a look at Platypus; it may do what you want.
From its homepage:
Platypus is a developer tool for the Mac OS X operating system. It can be used to create native, flawlessly integrated Mac OS X applications from interpreted scripts such as shell scripts or Perl and Python programs. This is done by wrapping the script in an application bundle directory structure along with an executable binary that runs the script.
Edit per @XtraSimplicity in a comment: Platypus can't handle any input or output from stdin
or stdout
. That will rule it out in some cases.
MacRuby seems like the most likely candidate without knowing more details about what you're doing. It can make standalone native binaries.
http://www.macruby.org/ for more info.
RubyCocoa includes a script (standaloneify.rb) to package all the Ruby files your project uses into the app wrapper, and MacRuby (recommended if you're targeting 10.5+) compiles to native code and thus it's no more work making a standalone app than with Objective-C.
Compared to Windows, Ruby and Python are prebuilt for Mac OS X, so the easiest way might be using Cocoa with Ruby. You can get good information out of the book Programming Cocoa with Ruby.
精彩评论