Class: Clacky::Banner

Inherits:
Object
  • Object
show all
Defined in:
lib/clacky/banner.rb

Overview

Banner provides logo and branding for CLI and Web UI startup. Lightweight — no terminal UI dependencies.

Constant Summary collapse

DEFAULT_CLI_LOGO =
<<~'LOGO'
   ██████╗ ██████╗ ███████╗███╗   ██╗ ██████╗██╗      █████╗  ██████╗██╗  ██╗██╗   ██╗
  ██╔═══██╗██╔══██╗██╔════╝████╗  ██║██╔════╝██║     ██╔══██╗██╔════╝██║ ██╔╝╚██╗ ██╔╝
  ██║   ██║██████╔╝█████╗  ██╔██╗ ██║██║     ██║     ███████║██║     █████╔╝  ╚████╔╝
  ██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║██║     ██║     ██╔══██║██║     ██╔═██╗   ╚██╔╝
  ╚██████╔╝██║     ███████╗██║ ╚████║╚██████╗███████╗██║  ██║╚██████╗██║  ██╗   ██║
   ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝   ╚═╝
LOGO
TAGLINE =
"[>] Your personal Assistant & Technical Co-founder"

Instance Method Summary collapse

Constructor Details

#initializeBanner

Returns a new instance of Banner.



23
24
25
26
# File 'lib/clacky/banner.rb', line 23

def initialize
  @pastel = Pastel.new
  @brand  = BrandConfig.load
end

Instance Method Details

#cli_logoObject

Returns the CLI logo text. If branded, renders package_name using BlockFont (big Unicode art). Falls back to default OPENCLACKY logo when not branded.



31
32
33
34
35
36
37
38
39
# File 'lib/clacky/banner.rb', line 31

def 
  if @brand.branded?
    render_key = @brand.package_name.to_s.strip
    render_key = "clacky" if render_key.empty?
    Clacky::BlockFont.render(render_key)
  else
    DEFAULT_CLI_LOGO
  end
end

#colored_cli_logoObject

Renders the CLI logo as colored text



51
52
53
# File 'lib/clacky/banner.rb', line 51

def 
  @pastel.bright_green()
end

#colored_taglineObject

Renders the tagline as colored text



56
57
58
# File 'lib/clacky/banner.rb', line 56

def colored_tagline
  @pastel.bright_cyan(tagline)
end

#highlight(url) ⇒ Object

Renders a URL with bold + underline for emphasis



61
62
63
# File 'lib/clacky/banner.rb', line 61

def highlight(url)
  @pastel.bold.underline(url)
end

#taglineObject

Returns the tagline string.



42
43
44
45
46
47
48
# File 'lib/clacky/banner.rb', line 42

def tagline
  if @brand.branded?
    @brand.product_name.to_s
  else
    TAGLINE
  end
end