neetodeploy 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/exe/console +0 -0
- data/lib/neeto_deploy/cli/env/commands.rb +1 -0
- data/lib/neeto_deploy/cli/env/list.rb +16 -3
- data/lib/neeto_deploy/cli/exec/base.rb +32 -12
- data/lib/neeto_deploy/cli/pg/commands.rb +5 -5
- data/lib/neeto_deploy/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a80b1dc99cd84c07a2d0892accedceae3492a5ec4e5f8291854649634737d45
|
4
|
+
data.tar.gz: 93ac86192e895e77d8d5a39e406d006da45de22e2ff0cc06f51906c0442632b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 353eea681bf9353635f4d1951eb11622854618ae43f4e0d26c3acb5ca49f5104320ac8f7c05722460af7b67eb0cb2170628f8cf3c13bef0fc2907672af1e58f9
|
7
|
+
data.tar.gz: 56c6c9ed6a00b6d1e1ef6071b511e4bf630652a12fca0cf6e300f905c99335e7a14dbedcf5e04193b5bd994248a31dbe72b8b69983a27b81a2b97d256de6b3e1
|
data/Gemfile.lock
CHANGED
data/exe/console
ADDED
Binary file
|
@@ -12,6 +12,7 @@ module NeetoDeploy
|
|
12
12
|
class Commands < Thor
|
13
13
|
desc "list", "List all environment variable"
|
14
14
|
option :app, type: :string, aliases: "-a", required: true, desc: "App slug" # TODO make this a common static function
|
15
|
+
option :json, type: :boolean, aliases: "-j", desc: "Output config vars in json format"
|
15
16
|
def list
|
16
17
|
List.new(options:).run
|
17
18
|
end
|
@@ -13,11 +13,12 @@ module NeetoDeploy
|
|
13
13
|
include Constants
|
14
14
|
include Session
|
15
15
|
|
16
|
-
attr_reader :app_slug
|
16
|
+
attr_reader :app_slug, :is_json_format
|
17
17
|
|
18
18
|
def initialize(options:)
|
19
19
|
super()
|
20
20
|
@app_slug = options[:app]
|
21
|
+
@is_json_format = options[:json]
|
21
22
|
end
|
22
23
|
|
23
24
|
def run
|
@@ -29,8 +30,8 @@ module NeetoDeploy
|
|
29
30
|
|
30
31
|
ui.error(response) and return unless response.success?
|
31
32
|
|
32
|
-
|
33
|
-
ui.success(
|
33
|
+
data = is_json_format ? json_data(response["environment_variables"]) : table_data(response["environment_variables"])
|
34
|
+
ui.success(data)
|
34
35
|
end
|
35
36
|
|
36
37
|
private
|
@@ -44,6 +45,18 @@ module NeetoDeploy
|
|
44
45
|
[environment_variable["key"], environment_variable["value"].gsub("\\n", "\n")]
|
45
46
|
end
|
46
47
|
end
|
48
|
+
|
49
|
+
def table_data(envs)
|
50
|
+
Terminal::Table.new(headings: table_columns, rows: table_rows(envs))
|
51
|
+
end
|
52
|
+
|
53
|
+
def json_data(envs)
|
54
|
+
resulting_hash = envs.each_with_object({}) do |item, hash|
|
55
|
+
hash[item["key"]] = item["value"]
|
56
|
+
end
|
57
|
+
JSON.pretty_generate(resulting_hash)
|
58
|
+
end
|
59
|
+
|
47
60
|
end
|
48
61
|
end
|
49
62
|
end
|
@@ -11,7 +11,7 @@ require_relative "../dyno_console_manager"
|
|
11
11
|
module NeetoDeploy
|
12
12
|
class CLI
|
13
13
|
module Exec
|
14
|
-
class Base < CLI::
|
14
|
+
class Base < CLI::Base
|
15
15
|
include Constants
|
16
16
|
include Session
|
17
17
|
|
@@ -20,31 +20,51 @@ module NeetoDeploy
|
|
20
20
|
def initialize(app_name)
|
21
21
|
super()
|
22
22
|
@app_name = app_name
|
23
|
-
@instance_name = app_name
|
24
|
-
@connection_established = false
|
25
23
|
end
|
26
24
|
|
27
25
|
def process!
|
28
|
-
|
26
|
+
start_spinner
|
27
|
+
send_console_session_request
|
28
|
+
ui.error("\n#{@response.body}") and return unless @response.success?
|
29
|
+
|
30
|
+
|
31
|
+
buffer_wait_block
|
32
|
+
start_console
|
33
|
+
connection_cleanup_callback
|
29
34
|
end
|
30
35
|
|
31
36
|
private
|
32
37
|
|
38
|
+
def console_executable_path
|
39
|
+
gem_spec = Gem::Specification.find_by_name("neetodeploy")
|
40
|
+
gem_dir = gem_spec.gem_dir
|
41
|
+
executable_path = File.join(gem_dir, "exe", "console")
|
42
|
+
end
|
43
|
+
|
44
|
+
def start_console
|
45
|
+
@pubsub_token = @response.parsed_response["console_pubsub_token"]
|
46
|
+
console_access_token = @response.parsed_response["console_access_token"]
|
47
|
+
pod_name = "#{app_name}-#{@pubsub_token}-console-deployment"
|
48
|
+
system("#{console_executable_path} #{pod_name} #{console_access_token}")
|
49
|
+
end
|
50
|
+
|
33
51
|
def send_console_session_request
|
34
52
|
@response = send_post_request(console_session_base_url, { app_slug: @app_name })
|
35
53
|
end
|
36
54
|
|
37
|
-
def
|
38
|
-
|
39
|
-
pubsub_token
|
40
|
-
|
55
|
+
def connection_cleanup_callback
|
56
|
+
url = "#{console_session_base_url}/#{app_name}"
|
57
|
+
send_delete_request(url, { pubsub_token: @pubsub_token })
|
58
|
+
end
|
41
59
|
|
42
|
-
|
60
|
+
def start_spinner
|
61
|
+
@spinner = TTY::Spinner.new("[:spinner] Connecting to #{app_name}", format: :classic)
|
62
|
+
@spinner.auto_spin
|
43
63
|
end
|
44
64
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
65
|
+
def buffer_wait_block
|
66
|
+
sleep 5
|
67
|
+
@spinner.stop
|
48
68
|
end
|
49
69
|
end
|
50
70
|
end
|
@@ -6,12 +6,12 @@ module NeetoDeploy
|
|
6
6
|
class CLI
|
7
7
|
module Pg
|
8
8
|
class Commands < Thor
|
9
|
-
desc "cli", "Connect to postgresql console"
|
10
|
-
option :addon_name, type: :string, aliases: "-n", required: true, desc: "Addon name"
|
9
|
+
# desc "cli", "Connect to postgresql console"
|
10
|
+
# option :addon_name, type: :string, aliases: "-n", required: true, desc: "Addon name"
|
11
11
|
|
12
|
-
def cli
|
13
|
-
|
14
|
-
end
|
12
|
+
# def cli
|
13
|
+
# Console.new(options).run
|
14
|
+
# end
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/neeto_deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neetodeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subin Siby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -126,6 +126,7 @@ description: Manage neetoDeploy apps with CLI
|
|
126
126
|
email:
|
127
127
|
- subin.siby@bigbinary.com
|
128
128
|
executables:
|
129
|
+
- console
|
129
130
|
- neetodeploy
|
130
131
|
extensions: []
|
131
132
|
extra_rdoc_files: []
|
@@ -133,6 +134,7 @@ files:
|
|
133
134
|
- ".ruby-version"
|
134
135
|
- Gemfile
|
135
136
|
- Gemfile.lock
|
137
|
+
- exe/console
|
136
138
|
- exe/neetodeploy
|
137
139
|
- lib/neeto_deploy.rb
|
138
140
|
- lib/neeto_deploy/cli.rb
|