Class: PostInstallBox
- Inherits:
-
Object
- Object
- PostInstallBox
- Defined in:
- lib/tng/ui/post_install_box.rb
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(version) ⇒ PostInstallBox
constructor
A new instance of PostInstallBox.
- #render ⇒ Object
Constructor Details
#initialize(version) ⇒ PostInstallBox
Returns a new instance of PostInstallBox.
8 9 10 11 12 13 14 15 16 |
# File 'lib/tng/ui/post_install_box.rb', line 8 def initialize(version) @version = version @pastel = Pastel.new @terminal_width = begin TTY::Screen.width rescue StandardError 80 end end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
6 7 8 |
# File 'lib/tng/ui/post_install_box.rb', line 6 def pastel @pastel end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/tng/ui/post_install_box.rb', line 6 def version @version end |
Instance Method Details
#content ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/tng/ui/post_install_box.rb', line 18 def content [ pastel.public_send(Tng::UI::Theme.color(:success)).bold("#{Tng::UI::Theme.icon(:success)} Tng installed successfully!"), "", pastel.public_send(Tng::UI::Theme.color(:warning)).bold("#{Tng::UI::Theme.icon(:config)} SETUP REQUIRED"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "1. Generate configuration:"), pastel.public_send(Tng::UI::Theme.color(:secondary), " rails g tng:install"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "2. Edit configuration file:"), pastel.public_send(Tng::UI::Theme.color(:secondary), " config/initializers/tng.rb"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "3. Add your license key:"), pastel.public_send(Tng::UI::Theme.color(:secondary), " config.api_key = 'your-license-key-here'"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "#{Tng::UI::Theme.icon(:config)} Check documentation for the correct authentication setup"), "", pastel.public_send(Tng::UI::Theme.color(:accent)).bold("#{Tng::UI::Theme.icon(:rocket)} Usage:"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "Interactive mode:"), pastel.public_send(Tng::UI::Theme.color(:success), "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng") + pastel.public_send(Tng::UI::Theme.color(:muted), " - Interactive CLI with method selection"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "Features:"), pastel.public_send(Tng::UI::Theme.color(:success), "#{Tng::UI::Theme.icon(:bullet)} Test 20+ file types: Controllers, Models, Services + Jobs, Helpers, Lib, Policies, Presenters, Mailers, GraphQL, and more"), pastel.public_send(Tng::UI::Theme.color(:success), "#{Tng::UI::Theme.icon(:bullet)} Select specific methods to test"), pastel.public_send(Tng::UI::Theme.color(:success), "#{Tng::UI::Theme.icon(:bullet)} Search and filter through methods"), "", pastel.public_send(Tng::UI::Theme.color(:primary), "Help:"), pastel.public_send(Tng::UI::Theme.color(:success), "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng --help") + pastel.public_send(Tng::UI::Theme.color(:muted), " - Show help information"), "", pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:lightbulb)} Generate tests for individual methods with precision") ].join("\n") end |
#render ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/tng/ui/post_install_box.rb', line 61 def render # Use a reasonable width that won't cause issues box_width = [@terminal_width, 70].min style = Tng::UI::Theme.box_style(:default) TTY::Box.frame( title: { top_left: " TNG ", bottom_right: " v#{@version} " }, style: style[:style], padding: style[:padding], align: :left, width: box_width ) do content end rescue StandardError "TNG v#{@version} installed successfully!\n" + "Run 'rails g tng:install' to get started.\n" + "Use 'bundle exec tng --help' for usage information." end |