Class: Verto::TagCommand

Inherits:
BaseCommand show all
Defined in:
lib/verto/commands/tag_command.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

exit_on_failure?

Instance Method Details

#initObject

Raises:



8
9
10
11
12
13
14
15
# File 'lib/verto/commands/tag_command.rb', line 8

def init
  load_config_hooks!

  error_message = 'This repository already has tags'
  raise Verto::ExitError, error_message if tag_repository.any?

  create_git_tag('0.1.0')
end

#upObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/verto/commands/tag_command.rb', line 27

def up
  load_config_hooks!

  call_hooks(%i[before before_tag_up], with_attributes: { command_options: options })

  validate_version_option_presence!

  latest_tag = tag_repository.latest(filter: load_filter)

  validate_latest_tag!(latest_tag)

  latest_version = SemanticVersion.new(latest_tag)

  new_version = up_version(latest_version, options)

  validate_new_version!(new_version, latest_version)

  call_hooks(:before_tag_creation, with_attributes: { new_version: new_version })

  create_git_tag(new_version)

  call_hooks(:after_tag_up, with_attributes: { new_version: new_version })
  call_hooks(:after)
end