Class: Apadmi::Grout::CheckUnfinishedReleasesAction

Inherits:
Object
  • Object
show all
Defined in:
lib/apadmi/grout/actions/check_unfinished_releases_action.rb

Overview

Checks that all releases before this one are ancestors in the commit history to ensure that any unmerged fixes don't get missed

Instance Method Summary collapse

Constructor Details

#initialize(git_utils, logger) ⇒ CheckUnfinishedReleasesAction

Returns a new instance of CheckUnfinishedReleasesAction.

Parameters:



12
13
14
15
# File 'lib/apadmi/grout/actions/check_unfinished_releases_action.rb', line 12

def initialize(git_utils, logger)
  @git_utils = git_utils
  @logger = logger
end

Instance Method Details

#run(current_version, suppress_error_versions) ⇒ Object

Runs the action.

Parameters:

  • current_version (String)

    The version of this release.

  • suppress_error_versions (Array<String>)

    Errors from unmerged versions in this list will be suppressed



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/apadmi/grout/actions/check_unfinished_releases_action.rb', line 20

def run(current_version, suppress_error_versions)
  @git_utils.fetch_all

  @logger.message("Checking for unmerged versions")
  @logger.message("Suppressing checks for versions: #{suppress_error_versions}") if suppress_error_versions
  this_version = Semantic::Version.new current_version
  versions = extract_non_ancestor_versions
  suppressed = suppress_error_versions.map do |version|
    Semantic::Version.new version
  end

  # Only older versions should cause errors since features in newer
  # versions have legitimate reasons not to be in this release
  versions.select do |version|
    version < this_version && !suppressed.include?(version)
  end
end