Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Display progress bar when connecting to Rails Console

Change-Id: If26971cf1481510eba01b179fe616ba827159176
  • Loading branch information...
commit c4d8393deaac65b0f76b71c6eda05ff4fc7f5567 1 parent 421e248
Jennifer Hickey authored
Showing with 14 additions and 4 deletions.
  1. +14 −4 lib/cli/console_helper.rb
View
18 lib/cli/console_helper.rb
@@ -32,9 +32,20 @@ def console_connection_info(appname)
def start_local_console(port, appname)
auth_info = console_credentials(appname)
- display "Connecting to '#{appname}' console: ", false
+ banner = "Connecting to '#{appname}' console: "
+ display banner, false
+ t = Thread.new do
+ count = 0
+ while count < 90 do
+ display '.', false
+ sleep 1
+ count += 1
+ end
+ end
prompt = console_login(auth_info, port)
- display "OK".green
+ Thread.kill(t)
+ clear(80)
+ display "#{banner}#{'OK'.green}"
display "\n"
initialize_readline
run_console prompt
@@ -47,7 +58,7 @@ def console_login(auth_info, port)
@telnet_client = telnet_client(port)
prompt = nil
err_msg = "Login attempt timed out."
- 5.times do
+ 3.times do
begin
results = @telnet_client.login("Name"=>auth_info["username"],
"Password"=>auth_info["password"])
@@ -67,7 +78,6 @@ def console_login(auth_info, port)
sleep 5
@telnet_client = telnet_client(port)
end
- display ".", false
end
unless prompt
close_console
Please sign in to comment.
Something went wrong with that request. Please try again.