Class: Changelog::Notifier::GitTagFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/changelog/notifier/git_tag_fetcher.rb

Overview

Fetches a Git tag from the current commit being a version.

Class Method Summary collapse

Class Method Details

.fetch(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/changelog/notifier/git_tag_fetcher.rb', line 9

def self.fetch(options = {})
  output = options[:capistrano].capture(
    "git --git-dir #{options[:path] || '.git'} tag --contains HEAD"
  )

  return nil if output.empty?

  output.split("\n").detect { |tag| tag =~ /[\d\.]+/ }
end