Sha256: 7cbc2194cb295e02b9dcbc6bb90b503367a8fb23da54458df5636b4afda199e0
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module CommitFormat class Parser SEPARATOR = "# ------------------------ COMMIT >! ------------------------" def initialize(options) @options = options end def commits log_output = `git log --reverse --pretty="#{SEPARATOR}%n%B" #{arguments(@options)}` log_output .split(SEPARATOR) .map(&:strip) .reject { |commit| commit.length.zero? } end private def arguments(options) args = [] args << "--max-count=#{options[:limit]}" if options.key?(:limit) args << main_argument(options) args.compact.join(" ") end def main_argument(options) return options[:selector] if options.key?(:selector) return if options.key?(:limit) if options.key?(:base_branch) "#{options[:base_branch]}..HEAD" else "#{options[:init_default_branch]}..HEAD" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
commit_format-0.2.1 | lib/commit_format/parser.rb |
commit_format-0.2.0 | lib/commit_format/parser.rb |
commit_format-0.1.0 | lib/commit_format/parser.rb |