Class: Versi::BranchCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/versi/branch_command.rb,
lib/versi/branch_command/interactors/create_branch.rb,
lib/versi/branch_command/interactors/create_release_branch.rb,
lib/versi/branch_command/interactors/build_release_branch_name.rb

Defined Under Namespace

Classes: Interactors

Instance Method Summary collapse

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/versi/branch_command.rb', line 8

def execute
  validate
  
  context = Versi::GenerateCommand::Interactors::BuildReleaseTag.call(options: options)
  raise context.error if context.error
  release_name = context.release_name
  
  if debug?
    context = Versi::BranchCommand::Interactors::BuildReleaseBranchName \
                .call(options: options, release_name: release_name)
    Versi::LOG.info("No branch will be created, because we are in debug mode")
  else
    context = Versi::BranchCommand::Interactors::CreateBranch \
                .call(options: options, release_name: release_name)
  end
  
  if context.error
    raise context.error
  end
end