I am trying to deploy several ruby scripts in a unix environment. My
goal is to avoid as much as possible any hard-coding of dependencies or
any modifications to scripts to work in the environment and maintain
easy portability to another server unix environment.
Each script will need to load some paths and register an exit routine.
This is what I am thinking of doing right now.
A user will execute the script ./foo or ./bar
Paths specific to this project/deployment should be added, and an exit
routine for this project should be registered.
./foo -> launcher.rb
./bar -> launcher.rb
add paths for this project
ENV[‘PATH’] = …
register exit routine to log script execution
figure out what script called launcher.rb through $0
So the only requirement that I would make of the script is that it have
a main() routine. It even allows the removal of a shebang. Everything
that needs to be hard-coded would be left to the launcher script. This
approach requires a launcher for each language so that only one
interpreter needs to be spawned to execute one script. Initially, all
scripts would be placed in the ./lib directory, and a rake task would
create needed soft links.
Do you think this is a good system? Is there a better way to accomplish