Class: GemMaintainer::ChangelogRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_maintainer/changelog_renderer.rb

Overview

Fetches a changelog file and extracts the section for a given version, then renders it to the terminal.

Constant Summary collapse

MAX_LINES =

Number of lines to show before truncating

30

Instance Method Summary collapse

Instance Method Details

#render(version, url, pastel) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gem_maintainer/changelog_renderer.rb', line 13

def render(version, url, pastel)
  return unless url

  content = if url.start_with?("file://")
    fetch_local(url)
  elsif url.start_with?("https://github.com")
    fetch_raw(url)
  end

  return unless content

  section = extract_section(content, version)
  return unless section

  print_section(section, pastel)
end