[MacRuby-devel] macruby in automator shell

B. Ohr jazzbox at 7zz.de
Sat Dec 19 04:48:07 PST 2009


Hi, 

sometimes it´s fun „programming“ a workflow or a service with the automator (and some times not).

Because there is no macruby cmd in the shell script section, I wrote this install script:


# file: automator-macruby.rb 
#
# extend the automator shell script configuration 
# by simply copying the ruby configuration to macruby
# (must be executed with sudo)

AUTOMATOR_SHELL_CONFIG = "/System/Library/Automator/Run Shell Script.action/Contents/Resources/Shells.plist"

shell_config = NSDictionary.dictionaryWithContentsOfFile AUTOMATOR_SHELL_CONFIG

raise "automator shell config file: not found" if shell_config.nil?

ruby_path = `which ruby`.strip

ruby_config = shell_config[ruby_path]

raise "ruby configuration: not found" if ruby_config.nil?

macruby_path = `which macruby`.strip

shell_config[macruby_path] = ruby_config 

ok = shell_config.writeToFile(AUTOMATOR_SHELL_CONFIG, atomically:false)

raise "automator shell config file: write error" if ok == 0



More information about the MacRuby-devel mailing list