Class: ChangeLogger
- Inherits:
-
Object
- Object
- ChangeLogger
- Defined in:
- lib/changelogger.rb
Instance Method Summary collapse
- #changelog(options = {}) ⇒ Object
-
#initialize(repo_dir, is_bare = false) ⇒ ChangeLogger
constructor
A new instance of ChangeLogger.
Constructor Details
#initialize(repo_dir, is_bare = false) ⇒ ChangeLogger
Returns a new instance of ChangeLogger.
7 8 9 |
# File 'lib/changelogger.rb', line 7 def initialize(repo_dir, = false) @repo = Grit::Repo.new(repo_dir, :is_bare => ) end |
Instance Method Details
#changelog(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/changelogger.rb', line 11 def changelog( = {}) commit_formatter = [:commit_formatter] || CommitFormatter.new commit_filter = [:commit_filter] || CommitFilter.new header_formatter = [:header_formatter] || HeaderFormatter.new = @repo. changelog = "" changelog += header_formatter.format([:top_version]) unless [:top_version].nil? @repo.commits(@repo.head.name, false).each do |commit| tag = .find { |t| t.commit.id == commit.id } changelog += header_formatter.format(tag.name) unless tag.nil? changelog += commit_formatter.format(commit) + "\n" unless !commit_filter.filter(commit) end changelog end |