More adventures in Ruby. With lots of help from folks on the Ruby Forum and others I got my basic photo renaming, geocoding, and create a jpg for each movie (for import into Aperture Ruby script working.
But I have several file locations and files to select as well as numerous options which requires manually editing the script. This is fine while creating the script, but not good for continued use. So a GUI is needed. My limited experience (OK one program) with AppleScript Xcode sent me down that path. But RubyCocoa isn’t as complete as for AppleScript. Appears I would need some Cocoa which to me looks like another language. Also tempting to wait for Leopard to see if Ruby is better supported. But I want this to work now and when Leopard comes out, I’ll be unable to work on it until next year. Didn’t want to wait six months to pick this back up again.
Then searching on Ruby GUI brought up numerous platform independent GUIs. Since Ruby fits this description I quickly looked at these, both the websites and discussion groups (via Google). On the list in no particular order are Ruby Tk, wxRuby, Qt, FXRuby, Gtk+. The discussion group and blog commented are the usual “best thing since (take your choice” to “who would ever use this app?” and “is this still supported?” I tried to install some of them. Should I use the binary, or Fink, or gem or? You newbies understand the problem.” Confusion. Plus dependencies. And is it getting installed with the 1.8.2 version that comes with Tiger or the 1.8.6 version that I installed How?. Reinstalling dependencies, gems, binaries to try to get errors to please go away, I want to try this solution. Some I could install, some I couldn’t. Some looked like Windows. And none “easy” to use. In the end, since I wanted a Mac usable solution, I abandoned this path.
Back to Mac: Platypus and CocoaDialog came into my consciousness. Took me a bit to figure out all Platypus did was put and application wrapper around the script. Not fair to say “all” as that will prove useful. But I assumed it would do more–my fault not the program. Then CocoaDialog. Produces one line dialog boxes. But I wanted more.
Pashua reappeared via this tutorial for Perl. I had dabbled with this for my AppleScript app years ago. But since XCode handled it well and I wanted to try XCode I didn’t use it. Although seemingly little known, Pashua has been around a while, still being developed, well documented, and the developer responds quickly to queries. And the developer has provided sample Ruby scripts and a file which links Ruby to the Perl program; this was enough to get me to dive in.
What I ended up with:
Trying to keep track of the pieces of Ruby on a Mac.
Version: Tiger has one version installed. Most people recommending upgrading (or installing) 1.8.6
Installation methods. Packages, manually (building, etc via UNIX); and by svn, gem, Fink, ports–these last four need to be installed before they can be used (not sure, maybe ports is part of the Tiger UNIX). Fink and port, both have Mac GUI programs for their use.
Add-ons: Many are part of the base Ruby installation, but need to be “required” and/or “included.” And both required and included, but using different names (e.g., require ‘fileutils’, include FileUtils)
Mac specific add-ons: rb-appscript, RubyOSA, RubyCocoa
RubyCocoa is a bridge between the Ruby and the Objective-C languages, allowing you to manipulate Objective-C objects from Ruby, and vice-versa. RubyCocoa Also allows Ruby scripts to be used in XCode projects. Sansonetti and 5 others
rb-appscript and RubyOSA allow Ruby to use AppleScript (or the underlying technology of AppleScript–OSA)
rb-appscript — Ruby appscript (rb-appscript) is a port of the robust, mature Python appscript (py-appscript) bridge; and seems mature and well supported by Hamish Sanderson (HAS). rb-appscript
RubyOSA — is a bridge from the Ruby language to the Apple Event Manager. The Apple Event Manger allows applications to send and receive messages, or Apple events as they are called, to and from applications that support scripting. (description copied, but I think it functions like rb-appscript). Is RubyOSA going to be installed with Leopard? Laurent Sansonetti is the lead, email@example.com but he’s in Paris LRZ with Mike Naberezny .
No not a new girl friend. For most of you non-geeks out there Ruby is a scripting language and I want to use it for managing some of my photos and GPS data. Ruby is relatively new and has many characteristics of the older and more common Python and Perl. I decided to jump in after getting frustrated with AppleScript which I’ve dabbled for years. Matt Newburg’s switching may have finally pushed me into Ruby.
I started with Pine’s book which is a bit basic for me, but it sucked me in. Then onto Pickaxe (nickname for the “standard” reference book for Ruby), but it’s a bit terse for me. so following recommendations on the web, I got Black’s Ruby for Rails. And the recommendations were right. In spite of the Rails’ focus, the level of description is good for a non-computer expert. But it’s also showed me that I bit off quite a bit.