jatai 1.1.0 → 1.2.0

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: 0414ab5a8322cd65aba223bfc1c79084aeed847a5a1a72bb0070803fa0ae4e35
4
- data.tar.gz: e0051e25a40195a6d3754a0181d25e5b11d851990525f42fed4bb63223c0e2f2
3
+ metadata.gz: 85122c82b155efd22ee855b4d8e538be1013e93cccbde96c19b695bbf2fbff96
4
+ data.tar.gz: 0bc52ba21340fc3c77f775373397d97a7f9ff194f17559817a34fb7e14045355
5
5
  SHA512:
6
- metadata.gz: 7d8a726adfba343f5ca23c2d9a8bea2f7fe2ceccedd03dd1cedcae88f32784895d523725f6193986d92e301014ea839bd2326066f27ef44d92902aced73fb769
7
- data.tar.gz: 83e00a729190c4ad415b58a1de0f28fa5f38bc3afddfaad9c7222506971ef3ca3aa054e017aee6e070d0f4069f5524500a6c49ef548ec93c6e92edfac3b292e7
6
+ metadata.gz: b9194f0bf98aedc96cf0357260ebc531c2ba82edc2e58ef36f42888fc9e7f8b330c5f86367a48cde2408c183ea12cd751e499c8c578c0f96d48c1531b3e1ecd0
7
+ data.tar.gz: 07bde3b740fcb1a5fedea4c0d5f0da6122000fbbbd1cb27fe4e8b0a9543f45279410eb335bc3564b9f13ad405f406e97bc11cae83f0396d93570815bd9e5460a
@@ -6,10 +6,10 @@ module Jatai
6
6
  module Commands
7
7
  class Up < Base
8
8
  POLL_INTERVAL = 5
9
- PROVISION_TIMEOUT = 1200
10
- DEPLOY_TIMEOUT = 1800
11
- PROVISION_MAX_POLLS = 240
12
- DEPLOY_MAX_POLLS = 360
9
+ PROVISION_TIMEOUT = 180
10
+ DEPLOY_TIMEOUT = 900
11
+ PROVISION_MAX_POLLS = 36
12
+ DEPLOY_MAX_POLLS = 180
13
13
 
14
14
  def execute(options = {})
15
15
  require_auth!
@@ -34,8 +34,9 @@ module Jatai
34
34
  info(" Na fila...")
35
35
 
36
36
  if wait_for_deploy_complete(slug, deploy["id"])
37
- subdomain = @app["subdomain"] || slug
38
- success("Deploy concluído! App disponível em https://#{subdomain}.usebrasa.com.br")
37
+ # URL canônica vem do servidor (marca nova). Fallback só p/ servidor antigo.
38
+ url = @app["url"] || "https://#{@app["subdomain"] || slug}.jataiapp.com.br"
39
+ success("Deploy concluído! App disponível em #{url}")
39
40
  end
40
41
  rescue Api::Client::ValidationError => e
41
42
  error("Erro ao criar app: #{e.message}")
@@ -94,7 +95,23 @@ module Jatai
94
95
 
95
96
  def detect_git_remote
96
97
  remote = `git remote get-url origin 2>/dev/null`.strip
97
- remote.empty? ? nil : remote
98
+ return nil if remote.empty?
99
+
100
+ normalize_git_remote(remote)
101
+ end
102
+
103
+ # O servidor aceita repo_url só como https(s) (é metadado p/ integração GitHub;
104
+ # o deploy em si é por upload de source). Converte SSH → https e descarta o que
105
+ # não der pra normalizar (retorna nil → repo_url em branco, deploy segue normal).
106
+ def normalize_git_remote(url)
107
+ case url
108
+ when %r{\Agit@([^:]+):(.+?)(?:\.git)?\z} # git@github.com:user/repo.git
109
+ "https://#{Regexp.last_match(1)}/#{Regexp.last_match(2)}"
110
+ when %r{\Assh://git@([^/]+)/(.+?)(?:\.git)?\z} # ssh://git@github.com/user/repo.git
111
+ "https://#{Regexp.last_match(1)}/#{Regexp.last_match(2)}"
112
+ when %r{\Ahttps?://}
113
+ url.sub(/\.git\z/, "")
114
+ end
98
115
  end
99
116
 
100
117
  # ── WebSocket methods ──
@@ -172,6 +189,8 @@ module Jatai
172
189
  print "."
173
190
  show_elapsed(started) if (i % 12).zero? && i > 0
174
191
  sleep(POLL_INTERVAL)
192
+ rescue Api::Client::AuthenticationError
193
+ return session_expired
175
194
  rescue Faraday::Error, Errno::ECONNREFUSED, IO::TimeoutError
176
195
  print "!"
177
196
  sleep(POLL_INTERVAL)
@@ -197,6 +216,8 @@ module Jatai
197
216
  print "."
198
217
  show_elapsed(started) if (i % 12).zero? && i > 0
199
218
  sleep(POLL_INTERVAL)
219
+ rescue Api::Client::AuthenticationError
220
+ return session_expired
200
221
  rescue Faraday::Error, Errno::ECONNREFUSED, IO::TimeoutError
201
222
  print "!"
202
223
  sleep(POLL_INTERVAL)
@@ -205,6 +226,14 @@ module Jatai
205
226
  false
206
227
  end
207
228
 
229
+ # 401 no meio do acompanhamento: o token expirou, mas o deploy segue no
230
+ # servidor. Orienta o usuário em vez de estourar um erro seco.
231
+ def session_expired
232
+ error("\nSua sessão expirou durante o acompanhamento. O deploy continua no servidor.")
233
+ info("Rode `jatai login` e acompanhe com `jatai status`.")
234
+ false
235
+ end
236
+
208
237
  def status_label(status)
209
238
  { "pending" => "Aguardando...", "provisioning" => "Provisionando...",
210
239
  "queued" => "Na fila...", "building" => "Construindo imagem...",
data/lib/jatai/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jatai
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jatai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jataí Cloud