Class: RooOnRails::Checks::Heroku::AppExists
- Inherits:
-
EnvSpecific
- Object
- Base
- EnvSpecific
- RooOnRails::Checks::Heroku::AppExists
- Defined in:
- lib/roo_on_rails/checks/heroku/app_exists.rb
Overview
Check if a corresponding app exists on Heroku (for a given environment)
Input context
-
git_repo: the name of the repository
-
heroku.api_client: a connected PlatformAPI client
-
app_name_stem (optional): a name override
Output context:
-
heroku.app.EnvSpecific#env: an app name.
Constant Summary collapse
- ACCEPTABLE_ENV_NAMES =
{ 'production' => %w(prd production), 'staging' => %w(stg staging) }.freeze
Instance Attribute Summary
Attributes inherited from EnvSpecific
Instance Method Summary collapse
Methods inherited from EnvSpecific
Methods inherited from Base
Methods included from RooOnRails::Checks::Helpers
Constructor Details
This class inherits a constructor from RooOnRails::Checks::EnvSpecific
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/roo_on_rails/checks/heroku/app_exists.rb', line 29 def call all_apps = client.app.list.map { |a| a['name'] } matches = all_apps.select { |a| candidates.include?(a) } if matches.empty? fail! "no apps with matching names detected" end if matches.many? list = candidates.map { |c| bold c }.join(', ') final_fail! "multiple matching apps detected: #{list}" end context.heroku.app![env] = matches.first pass "found app #{bold matches.first}" end |
#intro ⇒ Object
25 26 27 |
# File 'lib/roo_on_rails/checks/heroku/app_exists.rb', line 25 def intro "Checking if #{bold env} app exist..." end |