terminalwire 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/terminalwire/install/templates/application_terminal.rb.tt +4 -4
- data/lib/terminalwire/adapter.rb +1 -1
- data/lib/terminalwire/client/resource.rb +1 -0
- data/lib/terminalwire/client.rb +1 -1
- data/lib/terminalwire/server/resource.rb +1 -1
- data/lib/terminalwire/server.rb +22 -4
- data/lib/terminalwire/thor.rb +1 -1
- data/lib/terminalwire/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55ab6e5d0132726c5041fce03026f14963c2de4b60a2bc92cd2560b7f14890cf
|
4
|
+
data.tar.gz: b2f1d360f6135fddf2ab90ca5ad992f1e313ccd4de09cd8bca9314b6af0dbaac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f003df286a23cff8e92c92d5372f81dc7cc0a915b1d32a6ba8c0bd5005a54395286b9a72aad2d6cc9856d0e6ba2c1622757a6bfbf8aba343885e55b42980227
|
7
|
+
data.tar.gz: eb480c644c568de7b6391a4e3310219fbf64869972eaeac7f0d4a7a6365b8fb644edd0193ae3920df604b3044b14fdfc09f05aa39a491be5d634ab084d8058d3
|
@@ -12,13 +12,13 @@ class ApplicationTerminal < Thor
|
|
12
12
|
desc "login", "Login to your account"
|
13
13
|
def login
|
14
14
|
print "Email: "
|
15
|
-
email = gets
|
15
|
+
email = gets.chomp
|
16
16
|
|
17
17
|
print "Password: "
|
18
18
|
password = getpass
|
19
19
|
|
20
20
|
if self.current_user = User.authenticate(email, password)
|
21
|
-
puts "Successfully logged in as #{
|
21
|
+
puts "Successfully logged in as #{current_user.email}."
|
22
22
|
else
|
23
23
|
puts "Could not find a user with that email and password."
|
24
24
|
end
|
@@ -27,7 +27,7 @@ class ApplicationTerminal < Thor
|
|
27
27
|
desc "whoami", "Displays current user information."
|
28
28
|
def whoami
|
29
29
|
if self.current_user
|
30
|
-
puts "Logged in as #{
|
30
|
+
puts "Logged in as #{current_user.email}."
|
31
31
|
else
|
32
32
|
puts "Not logged in. Run `#{self.class.basename} login` to login."
|
33
33
|
end
|
@@ -49,6 +49,6 @@ class ApplicationTerminal < Thor
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def current_user
|
52
|
-
@current_user ||= User.find(session
|
52
|
+
@current_user ||= User.find(session["user_id"])
|
53
53
|
end
|
54
54
|
end
|
data/lib/terminalwire/adapter.rb
CHANGED
data/lib/terminalwire/client.rb
CHANGED
data/lib/terminalwire/server.rb
CHANGED
@@ -53,13 +53,15 @@ module Terminalwire
|
|
53
53
|
private
|
54
54
|
|
55
55
|
def run(adapter)
|
56
|
-
while message = adapter.
|
56
|
+
while message = adapter.read
|
57
57
|
puts message
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
class Thor < WebSocket
|
63
|
+
Rails = ::Rails
|
64
|
+
|
63
65
|
include Logging
|
64
66
|
|
65
67
|
def initialize(cli_class)
|
@@ -70,13 +72,29 @@ module Terminalwire
|
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
def error_message
|
76
|
+
"An error occurred. Please try again."
|
77
|
+
end
|
78
|
+
|
73
79
|
def run(adapter)
|
74
80
|
logger.info "ThorServer: Running #{@cli_class.inspect}"
|
75
|
-
while message = adapter.
|
81
|
+
while message = adapter.read
|
76
82
|
case message
|
77
83
|
in { event: "initialization", protocol:, program: { arguments: }, entitlement: }
|
78
|
-
Terminalwire::Server::Context.new(adapter:, entitlement:)
|
84
|
+
context = Terminalwire::Server::Context.new(adapter:, entitlement:)
|
85
|
+
|
86
|
+
begin
|
79
87
|
@cli_class.start(arguments, context:)
|
88
|
+
context.exit
|
89
|
+
rescue StandardError => e
|
90
|
+
if Rails.application.config.consider_all_requests_local
|
91
|
+
# Show the full error message with stack trace in development
|
92
|
+
context.stderr.puts "#{e.inspect}\n#{e.backtrace.join("\n")}"
|
93
|
+
else
|
94
|
+
# Show a generic message in production
|
95
|
+
context.stderr.puts error_message
|
96
|
+
end
|
97
|
+
context.exit 1
|
80
98
|
end
|
81
99
|
end
|
82
100
|
end
|
@@ -93,7 +111,7 @@ module Terminalwire
|
|
93
111
|
def run
|
94
112
|
logger.info "Server Handler: Running"
|
95
113
|
loop do
|
96
|
-
message = @adapter.
|
114
|
+
message = @adapter.read
|
97
115
|
case message
|
98
116
|
in { event: "initialization", protocol:, program: { arguments: }, entitlement: }
|
99
117
|
Context.new(adapter: @adapter) do |context|
|
data/lib/terminalwire/thor.rb
CHANGED
data/lib/terminalwire/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminalwire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-websocket
|