lamby 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36672ad378e1e075df3ea97c48960dc48eaf69ef133bd73f52a8ba667689b909
4
- data.tar.gz: 4617ec443a807af7994cb1c30c3780de4785ae14fd9aae8fa21a07f38284eea1
3
+ metadata.gz: 1ee1d66c80f81d7cc0caa58bd4eeee0d107c6fe02e29228281a5fdcc231f808f
4
+ data.tar.gz: ca0ce61dab155c561c94547569e680b27c5a4fc36150f739290fdc91da1d9b42
5
5
  SHA512:
6
- metadata.gz: 624dca929cc78ffa686b784a3dbca0817547092e8ecaa3878b973c6e32960a8e980e9544f463f9ecbb00e525fd9dd7943d7013f6f2ef0f7e32db9a58c7f66dab
7
- data.tar.gz: 5c6e012bf74e0a7b3579d70fed1327f7e331d8a3b49b8efeb1e7a9c8e98e20a927be3463be3f775dbdf361dbc51584bcc1a240b38be0518c9f751e8f7a0119a6
6
+ metadata.gz: ccec86a4dc162eaab7bb8dcf7629a7aec1d8b6d04ad1e32a6f10f41cca63054172c8a5dc1a046d871b0308a5b788a9a12933c5c524cc155fbf1101ee52df9aef
7
+ data.tar.gz: 5c85d4254987888fc1f53605f6f16dcaa3aaa306fbcdff6444b63cb399216e8decca1363a4309b7603a0073b3ab18c2b8ad397c2aa03fd611c4ac121e3ad8015
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  See this http://keepachangelog.com link for information on how we want this documented formatted.
4
4
 
5
+ ## v4.3.0
6
+
7
+ ### Changed
8
+
9
+ - Default Lamby::Runner::PATTERNS to allow everything.
10
+
11
+ ### Added
12
+
13
+ - New Lamby::Command for IRB style top level binding evals.
14
+
5
15
  ## v4.2.1
6
16
 
7
17
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamby (4.2.1)
4
+ lamby (4.3.0)
5
5
  rack
6
6
 
7
7
  GEM
@@ -0,0 +1,42 @@
1
+ module Lamby
2
+ class Command
3
+
4
+ class << self
5
+
6
+ def handle?(event)
7
+ event.dig 'lamby', 'command'
8
+ end
9
+
10
+ def cmd(event:, context:)
11
+ new(event).call
12
+ end
13
+
14
+ end
15
+
16
+ def initialize(event)
17
+ @event = event
18
+ @body = ''
19
+ end
20
+
21
+ def call
22
+ begin
23
+ body = eval(command, TOPLEVEL_BINDING).to_s
24
+ body = body.inspect if body =~ /\A"/ && body =~ /"\z/
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 'lamby', 'command'
39
+ end
40
+
41
+ end
42
+ 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
- @status, @headers, @body = Runner.call(@event)
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,9 +5,7 @@ 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
 
@@ -15,7 +13,7 @@ module Lamby
15
13
  event.dig 'lamby', 'runner'
16
14
  end
17
15
 
18
- def call(event)
16
+ def cmd(event:, context:)
19
17
  new(event).call
20
18
  end
21
19
 
@@ -34,7 +32,7 @@ module Lamby
34
32
  puts @body
35
33
  thread.value.exitstatus
36
34
  end
37
- [status, {}, StringIO.new(@body)]
35
+ { statusCode: status, headers: {}, body: @body }
38
36
  end
39
37
 
40
38
  def command
data/lib/lamby/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lamby
2
- VERSION = '4.2.1'
2
+ VERSION = '4.3.0'
3
3
  end
data/lib/lamby.rb CHANGED
@@ -9,6 +9,7 @@ require 'lamby/rack_rest'
9
9
  require 'lamby/rack_http'
10
10
  require 'lamby/debug'
11
11
  require 'lamby/runner'
12
+ require 'lamby/command'
12
13
  require 'lamby/handler'
13
14
 
14
15
  if defined?(Rails)
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.2.1
4
+ version: 4.3.0
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 00:00:00.000000000 Z
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.3.26
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