Created
July 11, 2011 15:25
-
-
Save tylerhunt/1076085 to your computer and use it in GitHub Desktop.
Switches Keys for Multiple Heroku Accounts
This file contains 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/ruby | |
require 'fileutils' | |
account = ARGV.first | |
unless account | |
puts "Usage: #{File.basename(__FILE__)} <account>" | |
exit(1) | |
end | |
heroku_path = File.expand_path(File.join('~', '.heroku')) | |
account_path = File.join(heroku_path, 'accounts', account) | |
credentials_path = File.join(heroku_path) | |
if File.directory?(account_path) | |
Dir[File.join(account_path, '*')].each do |file| | |
puts "Copying #{file}" | |
FileUtils.cp(file, credentials_path) | |
end | |
puts "Switched to #{account}." | |
else | |
puts 'Invalid account.' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment