lamby 4.2.1 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/lib/lamby/command.rb +43 -0
- data/lib/lamby/handler.rb +8 -3
- data/lib/lamby/runner.rb +7 -7
- data/lib/lamby/version.rb +1 -1
- data/lib/lamby.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dce401866a14fbce98621f6c677ab0f17df796c1c9c0792d4a1030adc69eadbd
|
4
|
+
data.tar.gz: 593c2f449b053f4bdc6ae2dbe74602f0debd93d57a57a1811d7f791bc1b40fc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f119c574a97288c37eb7c5c97643650d2d730fe16ab7b7e6b06a777088e069b6050c4ab023856e32c10c7da0029d74067eb8db37492b0dc0c1a0ed3948f7ee9
|
7
|
+
data.tar.gz: 1bf90e93726e78a75f408801976f65c7dafe369cc14d567fb4ddb337832a0b3dfb10fb1d8e2f91b9b7cf20d42c176f914f0b33c3641accbbc8fd757ec3d56ba6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
See this http://keepachangelog.com link for information on how we want this documented formatted.
|
4
4
|
|
5
|
+
## v4.3.1, v4.3.2
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
- Command response will be #inspect for every command.
|
10
|
+
- Added x-lambda-console option to the event.
|
11
|
+
|
12
|
+
## v4.3.0
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
- Default Lamby::Runner::PATTERNS to allow everything.
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- New Lamby::Command for IRB style top level binding evals.
|
21
|
+
|
5
22
|
## v4.2.1
|
6
23
|
|
7
24
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
module Lamby
|
2
|
+
class Command
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def handle?(event)
|
7
|
+
event.dig('x-lambda-console', 'command') ||
|
8
|
+
event.dig('lamby', 'command')
|
9
|
+
end
|
10
|
+
|
11
|
+
def cmd(event:, context:)
|
12
|
+
new(event).call
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(event)
|
18
|
+
@event = event
|
19
|
+
@body = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
def call
|
23
|
+
begin
|
24
|
+
body = eval(command, TOPLEVEL_BINDING).inspect
|
25
|
+
{ statusCode: 200, headers: {}, body: body }
|
26
|
+
rescue Exception => e
|
27
|
+
body = "#<#{e.class}:#{e.message}>".tap do |b|
|
28
|
+
if e.backtrace
|
29
|
+
b << "\n"
|
30
|
+
b << e.backtrace.join("\n")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
{ statusCode: 422, headers: {}, body: body }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def command
|
38
|
+
@event.dig('x-lambda-console', 'command') ||
|
39
|
+
@event.dig('lamby', 'command')
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/lib/lamby/handler.rb
CHANGED
@@ -92,9 +92,10 @@ module Lamby
|
|
92
92
|
Lambdakiq.cmd event: @event, context: @context
|
93
93
|
elsif lambda_cable?
|
94
94
|
LambdaCable.cmd event: @event, context: @context
|
95
|
+
elsif command?
|
96
|
+
Lamby::Command.cmd event: @event, context: @context
|
95
97
|
elsif runner?
|
96
|
-
|
97
|
-
{ statusCode: status, headers: headers, body: body }
|
98
|
+
Lamby::Runner.cmd event: @event, context: @context
|
98
99
|
elsif event_bridge?
|
99
100
|
Lamby.config.event_bridge_handler.call @event, @context
|
100
101
|
else
|
@@ -121,7 +122,11 @@ module Lamby
|
|
121
122
|
end
|
122
123
|
|
123
124
|
def runner?
|
124
|
-
Runner.handle?(@event)
|
125
|
+
Lamby::Runner.handle?(@event)
|
126
|
+
end
|
127
|
+
|
128
|
+
def command?
|
129
|
+
Lamby::Command.handle?(@event)
|
125
130
|
end
|
126
131
|
|
127
132
|
def lambda_cable?
|
data/lib/lamby/runner.rb
CHANGED
@@ -5,17 +5,16 @@ module Lamby
|
|
5
5
|
class Error < StandardError ; end
|
6
6
|
class UnknownCommandPattern < Error ; end
|
7
7
|
|
8
|
-
PATTERNS = [
|
9
|
-
%r{\A\./bin/(rails|rake) db:migrate.*}
|
10
|
-
]
|
8
|
+
PATTERNS = [%r{.*}]
|
11
9
|
|
12
10
|
class << self
|
13
11
|
|
14
12
|
def handle?(event)
|
15
|
-
event.dig
|
13
|
+
event.dig('x-lambda-console', 'runner') ||
|
14
|
+
event.dig('lamby', 'runner')
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
17
|
+
def cmd(event:, context:)
|
19
18
|
new(event).call
|
20
19
|
end
|
21
20
|
|
@@ -34,11 +33,12 @@ module Lamby
|
|
34
33
|
puts @body
|
35
34
|
thread.value.exitstatus
|
36
35
|
end
|
37
|
-
|
36
|
+
{ statusCode: status, headers: {}, body: @body }
|
38
37
|
end
|
39
38
|
|
40
39
|
def command
|
41
|
-
@event.dig
|
40
|
+
@event.dig('x-lambda-console', 'runner') ||
|
41
|
+
@event.dig('lamby', 'runner')
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
data/lib/lamby/version.rb
CHANGED
data/lib/lamby.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- images/social2.png
|
164
164
|
- lamby.gemspec
|
165
165
|
- lib/lamby.rb
|
166
|
+
- lib/lamby/command.rb
|
166
167
|
- lib/lamby/config.rb
|
167
168
|
- lib/lamby/debug.rb
|
168
169
|
- lib/lamby/handler.rb
|
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
199
|
- !ruby/object:Gem::Version
|
199
200
|
version: '0'
|
200
201
|
requirements: []
|
201
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.4.6
|
202
203
|
signing_key:
|
203
204
|
specification_version: 4
|
204
205
|
summary: Simple Rails & AWS Lambda Integration using Rack
|