neetodeploy 1.0.6 → 1.0.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/neeto_deploy/cli/base.rb +1 -1
- data/lib/neeto_deploy/cli/exec/base.rb +24 -1
- data/lib/neeto_deploy/cli/exec/constants.rb +15 -0
- data/lib/neeto_deploy/cli/login/base.rb +18 -4
- data/lib/neeto_deploy/cli/login/constants.rb +3 -2
- data/lib/neeto_deploy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ea4f99fbeaf0fbd93641b5efb3d492d16417095156ead2075b38f9554aed01e
|
4
|
+
data.tar.gz: 0d209c71f40f53589929a71d741025fc44bafd4f4c2ad13bc80a5d4265e1d77b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31defc5670116331de581587d1e235a08026f5b58833eca0bff8a0eb7d6750303cd9dc6571fd057e04191433b6d21bee3dc3db92d044f36722a015161e2e393c
|
7
|
+
data.tar.gz: 3bcdcda2d127a42aded214d4e8fac649762b6e26e599c09fb35d564615410185646bd1ded577bcd2104523ed040cd9d7f90c7f46d1d07efaded2c6a4a596a0d0
|
data/Gemfile.lock
CHANGED
@@ -5,7 +5,7 @@ require_relative "../version"
|
|
5
5
|
|
6
6
|
module NeetoDeploy
|
7
7
|
class CLI
|
8
|
-
NEETO_DEPLOY_HOST = ENV["NEETO_DEPLOY_HOST"] || "https://
|
8
|
+
NEETO_DEPLOY_HOST = ENV["NEETO_DEPLOY_HOST"] || "https://app.neetodeploy.net"
|
9
9
|
NEETO_DEPLOY_CLI_API_BASE_URL = "#{NEETO_DEPLOY_HOST}/api/cli/#{CLI_API_VERSION}"
|
10
10
|
|
11
11
|
CLI_CONFIG_DIR = "~/.config/neetodeploy".freeze
|
@@ -3,19 +3,38 @@ require "websocket-client-simple"
|
|
3
3
|
require "thor"
|
4
4
|
require "readline"
|
5
5
|
|
6
|
+
require_relative "../session"
|
7
|
+
require_relative "./constants"
|
8
|
+
|
6
9
|
module NeetoDeploy
|
7
10
|
class CLI
|
8
11
|
module Exec
|
9
12
|
class Base < CLI::Base
|
13
|
+
include Constants
|
14
|
+
include Session
|
15
|
+
|
10
16
|
attr_reader :app_name
|
17
|
+
|
11
18
|
def initialize(app_name)
|
19
|
+
super()
|
12
20
|
@app_name = app_name
|
13
21
|
end
|
14
22
|
|
15
23
|
def process!
|
16
24
|
puts "Opening console for #{app_name}"
|
17
25
|
|
18
|
-
|
26
|
+
response = send_post_request(
|
27
|
+
console_session_create_url, {
|
28
|
+
# TODO refactor app_slug to app_name in dashboard app
|
29
|
+
app_slug: app_name,
|
30
|
+
}
|
31
|
+
)
|
32
|
+
|
33
|
+
ui.error(response) and return unless response.success?
|
34
|
+
|
35
|
+
console_token = response.parsed_response["console_token"]
|
36
|
+
|
37
|
+
ws = WebSocket::Client::Simple.connect "wss://neeto-deploy-lc.neetoreviewapp.net/cli_console?deployment_name=#{app_name}&console_token=#{console_token}"
|
19
38
|
|
20
39
|
prompt = ''
|
21
40
|
|
@@ -46,6 +65,10 @@ module NeetoDeploy
|
|
46
65
|
exit 1
|
47
66
|
end
|
48
67
|
|
68
|
+
trap("SIGINT") do
|
69
|
+
Thread.new { ws.send "4" }
|
70
|
+
end
|
71
|
+
|
49
72
|
loop do
|
50
73
|
sleep 0.1
|
51
74
|
input = Readline.readline(prompt, true)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NeetoDeploy
|
4
|
+
class CLI
|
5
|
+
module Exec
|
6
|
+
module Constants
|
7
|
+
NEETO_DEPLOY_CLI_API_CONSOLE_SESSION_CREATE_URL = "#{NEETO_DEPLOY_CLI_API_BASE_URL}/console_sessions".freeze
|
8
|
+
|
9
|
+
def console_session_create_url
|
10
|
+
NEETO_DEPLOY_CLI_API_CONSOLE_SESSION_CREATE_URL
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -12,10 +12,11 @@ module NeetoDeploy
|
|
12
12
|
class Base < CLI::Base
|
13
13
|
include Constants
|
14
14
|
|
15
|
-
attr_accessor :login_token
|
15
|
+
attr_accessor :login_token, :org_subdomain
|
16
16
|
|
17
17
|
def process!
|
18
18
|
init_session
|
19
|
+
ask_for_org_subdomain
|
19
20
|
show_login_link_and_open_in_browser
|
20
21
|
wait_until_user_authenticates!
|
21
22
|
end
|
@@ -27,14 +28,27 @@ module NeetoDeploy
|
|
27
28
|
self.login_token = response["login_token"]
|
28
29
|
end
|
29
30
|
|
31
|
+
def ask_for_org_subdomain
|
32
|
+
ui.say(
|
33
|
+
<<~EOF
|
34
|
+
Welcome to neetoDeploy CLI. To get started, we need your organization's subdomain.
|
35
|
+
|
36
|
+
If your organization URL is "myorg.neetodeploy.com", your organization subdomain is "myorg".
|
37
|
+
More information: https://help.neetodeploy.com/articles/neetodeploy-cli
|
38
|
+
|
39
|
+
EOF
|
40
|
+
)
|
41
|
+
self.org_subdomain = ui.ask("Please enter the subdomain of your organization:")
|
42
|
+
end
|
43
|
+
|
30
44
|
def show_login_link_and_open_in_browser
|
31
45
|
ui.say(
|
32
46
|
<<~EOF
|
33
|
-
|
34
|
-
#{session_login_url}
|
47
|
+
The login page will be opened in your browser. If it didn't, please open this URL in your browser:
|
48
|
+
#{session_login_url(org_subdomain)}
|
35
49
|
EOF
|
36
50
|
)
|
37
|
-
Launchy.open(session_login_url)
|
51
|
+
Launchy.open(session_login_url(org_subdomain))
|
38
52
|
end
|
39
53
|
|
40
54
|
def wait_until_user_authenticates!
|
@@ -11,8 +11,9 @@ module NeetoDeploy
|
|
11
11
|
NEETO_DEPLOY_CLI_API_SESSIONS_URL
|
12
12
|
end
|
13
13
|
|
14
|
-
def session_login_url
|
15
|
-
"#{
|
14
|
+
def session_login_url(org_subdomain)
|
15
|
+
org_url = NEETO_DEPLOY_HOST.sub("app.", "#{org_subdomain}.")
|
16
|
+
"#{org_url}/cli/login?token=#{login_token}"
|
16
17
|
end
|
17
18
|
|
18
19
|
def session_login_status_url
|
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.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subin Siby
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/neeto_deploy/cli/config/set.rb
|
116
116
|
- lib/neeto_deploy/cli/config/unset.rb
|
117
117
|
- lib/neeto_deploy/cli/exec/base.rb
|
118
|
+
- lib/neeto_deploy/cli/exec/constants.rb
|
118
119
|
- lib/neeto_deploy/cli/login/base.rb
|
119
120
|
- lib/neeto_deploy/cli/login/constants.rb
|
120
121
|
- lib/neeto_deploy/cli/logs/base.rb
|