Class: Clacky::Banner
- Inherits:
-
Object
- Object
- Clacky::Banner
- 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
-
#cli_logo ⇒ Object
Returns the CLI logo text.
-
#colored_cli_logo ⇒ Object
Renders the CLI logo as colored text.
-
#colored_tagline ⇒ Object
Renders the tagline as colored text.
-
#highlight(url) ⇒ Object
Renders a URL with bold + underline for emphasis.
-
#initialize ⇒ Banner
constructor
A new instance of Banner.
-
#tagline ⇒ Object
Returns the tagline string.
Constructor Details
#initialize ⇒ Banner
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_logo ⇒ Object
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 cli_logo 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_logo ⇒ Object
Renders the CLI logo as colored text
51 52 53 |
# File 'lib/clacky/banner.rb', line 51 def colored_cli_logo @pastel.bright_green(cli_logo) end |
#colored_tagline ⇒ Object
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 |
#tagline ⇒ Object
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 |