Class: CreateGithubRelease::ReleaseAssertions

Inherits:
Object
  • Object
show all
Defined in:
lib/create_github_release/release_assertions.rb

Overview

Assertions that must be true for a new Github release to be created

Examples:

require 'create_github_release'

options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' }
assertions = CreateGithubRelease::ReleaseAssertions.new(options)
assertions.options # => #<CreateGithubRelease::Options:0x00007f9b0a0b0a00>

Constant Summary collapse

ASSERTIONS =

The assertions that must be true for a new Github release to be created

The assertions are run in the order they are defined in this array.

Returns:

  • (Array<Class>)

    The assertions that must be true for a new Github release to be created

[
  CreateGithubRelease::Assertions::GitCommandExists,
  CreateGithubRelease::Assertions::BundleIsUpToDate,
  CreateGithubRelease::Assertions::InGitRepo,
  CreateGithubRelease::Assertions::InRepoRootDirectory,
  CreateGithubRelease::Assertions::OnDefaultBranch,
  CreateGithubRelease::Assertions::NoUncommittedChanges,
  CreateGithubRelease::Assertions::NoStagedChanges,
  CreateGithubRelease::Assertions::LocalAndRemoteOnSameCommit,
  CreateGithubRelease::Assertions::LastReleaseTagExists,
  CreateGithubRelease::Assertions::LocalReleaseTagDoesNotExist,
  CreateGithubRelease::Assertions::RemoteReleaseTagDoesNotExist,
  CreateGithubRelease::Assertions::LocalReleaseBranchDoesNotExist,
  CreateGithubRelease::Assertions::RemoteReleaseBranchDoesNotExist,
  CreateGithubRelease::Assertions::GhCommandExists,
  CreateGithubRelease::Assertions::GhAuthenticated
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ReleaseAssertions

Create a new instance of ReleaseAssertions

Examples:

require 'create_github_release'

options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' }
assertions = CreateGithubRelease::ReleaseAssertions.new(options)
assertions.make_assertions


39
40
41
# File 'lib/create_github_release/release_assertions.rb', line 39

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsCreateGithubRelease::CommandLine::Options (readonly)

The options used in the assertions

Examples:

require 'create_github_release'

options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' }
assertions = CreateGithubRelease::ReleaseAssertions.new(options)
assertions.options # => #<CreateGithubRelease::Options:0x00007f9b0a0b0a00>

Returns:



28
29
30
# File 'lib/create_github_release/release_assertions.rb', line 28

def options
  @options
end

Instance Method Details

#make_assertions

This method returns an undefined value.

Run all assertions

Examples:

require 'create_github_release'

options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' }
assertions = CreateGithubRelease::ReleaseAssertions.new(options)
assertions.make_assertions

Raises:

  • (SystemExit)

    if any assertion fails



80
81
82
83
84
85
# File 'lib/create_github_release/release_assertions.rb', line 80

def make_assertions
  ASSERTIONS.each do |assertion_class|
    # @sg-ignore
    assertion_class.new(options).assert
  end
end