Created
April 22, 2014 21:35
-
-
Save quinn/11195235 to your computer and use it in GitHub Desktop.
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
def extract_app_in_dir(dir) | |
return unless remotes = git_remotes(dir) | |
current_app = false | |
begin | |
current_app = File.read(FileUtils.pwd + '/.current-heroku-app').chomp | |
rescue Errno::ENOENT | |
end | |
if remote = options[:remote] | |
remotes[remote] | |
elsif remote = extract_app_from_git_config | |
remotes[remote] | |
else | |
apps = remotes.values.uniq | |
if apps.size == 1 | |
apps.first | |
elsif current_app && apps.include?(current_app) | |
current_app | |
else | |
raise(Heroku::Command::CommandFailed, "Multiple apps in folder and no app specified.\nSpecify app with --app APP.") unless options[:ignore_no_app] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment