Class: HtmlMockup::Release::Scm::Git

Inherits:
Base
  • Object
show all
Defined in:
lib/html_mockup/release/scm/git.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Git

Returns a new instance of Git.

Parameters:

  • config (Hash) (defaults to: {})

    a customizable set of options

Options Hash (config):

  • :ref (String)

    Ref to use for current tag

  • :path (String, Pathname)

    Path to working dir



8
9
10
11
# File 'lib/html_mockup/release/scm/git.rb', line 8

def initialize(config={})
  super(config)
  @config[:ref] ||= "HEAD"
end

Instance Method Details

#dateObject

Date will be Time.now if it can’t be determined from GIT repository



23
24
25
26
# File 'lib/html_mockup/release/scm/git.rb', line 23

def date
  get_scm_data if @_date.nil?
  @_date
end

#previousObject



28
29
30
# File 'lib/html_mockup/release/scm/git.rb', line 28

def previous
  self.class.new(@config.dup.update(:ref => get_previous_tag_name))
end

#versionObject

Version is either:

  • the tagged version number (first “v” will be stripped) or

  • the return value of “git describe –tags HEAD”

  • the short SHA1 if there hasn’t been a previous tag



17
18
19
20
# File 'lib/html_mockup/release/scm/git.rb', line 17

def version
  get_scm_data if @_version.nil?
  @_version
end