class Tagistrano::Tag

Public Class Methods

all() click to toggle source
# File lib/tagistrano/tag.rb, line 13
def self.all
  git_tags.split(/\s+/).map { |tag| new(tag) }.sort
end
git_tags() click to toggle source
# File lib/tagistrano/tag.rb, line 17
def self.git_tags
  `git tag`
end
next_tags() click to toggle source
# File lib/tagistrano/tag.rb, line 3
def self.next_tags
  last_tag = all.last

  [
    last_tag.next_major_tag,
    last_tag.next_minor_tag,
    last_tag.next_patch_tag
  ]
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/tagistrano/tag.rb, line 33
def <=>(other)
  version <=> other.version
end
next_major_tag() click to toggle source
# File lib/tagistrano/tag.rb, line 21
def next_major_tag
  [major + 1, 0, 0].join('.')
end
next_minor_tag() click to toggle source
# File lib/tagistrano/tag.rb, line 25
def next_minor_tag
  [major, minor + 1, 0].join('.')
end
next_patch_tag() click to toggle source
# File lib/tagistrano/tag.rb, line 29
def next_patch_tag
  [major, minor, patch + 1].join('.')
end
version() click to toggle source
# File lib/tagistrano/tag.rb, line 37
def version
  [major, minor, patch]
end

Private Instance Methods

major() click to toggle source
# File lib/tagistrano/tag.rb, line 47
def major
  numbers[0].to_i
end
minor() click to toggle source
# File lib/tagistrano/tag.rb, line 51
def minor
  numbers[1].to_i
end
numbers() click to toggle source
# File lib/tagistrano/tag.rb, line 43
def numbers
  split(".")
end
patch() click to toggle source
# File lib/tagistrano/tag.rb, line 55
def patch
  numbers[2].to_i
end