Skip to content

Commit

Permalink
Merge pull request #103 from dadah89/igor/changelog_message
Browse files Browse the repository at this point in the history
Improve changelog message, mention :editor option
  • Loading branch information
grosser authored Mar 14, 2020
2 parents 833066d + 5881698 commit 5596f55
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ require "bump/tasks"
#
# Maintain changelog:
# Bump.changelog = true
# Opens the changelog in an editor when bumping
# Bump.changelog = :editor
```

rake bump:current # display current version
Expand Down
2 changes: 1 addition & 1 deletion lib/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def bump_set(next_version, options)
def bump_changelog(file, current)
parts = File.read(file).split(/(^##+.*)/) # headlines and their content
prev_index = parts.index { |p| p =~ /(^##+.*(\d+\.\d+\.\d+(\.[a-z]+)?).*)/ } # position of previous version
return "Unable to find previous version" unless prev_index
return "Unable to find previous version in CHANGELOG.md" unless prev_index

# reuse the same style by just swapping the numbers
new_heading = "\n" + parts[prev_index].sub($2, current)
Expand Down
2 changes: 1 addition & 1 deletion spec/bump_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ module Foo
Wut ?
TEXT
f.close
Bump::Bump.send(:bump_changelog, f.path, '1.3.0').should == "Unable to find previous version"
Bump::Bump.send(:bump_changelog, f.path, '1.3.0').should == "Unable to find previous version in CHANGELOG.md"
end
end
end
Expand Down

0 comments on commit 5596f55

Please sign in to comment.