Module: Kibo::Heroku

Extended by:
Heroku
Included in:
Heroku
Defined in:
lib/kibo/heroku.rb

Overview

It would be great if we could just use Heroku.read_credentials or ‘heroku whoami` to check for a user’s current login. Well, we can’t:

  • since heroku aggressively pushes its heroku toolbelt people might be forced to uninstall the heroku gem.

  • ‘heroku whoami` blocks for input, if the user is not logged in.

Hence this code, which is based on code from the heroku gem.

Copyright and licensing ==================================================

The heroku gem is licensed under the terms of the MIT license, see the file License.MIT.

The heroku gem has been created by Adam Wiggins, and is currently maintained by Wesley Beary.

Instance Method Summary collapse

Instance Method Details

#appsObject

returns names of all apps for the current user on heroku



83
84
85
86
87
88
# File 'lib/kibo/heroku.rb', line 83

def apps
  @apps ||= Kibo::System.heroku("apps", :quiet).
    split(/\n/).
    reject { |line| line.empty? || line =~ /=== / }.
    map { |line| line.split(" ").first }
end

#whoamiObject



22
23
24
# File 'lib/kibo/heroku.rb', line 22

def whoami
  (read_credentials || []).first
end