P
Phil Henley
I have a menu driven ruby script to copy some files from servers to
local machines.
I'd like to be able to deploy this to OSX users in as pain-free a way as
possible... preferably they could just double click the script and have
it launch in Terminal and do its thing.
I've tried accomplishing this a few different ways and ran into some
problems. Here's a quick breakdown:
1. Tried associating "Terminal.app" to .rb files via the OSX Get Info
dialog and adding a reference to the ruby shell at the top of the
script. This works, but the script needs to reference its current
location via the Dir.getwd method and this method always returns the
users Home folder (regardless of the scripts actual location) when it is
ran this way.
2. Tried simply renaming the script and giving it the '.command'
extension along with a reference to the ruby shell. This works, but has
the same problem as associating .rb files to Terminal.
3. Tried using script-to-app converters such as Platypus and ScriptGUI.
Platypus doesn't allow me to interact with my scripts menu and ScriptGUI
is returning errors that I could maybe iron out, but it doesn't really
seem worth the battle.
Any ideas how to get around this problem? Seems like I might need to
find a different approach to getting the current working directory. I'd
just prefer not to go mucking around with those parts of the script as
they work fine on Windows and also when ran from Terminals command line
on OSX.
local machines.
I'd like to be able to deploy this to OSX users in as pain-free a way as
possible... preferably they could just double click the script and have
it launch in Terminal and do its thing.
I've tried accomplishing this a few different ways and ran into some
problems. Here's a quick breakdown:
1. Tried associating "Terminal.app" to .rb files via the OSX Get Info
dialog and adding a reference to the ruby shell at the top of the
script. This works, but the script needs to reference its current
location via the Dir.getwd method and this method always returns the
users Home folder (regardless of the scripts actual location) when it is
ran this way.
2. Tried simply renaming the script and giving it the '.command'
extension along with a reference to the ruby shell. This works, but has
the same problem as associating .rb files to Terminal.
3. Tried using script-to-app converters such as Platypus and ScriptGUI.
Platypus doesn't allow me to interact with my scripts menu and ScriptGUI
is returning errors that I could maybe iron out, but it doesn't really
seem worth the battle.
Any ideas how to get around this problem? Seems like I might need to
find a different approach to getting the current working directory. I'd
just prefer not to go mucking around with those parts of the script as
they work fine on Windows and also when ran from Terminals command line
on OSX.