Module: HeapScope::Branding

Defined in:
lib/heapscope/branding.rb

Overview

Central brand + funding metadata for CLI, reports, and docs generation.

Constant Summary collapse

NAME =
"HeapScope"
TAGLINE =
"Ruby retention & heap growth diagnostics"
GITHUB_USER =
"theworker02"
GITHUB_REPO =
"https://github.com/theworker02/heapscope"
RUBYGEMS_URL =
"https://rubygems.org/gems/heapscope"
PAGES_URL =
"https://theworker02.github.io/heapscope/"
SPONSORS_URL =
"https://github.com/sponsors/theworker02"
THANKS_DEV_URL =
"https://thanks.dev/u/gh/theworker02"
THANKS_DEV_PATH =
"u/gh/theworker02"
LOGO_SVG =
"assets/logo.svg"
WORDMARK_SVG =
"assets/wordmark.svg"
LOGO_PNG =
"assets/heapscope-logo.png"

Class Method Summary collapse

Class Method Details

.about_textObject



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/heapscope/branding.rb', line 45

def about_text
  lines = []
  lines << compact_banner
  lines << ""
  lines << "RubyGems:   #{RUBYGEMS_URL}"
  lines << "Repository: #{GITHUB_REPO}"
  lines << "Website:    #{PAGES_URL}"
  funding_lines.each { |l| lines << l }
  lines << ""
  lines << "Install: gem install heapscope"
  lines << "Privacy: local-only diagnostics — no telemetry, no object-value dumps by default."
  lines.join("\n")
end

.asset_path(relative) ⇒ Object



73
74
75
# File 'lib/heapscope/branding.rb', line 73

def asset_path(relative)
  File.join(gem_root, relative)
end


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/heapscope/branding.rb', line 21

def banner
  <<~BANNER
    ██╗  ██╗███████╗ █████╗ ██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗
    ██║  ██║██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝██╔═══██╗██╔══██╗██╔════╝
    ███████║█████╗  ███████║██████╔╝███████╗██║     ██║   ██║██████╔╝█████╗
    ██╔══██║██╔══╝  ██╔══██║██╔═══╝ ╚════██║██║     ██║   ██║██╔═══╝ ██╔══╝
    ██║  ██║███████╗██║  ██║██║     ███████║╚██████╗╚██████╔╝██║     ███████╗
    ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═╝     ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝     ╚══════╝
    #{TAGLINE}  v#{VERSION}
  BANNER
end

.compact_bannerObject



33
34
35
# File 'lib/heapscope/branding.rb', line 33

def compact_banner
  "#{NAME} v#{VERSION}#{TAGLINE}"
end

.funding_linesObject



37
38
39
40
41
42
43
# File 'lib/heapscope/branding.rb', line 37

def funding_lines
  [
    "Sponsor: #{SPONSORS_URL}",
    "thanks.dev: #{THANKS_DEV_URL}",
    "Docs site: #{PAGES_URL}"
  ]
end

.gem_rootObject



69
70
71
# File 'lib/heapscope/branding.rb', line 69

def gem_root
  File.expand_path("../..", __dir__)
end


63
64
65
66
67
# File 'lib/heapscope/branding.rb', line 63

def html_footer
  "Generated locally by #{NAME} · no network · no telemetry · " \
    "<a href=\"#{THANKS_DEV_URL}\">thanks.dev</a> · " \
    "<a href=\"#{PAGES_URL}\">docs</a>"
end

.logo_svg_inlineObject



77
78
79
80
81
82
# File 'lib/heapscope/branding.rb', line 77

def logo_svg_inline
  path = asset_path(LOGO_SVG)
  return nil unless File.file?(path)

  File.read(path)
end


59
60
61
# File 'lib/heapscope/branding.rb', line 59

def report_footer
  "Privacy: object values are not serialized by default. · #{THANKS_DEV_URL} · #{PAGES_URL}"
end

.to_hObject



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/heapscope/branding.rb', line 84

def to_h
  {
    name: NAME,
    tagline: TAGLINE,
    version: VERSION,
    github_user: GITHUB_USER,
    github_repo: GITHUB_REPO,
    rubygems_url: RUBYGEMS_URL,
    pages_url: PAGES_URL,
    sponsors_url: SPONSORS_URL,
    thanks_dev_url: THANKS_DEV_URL,
    thanks_dev_path: THANKS_DEV_PATH,
    logo_svg: LOGO_SVG,
    wordmark_svg: WORDMARK_SVG,
    logo_png: LOGO_PNG
  }
end