Sha256: 0694a601014d536a3ce044ea8e3169daab62c19c2c0fefb0d75b3e9c7db9b18a

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

require 'git'
require_relative '../data/version'

module GFSM
  module Tools
    class CurrentVersionLoader
      def self.load_current_version(repo_path = ".")
        last_tag_name = GFSM::Tools::GitUtilities.extract_last_tag_name(
          GFSM::Tools::GitUtilities.load_repo(repo_path)
        )

        return GFSM::Data::Version.new("0.0.0") 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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gfsm-0.3.2 lib/tools/current_version_loader.rb
gfsm-0.3.1 lib/tools/current_version_loader.rb