Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
Add regex to allow single line versions. (#15)
Browse files Browse the repository at this point in the history
* Add regex to allow single line versions.

Regex matching lines starting with digit, followed by
semver allowed characters only.

Enables use of rST definitions lists for main changelog format.

* Loosened rst-dl regex. Added tests.

* Re-added ``You contribution here!`` bullet point
  • Loading branch information
dotmpe authored and mattbrictson committed Sep 22, 2016
1 parent 189b2a7 commit d8259e1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ chandler is in a pre-1.0 state. This means that its APIs and behavior are subjec
## [Unreleased][]

* Your contribution here!
* Support for reStructuredText `definition-list` style CHANGELOG layouts.

## [0.3.1][] (2016-05-13)

Expand Down
3 changes: 2 additions & 1 deletion lib/chandler/changelog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Changelog
/^==[[:space:]]+.*\n/,
/^===[[:space:]]+.*\n/,
/^\S.*\n=+\n/, # Markdown "Setext" style
/^\S.*\n-+\n/
/^\S.*\n-+\n/,
/^[vr]?[0-9]+\S+[[:space:]]*\n/ # Lines with version string
].freeze

attr_reader :path
Expand Down
11 changes: 11 additions & 0 deletions test/chandler/changelog_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ def test_fetch_realm_cocoa
assert_match("RLMArray has been split into", changelog.fetch("v0.87.0"))
end

def test_fetch_rst_definitions_semver
changelog = new_changelog("rst-definition.md")

assert_match("Added ACME project", changelog.fetch("0.0.1"))
assert_match("Pre-release", changelog.fetch("0.0.2-rc1"))
assert_match("Dev pre-release", changelog.fetch("0.0.2-dev-xyz"))
assert_match("Release", changelog.fetch("0.0.2"))
assert_match("Release 0.1", changelog.fetch("0.1.0"))
assert_match("Update", changelog.fetch("v0.1.1"))
end

def test_fetch_rubocop_versions
changelog = new_changelog("rubocop.md")

Expand Down
18 changes: 18 additions & 0 deletions test/fixtures/changelog/rst-definition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
0.0.1
- Added ACME project.

0.0.2-rc1
- Pre-release.

0.0.2-dev-xyz
- Dev pre-release.

0.0.2
- Release.

0.1.0
- Release 0.1

v0.1.1
- Update.

0 comments on commit d8259e1

Please sign in to comment.