Class: ChangeLogger

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

Instance Method Summary collapse

Constructor Details

#initialize(repo_dir) ⇒ ChangeLogger

Returns a new instance of ChangeLogger.



6
7
8
# File 'lib/changelogger.rb', line 6

def initialize(repo_dir)
  @repo = Grit::Repo.new(repo_dir)
end

Instance Method Details

#changelogObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/changelogger.rb', line 10

def changelog
  tags = @repo.tags

  changelog = ""
  @repo.commits('master', false).each do |commit|
    tag = tags.find { |t| t.commit.id == commit.id }
    changelog += ("\n" + tag.name + "\n") unless tag.nil?
    changelog += CommitFormatter.new(commit).format + "\n" unless CommitFilter.new(commit).filter
  end

  changelog
end