Class: TagChangelog::Generate

Inherits:
Object
  • Object
show all
Defined in:
lib/tag_changelog/generate.rb

Defined Under Namespace

Classes: MessageList

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Generate



8
9
10
11
12
13
14
15
# File 'lib/tag_changelog/generate.rb', line 8

def initialize(options = {})
  @options = options
  @output = open_output_file
  @tags_list = build_tags_list(options)
  @filter = Regexp.new(options[:filter], true)
  @commit_messages_filter = set_commits_filter(options)
  @group = options[:group]
end

Class Method Details

.run(options) ⇒ Object



4
5
6
# File 'lib/tag_changelog/generate.rb', line 4

def self.run(options)
  new(options).run
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/tag_changelog/generate.rb', line 17

def run
  output << "# Changelog\n\n"
  tags_list.each_cons(2) do |current_tag, previous_tag|
    tag = Git::Tag.new(current_tag)
    messages = get_commit_messages(previous_tag, current_tag)
    output << "## #{tag.version}" + " (#{tag.date})\n"
    output << messages.to_text
    output << "\n"
  end
end