Class: DeployGate::Commands::Login
- Inherits:
-
Object
- Object
- DeployGate::Commands::Login
show all
- Defined in:
- lib/deploygate/commands/login.rb
Defined Under Namespace
Classes: AccountNotFoundError
Class Method Summary
collapse
Class Method Details
63
64
65
|
# File 'lib/deploygate/commands/login.rb', line 63
def input_password(message)
ask(message) { |q| q.echo = "*" }
end
|
.login_success ⇒ Object
57
58
59
60
|
# File 'lib/deploygate/commands/login.rb', line 57
def login_success
session = Session.new
puts HighLine.color(I18n.t('commands.login.start.success', name: session.name), HighLine::GREEN)
end
|
.print_deploygate_aa ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/deploygate/commands/login.rb', line 67
def print_deploygate_aa
puts <<'EOF'
_ _ _
| | | | | |
__| | ___ ___ | | ___ _ ,____ ___ | |_ ___
/ _` |/ _ \' _ \| |/ _ \ \ / / _ \ / _ `| __/ _ \
| (_| | __/ |_) | | (_) \ v / (_| | (_| | |_' __/
\___, \___| .__/|_|\___/ ` / \__, |\__,_|\__\___`
|_| /_/ |___/
EOF
end
|
.run(args, options) ⇒ void
This method returns an undefined value.
9
10
11
12
13
14
15
16
17
|
# File 'lib/deploygate/commands/login.rb', line 9
def run(args, options)
welcome()
if options.terminal
start_login()
else
DeployGate::BrowserLogin.new().start()
end
end
|
.start(email, password) ⇒ void
This method returns an undefined value.
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/deploygate/commands/login.rb', line 45
def start(email, password)
begin
Session.login(email, password)
rescue Session::LoginError => e
puts HighLine.color(I18n.t('commands.login.start.login_error'), HighLine::RED)
raise e
end
login_success()
end
|
.start_login ⇒ void
This method returns an undefined value.
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/deploygate/commands/login.rb', line 26
def start_login
puts ''
email = ask(I18n.t('commands.login.start_login.email'))
puts ''
puts I18n.t('commands.login.start_login.check_account')
if DeployGate::User.registered?('', email)
puts ''
password = input_password(I18n.t('commands.login.start_login.input_password'))
puts ''
start(email, password)
else
raise AccountNotFoundError, HighLine.color(I18n.t('errors.account_not_found_error'))
end
end
|
.welcome ⇒ Object
19
20
21
22
|
# File 'lib/deploygate/commands/login.rb', line 19
def welcome
puts I18n.t('commands.login.start_login.welcome')
print_deploygate_aa()
end
|