class Shivers::Version

Public Class Methods

from_file(path) click to toggle source
# File lib/shivers.rb, line 7
def self.from_file(path)
  git_sha = ENV['GIT_SHA'] || 'LOCAL'
  metadata = "#{git_sha}"

  base_version = File.exist?(path) ?
      File.open(path) { |file| file.read.strip } :
      '0.0.0'

  Version.new("#{base_version}+#{metadata}")
end
new(version_string) click to toggle source
# File lib/shivers.rb, line 18
def initialize(version_string)
  @version = Semantic::Version.new(version_string)
end

Public Instance Methods

to_docker_tag() click to toggle source
# File lib/shivers.rb, line 22
def to_docker_tag
  to_s.gsub(/[\+]/, '_').downcase
end
to_s() click to toggle source
# File lib/shivers.rb, line 26
def to_s
  @version.to_s
end