Class: Afterlife::Release::CreateHelper

Inherits:
Helper
  • Object
show all
Defined in:
lib/afterlife/release/create_helper.rb

Constant Summary collapse

DEFAULT_BASE_BRANCH =
'develop'
PARTS =
%i[major minor patch].freeze

Instance Attribute Summary collapse

Attributes inherited from Helper

#cli

Instance Method Summary collapse

Methods inherited from Helper

call, #git

Constructor Details

#initialize(cli, args) ⇒ CreateHelper

Returns a new instance of CreateHelper.



11
12
13
14
15
16
17
18
19
# File 'lib/afterlife/release/create_helper.rb', line 11

def initialize(cli, args)
  super
  @part = args[:part]
  @branch_name = [
    args.fetch(:prefix, 'release'),
    args.fetch(:name, "v#{new_version}"),
  ].join('/')
  @from = args.fetch(:from, DEFAULT_BASE_BRANCH)
end

Instance Attribute Details

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



9
10
11
# File 'lib/afterlife/release/create_helper.rb', line 9

def branch_name
  @branch_name
end

#fromObject (readonly)

Returns the value of attribute from.



9
10
11
# File 'lib/afterlife/release/create_helper.rb', line 9

def from
  @from
end

#partObject (readonly)

Returns the value of attribute part.



9
10
11
# File 'lib/afterlife/release/create_helper.rb', line 9

def part
  @part
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
# File 'lib/afterlife/release/create_helper.rb', line 21

def call
  confirm_creation unless cli.options[:yes]
  make_assertions unless cli.options[:force]
  create_branch
  ChangeVersion.call(new_version)
  commit
end