Anyhow, like many of us, Adam seems like he just wants to use Ruby for everything. And when I say everything, I mean EVERYTHING. Writing bash scripts.... sucks. Destroying the sanctity of your Ruby code with
`bash-shell-command /ugly /madness`is not hardly any better. My man is trying to help us do away with all that, by applying a friendly familiar Rubyness, not just caging the ugliness away.
Here is a little taste of Rush, from the Rush site:
How about killing those pesky stray mongrels? Before:
kill `ps aux | grep mongrel_rails | grep -v grep | cut -c 10-20`
After:
processes.each { |p| p.kill if p.command == "mongrel_rails" }
But rush is more than just an interactive shell and a library: it can also control any number of remote machines from a single location. Copy files or directories between servers as seamlessly as if it was all local. bash and ssh, we love you, but your era is past.
Example of remote access:
local = Rush::Box.new('localhost')
remote = Rush::Box.new('my.remote.server.com')
local_dir = local['/Users/adam/myproj/']
remote_dir = remote['/home/myproj/app/']
local_dir.copy_to remote_dir
remote_dir['**/.svn/'].each { |d| d.destroy }
I have not had a chance to play with Rush yet, but I'm sure I will be. Unix shell scripting is not syntactical sugar, that is for sure, and Rush looks pretty sweet.
No comments:
Post a Comment