Class: RungerReleaseAssistant

Inherits:
Object
  • Object
show all
Includes:
MemoWise
Defined in:
lib/runger_release_assistant.rb,
lib/runger_release_assistant.rb,
lib/runger_release_assistant/version.rb

Overview

rubocop:disable Style/StaticClass

Defined Under Namespace

Classes: ConfigFileReader, UnknownPrimaryBranch, VersionCalculator

Constant Summary collapse

CHANGELOG_FILE_NAME =
'CHANGELOG.md'
DEFAULT_OPTIONS =
{ rubygems: false }.freeze
VERSION =
'4.3.1'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli_options = {}) ⇒ RungerReleaseAssistant

Returns a new instance of RungerReleaseAssistant.



57
58
59
60
61
62
63
64
65
66
# File 'lib/runger_release_assistant.rb', line 57

def initialize(cli_options = {})
  config_file_options = RungerReleaseAssistant::ConfigFileReader.new.options_hash

  @options =
    DEFAULT_OPTIONS.
      merge(config_file_options).
      merge(cli_options)

  logger.debug("Running release with options #{@options}")
end

Class Method Details

.define_slop_options(options) ⇒ Object



50
51
52
53
54
# File 'lib/runger_release_assistant.rb', line 50

def define_slop_options(options)
  options.string('-t', '--type', 'Release type (major, minor, or patch)', default: 'patch')
  options.bool('-d', '--debug', 'print debugging info', default: false)
  options.bool('-s', '--show-system-output', 'show system output', default: false)
end

Instance Method Details

#run_releaseObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/runger_release_assistant.rb', line 79

def run_release
  verify_on_main_branch
  verify_repository_cleanliness
  verify_changelog_present

  print_release_info
  confirm_release_looks_good

  update_changelog_for_release
  update_version_file(next_version)
  bundle_install
  commit_changes(message: "Prepare to release v#{next_version}")
  create_tag
  push_to_rubygems_and_or_git
rescue => error
  logger.error(<<~ERROR_LOG)
    \n
    #{error.class.name.red}: #{error.message.red}
    #{error.backtrace.join("\n")}
  ERROR_LOG
  restore_and_abort(exit_code: 1)
else
  run_post_release_command
end

#tag_prefixObject



104
105
106
# File 'lib/runger_release_assistant.rb', line 104

def tag_prefix
  @options[:tag_prefix]
end