Class: TagList

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

Overview

Builds a list of tags in the current git repository. The tags are enclosed by the sha1 of the first commit and optionally “HEAD” to allow traversing the list with each_con to obtain start and end points of developmental epochs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(include_head = true) ⇒ TagList

Instantiates the tag list.

Parameters:

  • include_head (bool) (defaults to: true)

    Indicates whether or not to include the most recent changes.



31
32
33
34
# File 'lib/tag_list.rb', line 31

def initialize(include_head = true)
	@include_head = include_head
	@list = build_list
end

Instance Attribute Details

#listObject (readonly)

Returns an array of tag names surrounded by HEAD at the top and the sha1 of the first commit at the bottom.



24
25
26
# File 'lib/tag_list.rb', line 24

def list
  @list
end

Instance Method Details

#latest_tagString

Returns the most recent tag in the git repository, or the sha1 of the initial commit if there is no tag.

Returns:

  • (String)


41
42
43
44
45
# File 'lib/tag_list.rb', line 41

def latest_tag
	# Index 0 is HEAD
	# Index 1 is most recent tag or first commit
	@list[1]
end