i am trying to find a good scripting language for Mac OS X. I was told
ruby would be a good choice. Before i dedicate my time to learning it I
have to find out a couple of things.
Can you run ruby form the GUI? i.e double click it . I don't want users
to have to go to the terminal.
Yes! It doesn't even have to be limited to OS X either. I'd look into JRuby's Monkeybars library (which includes screencasts): http://monkeybars.rubyforge.org/
You can use a visual designer such as Netbeans to drag and drop buttons onto the form.
Monkeybars uses JRuby (Ruby for Java), and since Java is installed on all Macs, you can just push around your app without having to install any dependencies or making sure you have the right version of the particular scripting language you want to use. JRuby is just a Java library, and you can simply package JRuby along with your app.
Here is an example of what i would like to do. We use a package builder
to customize installs. The only part that it can't do is user related
preferences and library files. Which means we(IT department) have to
copy the files. It is easy to do and it only takes about 3mins. But it
would be nice if i could just double click a script and have it take
5sec. Is this something I can do with ruby?
Yes. With Rawr you simply enter 'rake rawr:bundle:app' at the command line and Rawr will bundle up your application into a standard Mac .app file. I have three Monkeybars apps bundled this way that are sitting on my dock right now.
I am more concerned with running it from a GUI. If I can't do that I
might as well stick to shell scripts because I can call them from apple
script which I can run form the GUI. Plus I already know shell
scripting.
Ruby has methods of making complicated console calls such as system, sh, and the backtick (`). For example:
system "cd foo"
system "rm bar"
sh works in a similar way (I believe there is a difference in console control, and what spawns off as a new process vs. a blocking process. Don't quote me on that).
sh "cd foo"
sh "rm bar"
Ruby also has a backtick, a literal that's just for sending commands:
`cd foo`
`rm bar`
Ruby also has a bunch of file operations inside of File and FileUtils. There's even an Etc object for doing some common operations for things you normally see in the /etc directory.
Myself and a few others are typically hanging out in the #jruby and #monkeybars channel on freenode, and we're always willing to give a hand with these tools. Monkeybars, Rawr, and JRuby all have mailing lists if you'd prefer to contact us that way as well.
···
On Jul 19, 2008, at 7:10 PM, Ott Mr wrote: