module GitBumper::Git
This module has some functions to deal with a git repository.
Public Instance Methods
create_tag(tag)
click to toggle source
Create a new git tag.
# File lib/git_bumper/git.rb, line 35 def create_tag(tag) `git tag #{tag}` end
greatest_tag(prefix: 'v', klass: Tag)
click to toggle source
Returns the greatest tag.
# File lib/git_bumper/git.rb, line 19 def greatest_tag(prefix: 'v', klass: Tag) output = `git tag --list 2> /dev/null` tags = output .split .map { |t| klass.parse(t) } .select { |t| t && t.prefix == prefix } .sort .reverse tags.find do |tag| tag end || false end
push_tag(tag)
click to toggle source
Pushes a tag to origin.
# File lib/git_bumper/git.rb, line 40 def push_tag(tag) `git push origin #{tag}` end
repo?()
click to toggle source
Returns true if the current working directory has a git repository.
@return [Boolean]
# File lib/git_bumper/git.rb, line 9 def repo? system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') end