Class: Jatai::Commands::Base
- Inherits:
-
Object
- Object
- Jatai::Commands::Base
show all
- Defined in:
- lib/jatai/commands/base.rb
Direct Known Subclasses
DatabaseHelper, Deploy, Destroy, DomainsHelper, EnvHelper, Init, Login, Logs, LogsExport, LogsSearch, RedisHelper, Scale, Status, Up
Instance Method Summary
collapse
Instance Method Details
#api ⇒ Object
11
12
13
|
# File 'lib/jatai/commands/base.rb', line 11
def api
@api ||= Api::Client.new
end
|
#app_slug ⇒ Object
25
26
27
|
# File 'lib/jatai/commands/base.rb', line 25
def app_slug
project_config[:app]
end
|
#error(msg) ⇒ Object
38
39
40
|
# File 'lib/jatai/commands/base.rb', line 38
def error(msg)
puts pastel.red(msg)
end
|
#info(msg) ⇒ Object
42
43
44
|
# File 'lib/jatai/commands/base.rb', line 42
def info(msg)
puts pastel.cyan(msg)
end
|
#pastel ⇒ Object
7
8
9
|
# File 'lib/jatai/commands/base.rb', line 7
def pastel
@pastel ||= Pastel.new
end
|
#project_config ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/jatai/commands/base.rb', line 15
def project_config
@project_config ||= begin
config_path = Config.project_file_path
unless File.exist?(config_path)
abort pastel.red("Arquivo .jatai.yml não encontrado. Execute `jatai init` primeiro.")
end
YAML.safe_load(File.read(config_path), symbolize_names: true)
end
end
|
#require_auth! ⇒ Object
29
30
31
32
|
# File 'lib/jatai/commands/base.rb', line 29
def require_auth!
return if Config.token
abort pastel.red("Não autenticado. Execute `jatai login` primeiro.")
end
|
#success(msg) ⇒ Object
34
35
36
|
# File 'lib/jatai/commands/base.rb', line 34
def success(msg)
puts pastel.green(msg)
end
|