class Versi::BranchCommand

Public Instance Methods

execute() click to toggle source
# 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

Private Instance Methods

options() click to toggle source
# File lib/versi/branch_command.rb, line 37
def options
  { type: type }
end
validate() click to toggle source
# File lib/versi/branch_command.rb, line 31
def validate
  if !Versi::Util::SemanticReleaseTypes::ALL.include?(options[:type])
    raise "Invalid release type: \"#{options[:type]}\". The valid ones are: #{Versi::Util::SemanticReleaseTypes.pretty_list}"
  end
end