Class: Jatai::Commands::Deploy
- Defined in:
- lib/jatai/commands/deploy.rb
Constant Summary collapse
- POLL_INTERVAL =
5- DEPLOY_TIMEOUT =
1800- DEPLOY_MAX_POLLS =
360
Instance Method Summary collapse
Methods inherited from Base
#api, #app_slug, #error, #info, #pastel, #project_config, #require_auth!, #success
Instance Method Details
#execute(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jatai/commands/deploy.rb', line 12 def execute( = {}) require_auth! slug = app_slug info("Empacotando código...") archive_path = SourcePacker.pack size_kb = File.size(archive_path) / 1024 spinner = TTY::Spinner.new("#{pastel.cyan(" Enviando #{size_kb}KB...")} :spinner", format: :dots) spinner.auto_spin deploy = api.upload("/api/v1/apps/#{slug}/deploys", file_path: archive_path, params: { branch: ["branch"] || project_config[:branch] || "main" }) spinner.success(pastel.green("enviado!")) info("Deploy ##{deploy["id"]} criado.") info(" Na fila...") wait_for_deploy_complete(slug, deploy["id"]) rescue Api::Client::ApiError => e error("Erro: #{e.}") ensure FileUtils.rm_f(archive_path) if archive_path end |