Class: GFSM::Tools::CurrentVersionLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/tools/current_version_loader.rb

Class Method Summary collapse

Class Method Details

.load_current_version(repo, initial_version) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tools/current_version_loader.rb', line 9

def self.load_current_version(repo, initial_version)
  last_tag_name = GFSM::Tools::GitUtilities.extract_last_tag_name(repo)

  return GFSM::Data::Version.new(initial_version) unless last_tag_name

  if last_tag_name.downcase.start_with?("v") 
    last_tag_name.slice!(0)
  end

  GFSM::Data::Version.new(last_tag_name)
end