git_game_show 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2e16a5db208a5da525ed9c104ff9ca6a04b3ee1277c0463b1d6a4ae92e358a5
4
- data.tar.gz: 17400bb69a005c1f30fee70e33eeff6937bc29237b745f12368e54863ebc3ef7
3
+ metadata.gz: 0f8afebed41ed43c7d886a48c4de43fb6243d29a7b7e8be0655d4e5b1676208d
4
+ data.tar.gz: 7fdc45f5fe5526980daf719a228edfb058aa5648db0120902835036c383e7352
5
5
  SHA512:
6
- metadata.gz: 76b2747d64550026843890bd0ac940a9808e77d60dfe33cd9c521f65aad826bbdd57cfa530f309318912a21e0b246d4c062935483ff3e1036a74c5f4bf1f7cb8
7
- data.tar.gz: 12a34d4b1371eb806af69ce0c2feb6e7135ae66aa7b275c1d0f730eb74c6310c03446a095bdcb0facf32efd661ca414ab80c7f6883385b59f68d2befd1512376
6
+ metadata.gz: 620bc18628354eb9b5910a6cf87eb8d998c82b8325d05fd64ebabfc752e8fa9b8897c32ead3823b41fda8c3f7c0d84d9633eae458345eb0a3581664a2d6e1aed
7
+ data.tar.gz: dd3c6f2276b3780fcdc9a228d9a7b51979ede0bc4b5dbaa851949727b184c2ea139a2cca11f46e70394bd6da141f552a642beaecf1f38cbeb8a978d682938f6f
@@ -20,7 +20,7 @@ module GitGameShow
20
20
  GitGameShow::Updater.check_for_updates if defined?(GitGameShow::Updater)
21
21
 
22
22
  prompt = TTY::Prompt.new
23
- choice = prompt.select("What would you like to do?", [
23
+ choice = prompt.select("", [
24
24
  {name: "Host a new game", value: :host},
25
25
  {name: "Join a game", value: :join},
26
26
  {name: "Check for updates", value: :update},
@@ -105,20 +105,20 @@ module GitGameShow
105
105
  # Ask user which IP to use
106
106
  prompt = TTY::Prompt.new
107
107
  ip_choices = []
108
- ip_choices << {name: "Local network only (#{local_ip})", value: {:type => :local, :ip => local_ip}} if !local_ip.empty?
109
- ip_choices << {name: "Internet - External IP (#{external_ip}) - requires port forwarding", value: {:type => :external, :ip => external_ip}} if external_ip
110
- ip_choices << {name: "Internet - Automatic tunneling with ngrok (requires free account)", value: {:type => :tunnel}}
108
+ ip_choices << {name: "Local IP (#{local_ip})", value: {:type => :local, :ip => local_ip}} if !local_ip.empty?
109
+ ip_choices << {name: "External IP (#{external_ip})", value: {:type => :external, :ip => external_ip}} if external_ip
110
+ ip_choices << {name: "Automatic tunneling", value: {:type => :tunnel}}
111
111
  ip_choices << {name: "Custom IP or hostname", value: {:type => :custom}}
112
112
 
113
113
  # Format question with explanation
114
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
115
- puts " NETWORK SETUP ┃"
116
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
117
- puts " Local IP: Only for players on the same network ┃"
118
- puts "External IP: For internet players (requires router port forwarding) ┃"
119
- puts " • Automatic tunneling: Uses ngrok (requires free account & authorization) ┃"
120
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
121
- puts ""
114
+ display_info_box(:info, "Network Setup", [
115
+ " Local IP: Only for players on the same network",
116
+ " • External IP: For internet players",
117
+ " - requires router port forwarding",
118
+ " Automatic tunneling: For internet players",
119
+ " - requires free account & authorization through ngrok",
120
+ " • Custom IP: For advanced users with specific network setup"
121
+ ])
122
122
 
123
123
  ip_choice = prompt.select("How should players connect to your game?", ip_choices)
124
124
 
@@ -132,13 +132,15 @@ module GitGameShow
132
132
  when :tunnel
133
133
  # Clear the screen and show informative message about ngrok
134
134
  display_ggs
135
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
136
- puts " NGROK TUNNEL SETUP ┃"
137
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
138
- puts "┃ The automatic tunneling option uses ngrok, a secure tunneling service. ┃"
139
- puts " This will allow players to connect from anywhere without port forwarding. ┃"
140
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
141
- puts ""
135
+ display_info_box(:info, "Ngrok Tunnel Setup", [
136
+ " The automatic tunneling option uses ngrok, a secure tunneling service.",
137
+ " This will allow players to connect from anywhere without port forwarding.",
138
+ " ",
139
+ " If you do not already have ngrok set up:",
140
+ " • The ngrok client will be downloaded and started automatically",
141
+ " • Instructions will be provided to set up a required free account on ngrok",
142
+ " • The tunnel will be established and the game will start"
143
+ ])
142
144
 
143
145
  # Check if ngrok is available
144
146
  begin
@@ -269,17 +271,15 @@ module GitGameShow
269
271
 
270
272
  if auth_needed
271
273
  display_ggs
272
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
273
- puts " NGROK AUTHORIZATION REQUIRED ┃"
274
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
275
- puts "┃ Starting with ngrok v3, you need to create a free account and authorize ┃"
276
- puts " to use TCP tunnels. This is a one-time setup. ┃"
277
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
278
- puts ""
279
- puts "Steps to authorize ngrok:"
280
- puts " 1. Create a free account at https://ngrok.com/signup"
281
- puts " 2. Get your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken"
282
- puts " 3. Enter your authtoken below"
274
+ display_info_box(:info, 'Ngrok Authorization Required', [
275
+ " Starting with ngrok v3, you need to create a free account and authorize ",
276
+ " to use TCP tunnels. This is a one-time setup. ",
277
+ " ",
278
+ " Steps to authorize ngrok: ",
279
+ " 1. Create a free account at https://ngrok.com/signup ",
280
+ " 2. Get an authtoken https://dashboard.ngrok.com/get-started/your-authtoken ",
281
+ " 3. Enter your authtoken below "
282
+ ])
283
283
  puts ""
284
284
 
285
285
  prompt = TTY::Prompt.new
@@ -364,21 +364,20 @@ module GitGameShow
364
364
 
365
365
  display_ggs
366
366
 
367
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
368
- puts "┃ TUNNEL ESTABLISHED SUCCESSFULLY! ┃"
369
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
370
- puts " Your game is now accessible over the internet ┃"
371
- puts "┃ • The ngrok tunnel is running in the background: ┃"
372
- puts "┃ ┃"
373
- puts " ngrok ip: #{ip.ljust(57)}"
374
- puts " ngrok port: #{external_port.to_s.ljust(57)}"
375
- puts "┃ ngrok public URL: #{public_url.ljust(57)}┃"
376
- puts "┃ ┃"
377
- puts " DO NOT close the terminal window until your game is finished ┃"
378
- puts "┃ • The tunnel will automatically close when you exit the game ┃"
379
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
380
- puts ""
381
- puts "Public URL: #{public_url}"
367
+ # We need to handle the colorized content within the green box
368
+ content = [
369
+ " Your game is now accessible over the internet",
370
+ " The ngrok tunnel is running in the background:",
371
+ " ",
372
+ " ngrok ip: #{ip.ljust(57)}".colorize(:light_blue),
373
+ " ngrok port: #{external_port.to_s.ljust(57)}".colorize(:light_blue),
374
+ " ngrok public URL: #{public_url.ljust(57)}".colorize(:light_blue),
375
+ " ",
376
+ " DO NOT close the terminal window until your game is finished",
377
+ " The tunnel will automatically close when you exit the game"
378
+ ]
379
+
380
+ display_info_box(:success, 'Ngrok tunnel established successfully!', content)
382
381
  puts ""
383
382
  puts "Press Enter to continue..."
384
383
  gets
@@ -392,20 +391,17 @@ module GitGameShow
392
391
 
393
392
  unless tunnel_url
394
393
  display_ggs
395
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
396
- puts " TUNNEL SETUP FAILED ┃"
397
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
398
- puts " ngrok tunnel could not be established ┃"
399
- puts "┃ • Most common reason: Missing or invalid ngrok authentication token ┃"
400
- puts " Falling back to local IP (players will only be able to join locally) ┃"
401
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
402
- puts ""
403
- puts "Common solutions:"
404
- puts " 1. Create a free account at https://ngrok.com/signup"
405
- puts " 2. Get your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken"
406
- puts " 3. Run this command: ngrok config add-authtoken <YOUR_TOKEN>"
407
- puts " 4. Then restart the game and try tunneling again"
408
- puts ""
394
+ display_info_box(:error, 'Tunnel setup failed!', [
395
+ " ngrok tunnel could not be established",
396
+ " Most common reason: Missing or invalid ngrok authentication token",
397
+ " Falling back to local IP (players will only be able to join locally)",
398
+ " ",
399
+ " Common solutions:",
400
+ " 1. Create a free account at https://ngrok.com/signup",
401
+ " 2. Get an authtoken https://dashboard.ngrok.com/get-started/your-authtoken",
402
+ " 3. Run this command: ngrok config add-authtoken <YOUR_TOKEN>",
403
+ " 4. Then restart the game and try tunneling again"
404
+ ])
409
405
  puts "Press Enter to continue with local IP..."
410
406
  gets
411
407
 
@@ -413,14 +409,11 @@ module GitGameShow
413
409
  end
414
410
  rescue => e
415
411
  display_ggs
416
- puts "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
417
- puts " ERROR SETTING UP NGROK TUNNEL ┃"
418
- puts "┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫"
419
- puts " An error occurred while trying to set up the ngrok tunnel ┃"
420
- puts "┃ • This is likely an authentication issue with ngrok ┃"
421
- puts "┃ • Falling back to local IP (players will only be able to join locally) ┃"
422
- puts "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
423
- puts ""
412
+ display_info_box(:error, 'Error setting up ngrok tunnel!', [
413
+ " An error occurred while trying to set up the ngrok tunnel",
414
+ " This is likely an authentication issue with ngrok",
415
+ " Falling back to local IP (players will only be able to join locally)"
416
+ ])
424
417
  puts "Error details: #{e.message}"
425
418
  puts ""
426
419
  puts "Press Enter to continue with local IP..."
@@ -525,31 +518,34 @@ module GitGameShow
525
518
  "╚██████╔╝".colorize(:red) + " ╚██████╔╝".colorize(:green) + " ██████╔╝".colorize(:blue),
526
519
  " ╚═════╝ ".colorize(:red) + " ╚═════╝ ".colorize(:green) + " ╚═════╝ ".colorize(:blue),
527
520
  ]
528
- lines.each { |line| puts line }
521
+ lines.each { |line| puts line.center(120) }
529
522
  end
530
523
 
531
524
  def display_game_logo
532
525
  clear_screen
533
- puts " ██████╗ ██╗████████╗".colorize(:red) + " ██████╗ █████╗ ███╗ ███╗███████╗".colorize(:green)
534
- puts "██╔════╝ ██║╚══██╔══╝".colorize(:red) + " ██╔════╝ ██╔══██╗████╗ ████║██╔════╝".colorize(:green)
535
- puts "██║ ███╗██║ ██║ ".colorize(:red) + " ██║ ███╗███████║██╔████╔██║█████╗ ".colorize(:green)
536
- puts "██║ ██║██║ ██║ ".colorize(:red) + " ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ".colorize(:green)
537
- puts "╚██████╔╝██║ ██║ ".colorize(:red) + " ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗".colorize(:green)
538
- puts " ╚═════╝ ╚═╝ ╚═╝ ".colorize(:red) + " ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝".colorize(:green)
539
-
540
- puts " █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗".colorize(:blue)
541
- puts "██╔═══╝ ██║ ██║██╔═══██╗██║ ██║".colorize(:blue)
542
- puts "███████╗███████║██║ ██║██║ █╗ ██║".colorize(:blue)
543
- puts "╚════██║██╔══██║██║ ██║██║███╗██║".colorize(:blue)
544
- puts "██████╔╝██║ ██║╚██████╔╝╚███╔███╔╝".colorize(:blue)
545
- puts "╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ".colorize(:blue)
526
+ puts (" ██████╗ ██╗████████╗".colorize(:red) + " ██████╗ █████╗ ███╗ ███╗███████╗".colorize(:green)).center(110)
527
+ puts ("██╔════╝ ██║╚══██╔══╝".colorize(:red) + " ██╔════╝ ██╔══██╗████╗ ████║██╔════╝".colorize(:green)).center(110)
528
+ puts ("██║ ███╗██║ ██║ ".colorize(:red) + " ██║ ███╗███████║██╔████╔██║█████╗ ".colorize(:green)).center(110)
529
+ puts ("██║ ██║██║ ██║ ".colorize(:red) + " ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ".colorize(:green)).center(110)
530
+ puts ("╚██████╔╝██║ ██║ ".colorize(:red) + " ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗".colorize(:green)).center(110)
531
+ puts (" ╚═════╝ ╚═╝ ╚═╝ ".colorize(:red) + " ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝".colorize(:green)).center(110)
532
+
533
+ puts (" █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗".colorize(:blue)).center(95)
534
+ puts ("██╔═══╝ ██║ ██║██╔═══██╗██║ ██║".colorize(:blue)).center(95)
535
+ puts ("███████╗███████║██║ ██║██║ █╗ ██║".colorize(:blue)).center(95)
536
+ puts ("╚════██║██╔══██║██║ ██║██║███╗██║".colorize(:blue)).center(95)
537
+ puts ("██████╔╝██║ ██║╚██████╔╝╚███╔███╔╝".colorize(:blue)).center(95)
538
+ puts ("╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ".colorize(:blue)).center(95)
546
539
  end
547
540
 
548
541
  def display_welcome_screen
549
542
  display_game_logo
550
-
551
- puts "\nWelcome to Git Game Show version #{GitGameShow::VERSION}!".colorize(:light_blue)
552
- puts "Test your team's Git knowledge with fun trivia games.\n\n"
543
+ puts ""
544
+ display_info_box(:info, "Welcome to Git Game Show! version " + GitGameShow::VERSION, [
545
+ " Test your team's knowledge with fun mini games based on git commit history.",
546
+ "",
547
+ " Choose to host a new game or join an existing one."
548
+ ])
553
549
  end
554
550
 
555
551
  def prompt_for_host_options
@@ -593,5 +589,41 @@ module GitGameShow
593
589
 
594
590
  "#{adjectives.sample}-#{nouns.sample}-#{rand(100..999)}"
595
591
  end
592
+
593
+ def display_info_box(kind, heading, content, width = 80)
594
+ # Set color based on the kind of box
595
+ color = case kind.to_sym
596
+ when :info
597
+ :light_blue
598
+ when :success
599
+ :green
600
+ when :error
601
+ :red
602
+ else
603
+ :light_blue
604
+ end
605
+
606
+ # Calculate border width - using 78 as in existing boxes
607
+ content_width = width - 2
608
+
609
+ # Create the box with borders and heading in the specified color
610
+ puts ("╭" + "─" * content_width + "╮").colorize(color)
611
+ puts "│#{heading.center(content_width)}│".colorize(color)
612
+ puts ("├" + "─" * content_width + "┤").colorize(color)
613
+
614
+ # Split content by lines and format each line
615
+ if content.is_a?(String)
616
+ content.each_line do |line|
617
+ puts "│".colorize(color) + "#{line.chomp}".ljust(content_width) + "│".colorize(color)
618
+ end
619
+ elsif content.is_a?(Array)
620
+ content.each do |line|
621
+ puts "│".colorize(color) + "#{line}".ljust(content_width) + "│".colorize(color)
622
+ end
623
+ end
624
+
625
+ puts ("╰" + "─" * content_width + "╯").colorize(color)
626
+ puts ""
627
+ end
596
628
  end
597
629
  end