forked from ddollar/heroku-accounts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
36 lines (29 loc) · 1.08 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "fileutils"
require "ext/heroku/auth"
require "ext/heroku/command/accounts"
require "ext/heroku/command/auth"
Heroku::Command::Help.group("Accounts") do |group|
group.command "accounts", "list accounts"
group.command "accounts:add <name>", "add an account"
group.command "accounts:remove <name>", "remove an account"
group.command "accounts:set <name>", "use in an app directory to set the account for that app"
group.command "accounts:default <name>", "set an account as system-wide default"
end
class Heroku::Command::Base
def git_remotes(base_dir)
remotes = {}
FileUtils.chdir(base_dir) do
remote_names = %x{ git remote }.split("\n").map { |r| r.strip }
remote_names.each do |name|
case %x{ git config remote.#{name}.url }
when /git@#{heroku.host}:([\w\d-]+)\.git/ then remotes[name] = $1
when /git@heroku.[\w\d-]+:([\w\d-]+)\.git/ then remotes[name] = $1
end
end
end
remotes
end
end
if Heroku::VERSION >= "2.0"
Heroku::Command.global_option :account, "--account ACCOUNT"
end