From: Nick Date: 2004-12-17T07:48:26+09:00 Subject: Re: Ruby Cocoa (OS X) questions: deployment & interface builder Actually, I've wrapped a number of ruby apps. If done right, ruby apps can look just like Mac OS X applications. The trick is that you need some PPC binary in the Contents/MacOS directory. I wrote a wrapper that links to the ruby static library, figures out where the Resources directory of the bundle is, and then executes "start.rb" in the resources directory. You can download it at: http://www.nicreations.com/boot.cpp To build it, use g++ -c -I -x objective-c++ -framework Cocoa main.cpp g++ -o boot -L -lruby-static -framework Cocoa boot.o An app is just a set of directories: Root.app + Contents Info.plist + MacOS boot (output binary) + Resources Ruby scripts and extensions The first script needs to be named "start.rb". Any extensions need to be put into the Resources directory. For example, I put the wxruby.bundle in the Resources directory, and it allows me to create full GUI apps on the Mac. However, wxruby is a 4 mb library. RubyCocoa uses an external framework and would be better suited for application-wrapping. Finally, you need to create a Info.plist file in the Contents directory. It is a simple XML file OS X uses to get properties about your application. Here is a sample: CFBundleInfoDictionaryVersion 6.0 CFBundleIdentifier org.ruby.your.app.name.here CFBundleDevelopmentRegion English CFBundleExecutable boot CFBundleName Your App Name CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion 1.0 CFBundleShortVersionString 1.0 CFBundleGetInfoString Your App Name (c) 2004 Your Name CFBundleLongVersionString Your App Name (c) 2004 Your Name NSHumanReadableCopyright Copyright 2004 Your Name LSRequiresCarbon CSResourcesFileMapped You should change CFBundleIdentifier, CFBundleName, CFBundleGetInfoString, CFBundleLongVersionString, NSHumanReadableCopyright for your own application. If you take this approach, your ruby app will look and feel exactly like any other Mac application - and no one needs to know that your development time was one tenth everybody elses for using a better language. :-) Nick Michael DeHaan wrote: > Folks, > > I'm interested in Mac/Cocoa development. > > Are there tools available for .app packaging of Ruby/Cocoa apps? > Can this be done w/o reliance on the downlevel Ruby 1.6 included in > Panther? > > Anyhow, any pointers would be greatly appreciated. > > I guess, bottom line, is that i'd like to write applications that > other people can use -- so I'm a bit concerned about deployment > considerations. > > On a somewhat related note, is there a way of using interface files > w/o reliance on XCode and interface builder? I can't see any > documentation to the effect that it is possible, but it must be > possible somehow... Coding in vim is preferable to me than using > XCode, it's yet another interface to deal with and I like my > terminals! :) > > (Yes, I've asked about Ruby/Tk and Tcl/Tk Aqua before -- Tcl/Tk Aqua > does look awesome ... but that's even a greater deployment problem, > IMHO... I was having substantial trouble setting it up even on my box > to work with Ruby per the Ruby Garden article) > > Thanks, > > --Michael DeHaan > > > >