Class: Dependabot::MetadataFinders::Base::ChangelogFinder
- Inherits:
-
Object
- Object
- Dependabot::MetadataFinders::Base::ChangelogFinder
- Defined in:
- lib/dependabot/metadata_finders/base/changelog_finder.rb
Constant Summary collapse
- CHANGELOG_NAMES =
Earlier entries are preferred
%w(changelog history news changes release).freeze
Instance Attribute Summary collapse
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #changelog_text ⇒ Object
- #changelog_url ⇒ Object
-
#initialize(source:, dependency:, credentials:) ⇒ ChangelogFinder
constructor
A new instance of ChangelogFinder.
- #upgrade_guide_text ⇒ Object
- #upgrade_guide_url ⇒ Object
Constructor Details
#initialize(source:, dependency:, credentials:) ⇒ ChangelogFinder
Returns a new instance of ChangelogFinder.
24 25 26 27 28 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 24 def initialize(source:, dependency:, credentials:) @source = source @dependency = dependency @credentials = credentials end |
Instance Attribute Details
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
22 23 24 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22 def credentials @credentials end |
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
22 23 24 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22 def dependency @dependency end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
22 23 24 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 22 def source @source end |
Instance Method Details
#changelog_text ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 34 def changelog_text return unless full_changelog_text pruned_text = ChangelogPruner.new( dependency: dependency, changelog_text: full_changelog_text ).pruned_text return pruned_text unless changelog.name.end_with?(".rst") begin PandocRuby.convert( pruned_text, from: :rst, to: :markdown, wrap: :none ) rescue Errno::ENOENT => error raise unless error. == "No such file or directory - pandoc" # If pandoc isn't installed just return the rst pruned_text end end |
#changelog_url ⇒ Object
30 31 32 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 30 def changelog_url changelog&.html_url end |
#upgrade_guide_text ⇒ Object
63 64 65 66 67 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 63 def upgrade_guide_text return unless upgrade_guide @upgrade_guide_text ||= fetch_file_text(upgrade_guide) end |
#upgrade_guide_url ⇒ Object
59 60 61 |
# File 'lib/dependabot/metadata_finders/base/changelog_finder.rb', line 59 def upgrade_guide_url upgrade_guide&.html_url end |