Skip to content

Instantly share code, notes, and snippets.

@andrewkatz andrewkatz/.zshrc
Created May 6, 2013

What would you like to do?
Simple command for ssh'ing into rails hosts. Thanks to @trobrock for the ruby script.
# Usage:
# rails_ssh release cron
# => ssh
hostname="$(ruby $HOME/Scripts/parse_cap_config.rb $2)"
ssh $username@$hostname
# Example Usage:
# rssh cron
# rssh web1
alias rssh='rails_ssh release'
#!/usr/bin/env ruby
wanting = ARGV[0]
role = wanting.scan(/[a-z]+/).first.to_sym
number = wanting.scan(/\d+/).first.to_i
ROLES = {}
def role(role, *hosts)
hosts.pop if hosts.last.is_a?(Hash)
ROLES[role] = hosts
def method_missing(meth, *args, &block)
load "config/deploy/production.rb"
puts ROLES[role][number-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.