brasa 0.1.0 → 0.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: 80e53e0d5fb933d533d94ab5863759651936979cf39b41bee334e2558e3fc343
4
- data.tar.gz: 3274b32a209a87202587d48a9acc8f25df7f05b6f59472805ebad6b0ed646971
3
+ metadata.gz: 0e032ecc30bbe651d19e8a91b2f72763a0b210aa110fa1dfb635ae4cd5c1b516
4
+ data.tar.gz: df821859fe77ebc80d247d272f3be6dc604c9cfbb0f39de24b65f46a5a19ea11
5
5
  SHA512:
6
- metadata.gz: 0ee91bdc2edea4b69d84a9d788b525f5275c5b0483055e8235bc201fb9308751df3e7697dcd6c9d423612d243431ff651d8d243aaf72ef5ad1561e37570d190e
7
- data.tar.gz: 55e7419b734c594a766e8e48ebc0ceba35a1ac83be0364b50f8d087b6a450b16fdfd4c461a0b8653d4d0174a25c2a69d17327ed959309905e8d29f8498a34b11
6
+ metadata.gz: 4057bbc29ef417a5c7690e5d5bca6355e3eb6da62a09296b0082954c5946e65e8ddaf5d715e26ad9d9a2e46826912b1b9c80d59246afbf61f95e0a9e296b28eb
7
+ data.tar.gz: 2385cd7bbee60f2041ddfeff043d3ee4cfdd1d7fe4987ff1e7da90a5a7db94844b9a0870a3fd3d9cefb4042be08375e937afeb6335ba3047dbaf268f5bd0dbe9
data/README.md CHANGED
@@ -58,7 +58,7 @@ stack: rails
58
58
 
59
59
  | Variavel | Descricao | Padrao |
60
60
  |----------|-----------|--------|
61
- | `BRASA_API_URL` | URL da API | `https://api.brasa.com.br` |
61
+ | `BRASA_API_URL` | URL da API | `https://api.usebrasa.com.br` |
62
62
 
63
63
  ## Licenca
64
64
 
data/lib/brasa/cli.rb CHANGED
@@ -10,6 +10,7 @@ require "brasa/commands/scale"
10
10
  require "brasa/commands/status"
11
11
  require "brasa/commands/destroy"
12
12
  require "brasa/commands/domains"
13
+ require "brasa/commands/redis"
13
14
 
14
15
  module Brasa
15
16
  class CLI < Thor
@@ -53,6 +54,9 @@ module Brasa
53
54
  desc "domains SUBCOMMAND", "Gerenciar domínios customizados"
54
55
  subcommand "domains", Commands::Domains
55
56
 
57
+ desc "redis SUBCOMMAND", "Gerenciar Redis cache"
58
+ subcommand "redis", Commands::Redis
59
+
56
60
  desc "scale", "Escalar a aplicação"
57
61
  option :web, type: :numeric, desc: "Número de instâncias web"
58
62
  option :preset, type: :string, desc: "Preset (hobby, production, scale)"
@@ -37,7 +37,7 @@ module Brasa
37
37
  result = helper.api.post("/api/v1/apps/#{slug}/domains", body: { domain: { hostname: hostname } })
38
38
  helper.success("Domínio #{hostname} adicionado.")
39
39
  helper.info("Token de verificação: #{result["verification_token"]}")
40
- helper.info("Adicione um registro CNAME ou TXT apontando para #{slug}.brasa.com.br")
40
+ helper.info("Adicione um registro CNAME ou TXT apontando para #{slug}.usebrasa.com.br")
41
41
  rescue Api::Client::ValidationError => e
42
42
  DomainsHelper.new.error("Erro: #{e.message}")
43
43
  rescue Api::Client::ApiError => e
@@ -0,0 +1,62 @@
1
+ require "thor"
2
+ require "brasa/commands/base"
3
+
4
+ module Brasa
5
+ module Commands
6
+ class Redis < Thor
7
+ namespace :redis
8
+
9
+ desc "status", "Ver status do Redis"
10
+ def status
11
+ helper = RedisHelper.new
12
+ helper.require_auth!
13
+ slug = helper.app_slug
14
+
15
+ redis = helper.api.get("/api/v1/apps/#{slug}/redis")
16
+
17
+ puts helper.pastel.bold("Redis de #{slug}")
18
+ puts " Status: #{redis["status"]}"
19
+ puts " Versão: Redis #{redis["version"]}"
20
+ puts " Memória: #{redis["memory_mb"]}MB"
21
+ puts " URL: #{redis["redis_url"]}"
22
+ rescue Api::Client::ApiError => e
23
+ RedisHelper.new.error("Erro: #{e.message}")
24
+ end
25
+
26
+ desc "enable", "Habilitar Redis para o app"
27
+ option :memory, type: :numeric, default: 256, desc: "Memória em MB (256, 512, 1024)"
28
+ def enable
29
+ helper = RedisHelper.new
30
+ helper.require_auth!
31
+ slug = helper.app_slug
32
+
33
+ helper.info("Habilitando Redis com #{options[:memory]}MB...")
34
+ result = helper.api.post("/api/v1/apps/#{slug}/redis", { memory_mb: options[:memory] })
35
+ helper.success("Redis habilitado! Status: #{result["status"]}")
36
+ rescue Api::Client::ApiError => e
37
+ RedisHelper.new.error("Erro: #{e.message}")
38
+ end
39
+
40
+ desc "disable", "Remover Redis do app"
41
+ def disable
42
+ helper = RedisHelper.new
43
+ helper.require_auth!
44
+ slug = helper.app_slug
45
+
46
+ prompt = TTY::Prompt.new
47
+ unless prompt.yes?("Remover Redis? Todos os dados em cache serão perdidos.")
48
+ helper.info("Operação cancelada.")
49
+ return
50
+ end
51
+
52
+ helper.info("Removendo Redis...")
53
+ helper.api.delete("/api/v1/apps/#{slug}/redis")
54
+ helper.success("Redis removido com sucesso!")
55
+ rescue Api::Client::ApiError => e
56
+ RedisHelper.new.error("Erro: #{e.message}")
57
+ end
58
+ end
59
+
60
+ class RedisHelper < Base; end
61
+ end
62
+ end
@@ -15,7 +15,7 @@ module Brasa
15
15
  puts " Status: #{colorize_status(app["status"])}"
16
16
  puts " Região: #{app["region"]}"
17
17
  puts " Preset: #{app["preset"]}"
18
- puts " URL: https://#{app["slug"]}.brasa.com.br"
18
+ puts " URL: https://#{app["slug"]}.usebrasa.com.br"
19
19
 
20
20
  if app["last_deploy"]
21
21
  deploy = app["last_deploy"]
@@ -22,7 +22,7 @@ module Brasa
22
22
  deploy = trigger_deploy(app["slug"])
23
23
  wait_for_deploy(app["slug"], deploy["id"])
24
24
 
25
- success("Deploy concluído! App disponível em https://#{app["slug"]}.brasa.com.br")
25
+ success("Deploy concluído! App disponível em https://#{app["slug"]}.usebrasa.com.br")
26
26
  rescue Api::Client::ValidationError => e
27
27
  error("Erro ao criar app: #{e.message}")
28
28
  rescue Api::Client::ApiError => e
data/lib/brasa/config.rb CHANGED
@@ -7,7 +7,7 @@ module Brasa
7
7
  CREDENTIALS_FILE = File.join(CONFIG_DIR, "credentials.json").freeze
8
8
  PROJECT_FILE = ".brasa.yml".freeze
9
9
 
10
- DEFAULT_API_URL = "https://api.brasa.com.br".freeze
10
+ DEFAULT_API_URL = "https://api.usebrasa.com.br".freeze
11
11
 
12
12
  class << self
13
13
  def api_url
data/lib/brasa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Brasa
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brasa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brasa
@@ -124,7 +124,7 @@ dependencies:
124
124
  description: Deploy apps Rails e Node.js na nuvem brasileira com um comando. Soberania
125
125
  de dados, faturamento em reais.
126
126
  email:
127
- - contato@brasa.com.br
127
+ - contato@usebrasa.com.br
128
128
  executables:
129
129
  - brasa
130
130
  extensions: []
@@ -145,12 +145,13 @@ files:
145
145
  - lib/brasa/commands/init.rb
146
146
  - lib/brasa/commands/login.rb
147
147
  - lib/brasa/commands/logs.rb
148
+ - lib/brasa/commands/redis.rb
148
149
  - lib/brasa/commands/scale.rb
149
150
  - lib/brasa/commands/status.rb
150
151
  - lib/brasa/commands/up.rb
151
152
  - lib/brasa/config.rb
152
153
  - lib/brasa/version.rb
153
- homepage: https://brasa.com.br
154
+ homepage: https://usebrasa.com.br
154
155
  licenses:
155
156
  - MIT
156
157
  metadata: {}