Sha256: 50e9ce7ca410dd8299a91d8fb1780ce5049f38726162cb8cc0366d3553a71e8a
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true require 'git' module GFSM module Tools class CommitsExtractor CHANGELOG_TRAILER_REGEX = /^(?<name>Changelog):\s*(?<category>.+)$/i def self.extract_commits_with_changelog_trailer(repo_path = ".") repo = Git.open(repo_path) begin last_tag_name = repo.describe(nil, { abbrev: 0 }) rescue last_tag_name = nil end begin commits = last_tag_name ? repo.log.between(last_tag_name, 'head') : repo.log commits.each_with_object([]) do |commit, memo| trailer = commit.message.match(CHANGELOG_TRAILER_REGEX) memo << GFSM::Data::Commit.new(commit, trailer[:name], trailer[:category]) if trailer end rescue [] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gfsm-0.1.2 | lib/tools/commits_extractor.rb |