Class: KapostDeploy::Heroku::AppReleases

Inherits:
Object
  • Object
show all
Defined in:
lib/kapost_deploy/heroku/app_releases.rb

Overview

Promotes a heroku app via Heroku Plaform API

Instance Method Summary collapse

Constructor Details

#initialize(app, token:) ⇒ AppReleases

Returns a new instance of AppReleases.



9
10
11
12
# File 'lib/kapost_deploy/heroku/app_releases.rb', line 9

def initialize(app, token:)
  self.app = app
  self.token = token
end

Instance Method Details

#latest_deploy_versionObject



14
15
16
17
18
19
20
21
# File 'lib/kapost_deploy/heroku/app_releases.rb', line 14

def latest_deploy_version
  # This appears to be conventional for pipelines and standard heroku deploys and not a
  # good way to get the deployed git version.
  list.each do |item|
    return Regexp.last_match[:sha1] if item["description"] =~ /^Deploy (?<sha1>[a-f0-9]+)$/
  end
  nil
end

#listObject



23
24
25
# File 'lib/kapost_deploy/heroku/app_releases.rb', line 23

def list
  heroku.release.list(app)
end