Module: Prick::Git::Tag

Defined in:
lib/prick/local/git.rb

Class Method Summary collapse

Class Method Details

.create(tag, id: nil) ⇒ Object

Create tag



80
81
82
# File 'lib/prick/local/git.rb', line 80

def self.create(tag, id: nil)
  Command.command "git tag '#{tag}' #{id}"
end

.current(id = nil) ⇒ Object

Return the most recent tag before the given commit (defaults to the last commit)



96
97
98
# File 'lib/prick/local/git.rb', line 96

def self.current(id = nil)
  describe_tag(id)&.first
end

.drop(tag) ⇒ Object

Drop a tag



85
86
87
# File 'lib/prick/local/git.rb', line 85

def self.drop(tag)
  Command.command "git tag -d '#{tag}'"
end

.exist?(tag) ⇒ Boolean

True if tag exists

Returns:

  • (Boolean)


75
76
77
# File 'lib/prick/local/git.rb', line 75

def self.exist?(tag)
  tag && Command.command?("git describe --tags #{tag}")
end

.id(tag) ⇒ Object

The associated commit ID of a tag



70
71
72
# File 'lib/prick/local/git.rb', line 70

def self.id(tag)
  tag && Command.command("git rev-list -n 1 #{tag}").first
end

.listObject

Return list of all tags. Not in any particular order



90
91
92
# File 'lib/prick/local/git.rb', line 90

def self.list()
  Command.command("git tag")
end