Class: GemChangelogDiff::ChangelogParser
- Inherits:
-
Object
- Object
- GemChangelogDiff::ChangelogParser
- Defined in:
- lib/gem_changelog_diff/changelog_parser.rb
Overview
Parses CHANGELOG.md files from GitHub repos as a fallback source.
Constant Summary collapse
- CONTENTS_URL =
"https://api.github.com/repos/%<repo>s/contents/%<path>s"- FILENAMES =
%w[CHANGELOG.md CHANGES.md History.md NEWS.md].freeze
- VERSION_HEADING =
/^##\s+\[?v?(\d+[^\]\s]+)/
Instance Method Summary collapse
-
#entries_between(repo, current_version, newest_version) ⇒ Array<Hash>
Parses changelog entries between two versions from a repo's changelog file.
-
#initialize(cache: nil) ⇒ ChangelogParser
constructor
A new instance of ChangelogParser.
Constructor Details
#initialize(cache: nil) ⇒ ChangelogParser
Returns a new instance of ChangelogParser.
13 14 15 |
# File 'lib/gem_changelog_diff/changelog_parser.rb', line 13 def initialize(cache: nil) @cache = cache end |
Instance Method Details
#entries_between(repo, current_version, newest_version) ⇒ Array<Hash>
Parses changelog entries between two versions from a repo's changelog file.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gem_changelog_diff/changelog_parser.rb', line 23 def entries_between(repo, current_version, newest_version) content = fetch_changelog(repo) return [] unless content parse_entries(content, current_version, newest_version) rescue SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ETIMEDOUT, Errno::ECONNRESET, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError => e raise NetworkError, "GitHub API request failed: #{e.}" end |