Created
May 6, 2013 17:22
-
-
Save andrewkatz/5526552 to your computer and use it in GitHub Desktop.
Simple command for ssh'ing into rails hosts. Thanks to @trobrock for the ruby script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# rails_ssh release cron | |
# => ssh [email protected] | |
rails_ssh() | |
{ | |
username=$1 | |
hostname="$(ruby $HOME/Scripts/parse_cap_config.rb $2)" | |
ssh $username@$hostname | |
} | |
# Example Usage: | |
# rssh cron | |
# rssh web1 | |
alias rssh='rails_ssh release' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
end | |
def method_missing(meth, *args, &block) | |
end | |
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