Class: GemUpdater::ChangelogParser
- Inherits:
-
Object
- Object
- GemUpdater::ChangelogParser
- Defined in:
- lib/gem_updater/changelog_parser.rb,
lib/gem_updater/changelog_parser/github_parser.rb
Overview
ChangelogParser is responsible for parsing a source page where the gem code is hosted.
Defined Under Namespace
Classes: GithubParser
Constant Summary collapse
- MARKUP_FILES =
%w[.md .rdoc .textile].freeze
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#changelog ⇒ String?
Get the changelog in an uri.
-
#initialize(uri:, version:) ⇒ ChangelogParser
constructor
A new instance of ChangelogParser.
Constructor Details
#initialize(uri:, version:) ⇒ ChangelogParser
Returns a new instance of ChangelogParser.
17 18 19 20 |
# File 'lib/gem_updater/changelog_parser.rb', line 17 def initialize(uri:, version:) @uri = uri @version = version end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
13 14 15 |
# File 'lib/gem_updater/changelog_parser.rb', line 13 def uri @uri end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
13 14 15 |
# File 'lib/gem_updater/changelog_parser.rb', line 13 def version @version end |
Instance Method Details
#changelog ⇒ String?
Get the changelog in an uri.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gem_updater/changelog_parser.rb', line 25 def changelog return uri unless changelog_may_contain_anchor? parse_changelog rescue OpenURI::HTTPError # Uri points to nothing log_error_and_return_uri("Cannot find #{uri}") rescue Errno::ETIMEDOUT # timeout log_error_and_return_uri("#{URI.parse(uri).host} is down") rescue ArgumentError => e # x-oauth-basic raises userinfo not supported. [RFC3986] log_error_and_return_uri(e) end |