Class: BundleUpdateInteractive::ChangelogLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_update_interactive/changelog_locator.rb

Defined Under Namespace

Classes: GitHubRepo

Constant Summary collapse

GITHUB_PATTERN =
%r{^(?:https?://)?github\.com/([^/]+/[^/]+)(?:\.git)?/?}.freeze
URI_KEYS =
%w[source_code_uri homepage_uri bug_tracker_uri wiki_uri].freeze
FILE_PATTERN =
/changelog|changes|history|news|release/i.freeze
EXT_PATTERN =
/md|txt|rdoc/i.freeze

Instance Method Summary collapse

Instance Method Details

#find_changelog_uri(name:, version: nil) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/bundle_update_interactive/changelog_locator.rb', line 52

def find_changelog_uri(name:, version: nil)
  data = fetch_rubygems_data(name, version)
  return if data.nil?

  if (rubygems_changelog_uri = data["changelog_uri"])
    rubygems_changelog_uri
  elsif (github_repo = GitHubRepo.from_uris(data.values_at(*URI_KEYS)))
    github_repo.discover_changelog_uri(data["version"])
  end
end