Skip to content

Instantly share code, notes, and snippets.

@paukul
Forked from leehambley/gist:502518
Created July 31, 2010 19:42
Show Gist options
  • Save paukul/502534 to your computer and use it in GitHub Desktop.
Save paukul/502534 to your computer and use it in GitHub Desktop.
def all_servers
# go figure...
[:server_1, :server_2, :server_3]
end
def run(stuff)
@active_servers.each {|s| puts "Running #{stuff} on #{s}" }
end
def on(server, &block)
@active_servers = Array(server)
yield
ensure
@active_servers = all_servers
end
on :server1 do
run "cat /dev/rand"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment