lamby 3.1.3 → 4.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +1 -0
  3. data/.devcontainer/devcontainer.json +20 -0
  4. data/.github/workflows/test.yml +25 -0
  5. data/CHANGELOG.md +19 -2
  6. data/Gemfile.lock +106 -101
  7. data/README.md +10 -7
  8. data/bin/bootstrap +1 -4
  9. data/bin/setup +4 -4
  10. data/bin/test +4 -4
  11. data/bin/update +1 -3
  12. data/images/social.png +0 -0
  13. data/images/social2.png +0 -0
  14. data/lib/lamby/config.rb +9 -0
  15. data/lib/lamby/debug.rb +0 -6
  16. data/lib/lamby/logger.rb +3 -12
  17. data/lib/lamby/rack.rb +0 -3
  18. data/lib/lamby/railtie.rb +1 -6
  19. data/lib/lamby/version.rb +1 -1
  20. data/lib/lamby.rb +4 -1
  21. metadata +9 -41
  22. data/.github/workflows/cicd.yml +0 -17
  23. data/.ruby-version +0 -1
  24. data/Dockerfile +0 -7
  25. data/bin/_setup +0 -7
  26. data/bin/_test +0 -8
  27. data/docker-compose.yml +0 -15
  28. data/lib/lamby/sam_helpers.rb +0 -9
  29. data/lib/lamby/tasks.rake +0 -15
  30. data/lib/lamby/templates/alb/Dockerfile +0 -15
  31. data/lib/lamby/templates/alb/Dockerfile-build +0 -18
  32. data/lib/lamby/templates/alb/_build +0 -25
  33. data/lib/lamby/templates/alb/_deploy +0 -31
  34. data/lib/lamby/templates/alb/app.rb +0 -12
  35. data/lib/lamby/templates/alb/deploy +0 -8
  36. data/lib/lamby/templates/alb/docker-compose.yml +0 -19
  37. data/lib/lamby/templates/alb/template.yaml +0 -90
  38. data/lib/lamby/templates/alb.rb +0 -33
  39. data/lib/lamby/templates/http/Dockerfile +0 -15
  40. data/lib/lamby/templates/http/Dockerfile-build +0 -18
  41. data/lib/lamby/templates/http/_build +0 -25
  42. data/lib/lamby/templates/http/_deploy +0 -31
  43. data/lib/lamby/templates/http/app.rb +0 -12
  44. data/lib/lamby/templates/http/deploy +0 -8
  45. data/lib/lamby/templates/http/docker-compose.yml +0 -19
  46. data/lib/lamby/templates/http/template.yaml +0 -48
  47. data/lib/lamby/templates/http.rb +0 -33
  48. data/lib/lamby/templates/rest/Dockerfile +0 -15
  49. data/lib/lamby/templates/rest/Dockerfile-build +0 -18
  50. data/lib/lamby/templates/rest/_build +0 -25
  51. data/lib/lamby/templates/rest/_deploy +0 -31
  52. data/lib/lamby/templates/rest/app.rb +0 -12
  53. data/lib/lamby/templates/rest/deploy +0 -8
  54. data/lib/lamby/templates/rest/docker-compose.yml +0 -19
  55. data/lib/lamby/templates/rest/template.yaml +0 -84
  56. data/lib/lamby/templates/rest.rb +0 -33
  57. data/lib/lamby/templates/shared.rb +0 -17
  58. data/lib/lamby/templates.rake +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d89d9ea207eee94cb34a61940b9dd179f833fc55048042216b9c6826917745f3
4
- data.tar.gz: 8478cd0f8ec72d9415cc7479a5505405aa00c97d7d5558da90953abb47be343e
3
+ metadata.gz: 6913fa1d06b5a645efedec776e518aadb491a154c9c9e9bae771531eec8ebd3a
4
+ data.tar.gz: fc5d7856fe0239fa333b816e1f87b88fc4fb4778d6a68011334ce32618eacd77
5
5
  SHA512:
6
- metadata.gz: c04af144338ef19c3fc1e4c1b8d83a696ac0d9942665043807b9f8469baa23ddc581b4604c250cd8cbfca2bbf0fc65e0bbef810b50bb4450c417cf141965ff09
7
- data.tar.gz: e054a63c87e499da9cc19c5166f48f96775496d331c6f06f69647f403521da7de039aed50304d86783063744fe5a9698385a3b1409a8226d6caa17e1be8c9c65
6
+ metadata.gz: ee3a4ed2a996e964aca8bc18f48b74f7d7f0a984f038b1cd69543c4426efb2ee4f16de9b4a872b66fac22d297fc47129c067f17e7f04f9ebde49abc5925ac810
7
+ data.tar.gz: 470bd76ebf4547411882b830c5c6edf705fc044de93e56021e5f92c93c4c234f84e124ae375b33ff5318b7d2623d1b0e88a92d42f6e175da8cc17b6dbe665475
@@ -0,0 +1 @@
1
+ FROM mcr.microsoft.com/devcontainers/ruby:3.1
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "lamby",
3
+ "build": {
4
+ "dockerfile": "Dockerfile"
5
+ },
6
+ "features": {
7
+ "ghcr.io/devcontainers/features/node:latest": {},
8
+ "ghcr.io/devcontainers/features/docker-in-docker:latest": {},
9
+ "ghcr.io/devcontainers/features/sshd:latest": {}
10
+ },
11
+ "customizations": {
12
+ "vscode": {
13
+ "settings": {
14
+ "editor.formatOnSave": true
15
+ },
16
+ "extensions": []
17
+ }
18
+ },
19
+ "remoteUser": "vscode"
20
+ }
@@ -0,0 +1,25 @@
1
+ name: CI/CD
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - name: Checkout
8
+ uses: actions/checkout@v2
9
+ - name: Login to GitHub Container Registry
10
+ uses: docker/login-action@v2
11
+ with:
12
+ registry: ghcr.io
13
+ username: ${{ github.repository_owner }}
14
+ password: ${{ secrets.GITHUB_TOKEN }}
15
+ - name: Build & Run Development Container
16
+ uses: devcontainers/ci@v0.2
17
+ with:
18
+ push: always
19
+ imageName: ghcr.io/customink/lamby-devcontainer
20
+ cacheFrom: ghcr.io/customink/lamby-devcontainer
21
+ env: |
22
+ CI
23
+ runCmd: |
24
+ ./bin/setup
25
+ ./bin/test
data/CHANGELOG.md CHANGED
@@ -1,9 +1,26 @@
1
- <!-- -*- mode: markdown -*- -->
2
-
3
1
  # Keep A Changelog!
4
2
 
5
3
  See this http://keepachangelog.com link for information on how we want this documented formatted.
6
4
 
5
+ ## v4.0.0 (unreleased)
6
+
7
+ ### Added
8
+
9
+ - New `Lamby.config.app` with default Rack builder.
10
+ - The `Lamby.command` to simplify `CMD` with the new config.app from above.
11
+
12
+ #### Removed
13
+
14
+ - All lamby installer templates.
15
+ - Remove SAM env checks used during debug mode.
16
+ - Removed showing environment variables in debug mode.
17
+ - Need to `require: false` when adding the Lamby gem to your `Gemfile`.
18
+ - Dotenv integration. Use [Crypteia](https://github.com/customink/crypteia) now.
19
+
20
+ #### Changed
21
+
22
+ - Tested Rack 3.x.
23
+
7
24
  ## v3.1.3
8
25
 
9
26
  #### Fixed
data/Gemfile.lock CHANGED
@@ -1,171 +1,176 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamby (3.1.2)
4
+ lamby (4.0.0.beta1)
5
5
  rack
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (6.1.3.1)
11
- actionpack (= 6.1.3.1)
12
- activesupport (= 6.1.3.1)
10
+ actioncable (7.0.4)
11
+ actionpack (= 7.0.4)
12
+ activesupport (= 7.0.4)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.3.1)
16
- actionpack (= 6.1.3.1)
17
- activejob (= 6.1.3.1)
18
- activerecord (= 6.1.3.1)
19
- activestorage (= 6.1.3.1)
20
- activesupport (= 6.1.3.1)
15
+ actionmailbox (7.0.4)
16
+ actionpack (= 7.0.4)
17
+ activejob (= 7.0.4)
18
+ activerecord (= 7.0.4)
19
+ activestorage (= 7.0.4)
20
+ activesupport (= 7.0.4)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.1.3.1)
23
- actionpack (= 6.1.3.1)
24
- actionview (= 6.1.3.1)
25
- activejob (= 6.1.3.1)
26
- activesupport (= 6.1.3.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.4)
26
+ actionpack (= 7.0.4)
27
+ actionview (= 7.0.4)
28
+ activejob (= 7.0.4)
29
+ activesupport (= 7.0.4)
27
30
  mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
28
34
  rails-dom-testing (~> 2.0)
29
- actionpack (6.1.3.1)
30
- actionview (= 6.1.3.1)
31
- activesupport (= 6.1.3.1)
32
- rack (~> 2.0, >= 2.0.9)
35
+ actionpack (7.0.4)
36
+ actionview (= 7.0.4)
37
+ activesupport (= 7.0.4)
38
+ rack (~> 2.0, >= 2.2.0)
33
39
  rack-test (>= 0.6.3)
34
40
  rails-dom-testing (~> 2.0)
35
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.3.1)
37
- actionpack (= 6.1.3.1)
38
- activerecord (= 6.1.3.1)
39
- activestorage (= 6.1.3.1)
40
- activesupport (= 6.1.3.1)
42
+ actiontext (7.0.4)
43
+ actionpack (= 7.0.4)
44
+ activerecord (= 7.0.4)
45
+ activestorage (= 7.0.4)
46
+ activesupport (= 7.0.4)
47
+ globalid (>= 0.6.0)
41
48
  nokogiri (>= 1.8.5)
42
- actionview (6.1.3.1)
43
- activesupport (= 6.1.3.1)
49
+ actionview (7.0.4)
50
+ activesupport (= 7.0.4)
44
51
  builder (~> 3.1)
45
52
  erubi (~> 1.4)
46
53
  rails-dom-testing (~> 2.0)
47
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.3.1)
49
- activesupport (= 6.1.3.1)
55
+ activejob (7.0.4)
56
+ activesupport (= 7.0.4)
50
57
  globalid (>= 0.3.6)
51
- activemodel (6.1.3.1)
52
- activesupport (= 6.1.3.1)
53
- activerecord (6.1.3.1)
54
- activemodel (= 6.1.3.1)
55
- activesupport (= 6.1.3.1)
56
- activestorage (6.1.3.1)
57
- actionpack (= 6.1.3.1)
58
- activejob (= 6.1.3.1)
59
- activerecord (= 6.1.3.1)
60
- activesupport (= 6.1.3.1)
61
- marcel (~> 1.0.0)
62
- mini_mime (~> 1.0.2)
63
- activesupport (6.1.3.1)
58
+ activemodel (7.0.4)
59
+ activesupport (= 7.0.4)
60
+ activerecord (7.0.4)
61
+ activemodel (= 7.0.4)
62
+ activesupport (= 7.0.4)
63
+ activestorage (7.0.4)
64
+ actionpack (= 7.0.4)
65
+ activejob (= 7.0.4)
66
+ activerecord (= 7.0.4)
67
+ activesupport (= 7.0.4)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.4)
64
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
72
  i18n (>= 1.6, < 2)
66
73
  minitest (>= 5.1)
67
74
  tzinfo (~> 2.0)
68
- zeitwerk (~> 2.3)
69
75
  aws-eventstream (1.2.0)
70
- aws-partitions (1.570.0)
71
- aws-sdk-core (3.130.0)
76
+ aws-partitions (1.660.0)
77
+ aws-sdk-core (3.167.0)
72
78
  aws-eventstream (~> 1, >= 1.0.2)
73
- aws-partitions (~> 1, >= 1.525.0)
79
+ aws-partitions (~> 1, >= 1.651.0)
80
+ aws-sigv4 (~> 1.5)
81
+ jmespath (~> 1, >= 1.6.1)
82
+ aws-sdk-sqs (1.52.0)
83
+ aws-sdk-core (~> 3, >= 3.165.0)
74
84
  aws-sigv4 (~> 1.1)
75
- jmespath (~> 1.0)
76
- aws-sdk-sqs (1.51.0)
77
- aws-sdk-core (~> 3, >= 3.127.0)
85
+ aws-sdk-ssm (1.144.0)
86
+ aws-sdk-core (~> 3, >= 3.165.0)
78
87
  aws-sigv4 (~> 1.1)
79
- aws-sdk-ssm (1.108.0)
80
- aws-sdk-core (~> 3, >= 3.112.0)
81
- aws-sigv4 (~> 1.1)
82
- aws-sigv4 (1.4.0)
88
+ aws-sigv4 (1.5.2)
83
89
  aws-eventstream (~> 1, >= 1.0.2)
84
90
  builder (3.2.4)
85
91
  coderay (1.1.3)
86
92
  concurrent-ruby (1.1.10)
87
93
  crass (1.0.6)
88
- erubi (1.10.0)
94
+ erubi (1.11.0)
89
95
  globalid (1.0.0)
90
96
  activesupport (>= 5.0)
91
- i18n (1.10.0)
97
+ i18n (1.12.0)
92
98
  concurrent-ruby (~> 1.0)
93
99
  jmespath (1.6.1)
94
- lambdakiq (2.0.0)
100
+ lambdakiq (2.1.0)
95
101
  activejob
96
102
  aws-sdk-sqs
97
103
  concurrent-ruby
98
104
  railties
99
- loofah (2.15.0)
105
+ loofah (2.19.0)
100
106
  crass (~> 1.0.2)
101
107
  nokogiri (>= 1.5.9)
102
108
  mail (2.7.1)
103
109
  mini_mime (>= 0.1.1)
104
- marcel (1.0.1)
110
+ marcel (1.0.2)
105
111
  method_source (1.0.0)
106
- mini_mime (1.0.3)
107
- mini_portile2 (2.8.0)
108
- minitest (5.15.0)
109
- minitest-focus (1.2.1)
112
+ mini_mime (1.1.2)
113
+ minitest (5.16.3)
114
+ minitest-focus (1.3.1)
110
115
  minitest (>= 4, < 6)
111
- mocha (1.12.0)
112
- nio4r (2.5.7)
113
- nokogiri (1.13.3)
114
- mini_portile2 (~> 2.8.0)
115
- racc (~> 1.4)
116
- nokogiri (1.13.3-x86_64-linux)
116
+ mocha (2.0.2)
117
+ ruby2_keywords (>= 0.0.5)
118
+ net-imap (0.3.1)
119
+ net-protocol
120
+ net-pop (0.1.2)
121
+ net-protocol
122
+ net-protocol (0.1.3)
123
+ timeout
124
+ net-smtp (0.3.3)
125
+ net-protocol
126
+ nio4r (2.5.8)
127
+ nokogiri (1.13.9-x86_64-linux)
117
128
  racc (~> 1.4)
118
129
  pry (0.14.1)
119
130
  coderay (~> 1.1)
120
131
  method_source (~> 1.0)
121
132
  racc (1.6.0)
122
- rack (2.2.3)
123
- rack-test (1.1.0)
124
- rack (>= 1.0, < 3)
125
- rails (6.1.3.1)
126
- actioncable (= 6.1.3.1)
127
- actionmailbox (= 6.1.3.1)
128
- actionmailer (= 6.1.3.1)
129
- actionpack (= 6.1.3.1)
130
- actiontext (= 6.1.3.1)
131
- actionview (= 6.1.3.1)
132
- activejob (= 6.1.3.1)
133
- activemodel (= 6.1.3.1)
134
- activerecord (= 6.1.3.1)
135
- activestorage (= 6.1.3.1)
136
- activesupport (= 6.1.3.1)
133
+ rack (2.2.4)
134
+ rack-test (2.0.2)
135
+ rack (>= 1.3)
136
+ rails (7.0.4)
137
+ actioncable (= 7.0.4)
138
+ actionmailbox (= 7.0.4)
139
+ actionmailer (= 7.0.4)
140
+ actionpack (= 7.0.4)
141
+ actiontext (= 7.0.4)
142
+ actionview (= 7.0.4)
143
+ activejob (= 7.0.4)
144
+ activemodel (= 7.0.4)
145
+ activerecord (= 7.0.4)
146
+ activestorage (= 7.0.4)
147
+ activesupport (= 7.0.4)
137
148
  bundler (>= 1.15.0)
138
- railties (= 6.1.3.1)
139
- sprockets-rails (>= 2.0.0)
149
+ railties (= 7.0.4)
140
150
  rails-dom-testing (2.0.3)
141
151
  activesupport (>= 4.2.0)
142
152
  nokogiri (>= 1.6)
143
- rails-html-sanitizer (1.4.2)
153
+ rails-html-sanitizer (1.4.3)
144
154
  loofah (~> 2.3)
145
- railties (6.1.3.1)
146
- actionpack (= 6.1.3.1)
147
- activesupport (= 6.1.3.1)
155
+ railties (7.0.4)
156
+ actionpack (= 7.0.4)
157
+ activesupport (= 7.0.4)
148
158
  method_source
149
- rake (>= 0.8.7)
159
+ rake (>= 12.2)
150
160
  thor (~> 1.0)
161
+ zeitwerk (~> 2.5)
151
162
  rake (13.0.6)
152
- sprockets (4.0.2)
153
- concurrent-ruby (~> 1.0)
154
- rack (> 1, < 3)
155
- sprockets-rails (3.2.2)
156
- actionpack (>= 4.0)
157
- activesupport (>= 4.0)
158
- sprockets (>= 3.0.0)
163
+ ruby2_keywords (0.0.5)
159
164
  thor (1.2.1)
160
- tzinfo (2.0.4)
165
+ timeout (0.3.0)
166
+ tzinfo (2.0.5)
161
167
  concurrent-ruby (~> 1.0)
162
- websocket-driver (0.7.3)
168
+ websocket-driver (0.7.5)
163
169
  websocket-extensions (>= 0.1.0)
164
170
  websocket-extensions (0.1.5)
165
- zeitwerk (2.5.4)
171
+ zeitwerk (2.6.6)
166
172
 
167
173
  PLATFORMS
168
- ruby
169
174
  x86_64-linux
170
175
 
171
176
  DEPENDENCIES
@@ -181,4 +186,4 @@ DEPENDENCIES
181
186
  rake
182
187
 
183
188
  BUNDLED WITH
184
- 2.2.22
189
+ 2.3.7
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Lamby [![Actions Status](https://github.com/customink/lamby/workflows/CI/CD/badge.svg)](https://github.com/customink/lamby/actions)
1
+ # Lamby [![Actions Status](https://github.com/customink/lamby/workflows/CI/CD/badge.svg)](https://github.com/customink/lamby/actions) [![Codespaces](https://img.shields.io/badge/Codespaces-✅-black)](https://github.com/features/codespaces)
2
2
 
3
- <h2>Simple Rails &amp; AWS Lambda Integration</h2>
3
+ <h2>Simple Rails &amp; AWS Lambda Integration using Rack</h2>
4
4
 
5
- <img src="https://user-images.githubusercontent.com/2381/59363668-89edeb80-8d03-11e9-9985-2ce14361b7e3.png" alt="Lamby: Simple Rails & AWS Lambda Integration" align="right" />
5
+ Lamby is an [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) for Rack applications.
6
6
 
7
- <p>&nbsp;</p>
7
+ <img src="https://raw.githubusercontent.com/customink/lamby_site/master/app/assets/images/lamby-arch-hero.png" alt="Lamby: Simple Rails & AWS Lambda Integration"/>
8
8
 
9
9
  The goal of this project is to provide minimal code to allow your Rails application to respond to incoming [AWS Lambda Function Handler in Ruby](https://docs.aws.amazon.com/lambda/latest/dg/ruby-handler.html) `event` and `context` objects in the Lambda handler. We support Application Load Balancer integration or API Gateway.
10
10
 
@@ -24,16 +24,19 @@ https://lamby.custominktech.com/docs/installing_aws_sam
24
24
 
25
25
  ## Contributing
26
26
 
27
- After checking out the repo, run:
27
+ This project is built for [GitHub Codespcaes](https://github.com/features/codespaces) using the [Development Container](https://containers.dev) specification. Once you have the repo cloned and setup with a dev container using either Codespaces or [VS Code](#using-vs-code), run the following commands. This will install packages and run tests.
28
28
 
29
29
  ```shell
30
- $ ./bin/bootstrap
31
30
  $ ./bin/setup
32
31
  $ ./bin/test
33
32
  ```
34
33
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/customink/lamby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+ #### Using VS Code
35
+
36
+ If you have the [Visual Studio Code Dev Container](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed you can easily clone this repo locally, use the "Open Folder in Container..." command. This allows you to use the integrated terminal for the commands above.
36
37
 
37
38
  ## Code of Conduct
38
39
 
39
40
  Everyone interacting in the Lamby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/customink/lamby/blob/master/CODE_OF_CONDUCT.md).
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/customink/lamby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/bin/bootstrap CHANGED
@@ -1,5 +1,2 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
-
4
- echo '== Building containers =='
5
- docker-compose build
data/bin/setup CHANGED
@@ -1,6 +1,6 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
3
 
4
- docker-compose run \
5
- cicd \
6
- ./bin/_setup
4
+ echo '== Installing dependencies =='
5
+ bundle config set --local path 'vendor/bundle'
6
+ bundle install
data/bin/test CHANGED
@@ -1,8 +1,8 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  set -e
3
3
 
4
4
  export RAILS_ENV="test"
5
5
 
6
- docker-compose run \
7
- cicd \
8
- ./bin/_test
6
+ bundle exec rake test
7
+ LAMBY_TEST_DYNAMIC_HANDLER=1 bundle exec rake test
8
+ LAMBY_RACK_DEFLATE_ENABLED=1 bundle exec rake test_deflate
data/bin/update CHANGED
@@ -1,7 +1,5 @@
1
- #!/usr/bin/env bash
2
-
1
+ #!/bin/sh
3
2
  set -e
4
3
 
5
4
  rm -rf ./vendor/bundle
6
-
7
5
  ./bin/setup
data/images/social.png ADDED
Binary file
Binary file
data/lib/lamby/config.rb CHANGED
@@ -31,7 +31,16 @@ module Lamby
31
31
  self
32
32
  end
33
33
 
34
+ def rack_app
35
+ @rack_app ||= Rack::Builder.new { run Rails.application }.to_app
36
+ end
37
+
38
+ def rack_app=(app)
39
+ @rack_app = app
40
+ end
41
+
34
42
  def initialize_defaults
43
+ @rack_app = nil
35
44
  @event_bridge_handler = lambda { |event, context| puts(event) }
36
45
  end
37
46
 
data/lib/lamby/debug.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module Lamby
2
2
  module Debug
3
- include Lamby::SamHelpers
4
-
5
3
  extend self
6
4
 
7
5
  def on?(event)
@@ -33,10 +31,6 @@ module Lamby
33
31
  <code>
34
32
  #{CGI::escapeHTML(context.inspect)}
35
33
  </code>
36
- <h2>Environment</h2>
37
- <pre>
38
- #{sam_local? ? JSON.pretty_generate(ENV.to_h) : 'N/A'}
39
- </pre>
40
34
  </body>
41
35
  </html>
42
36
  HTML
data/lib/lamby/logger.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  require 'logger'
2
2
 
3
- unless ENV['LAMBY_TEST']
4
-
5
- ENV['RAILS_LOG_TO_STDOUT'] = '1'
3
+ if ENV['AWS_EXECUTION_ENV']
4
+ ENV['RAILS_LOG_TO_STDOUT'] = '1'
6
5
 
7
6
  module Lamby
8
7
  module Logger
@@ -15,13 +14,5 @@ unless ENV['LAMBY_TEST']
15
14
  end
16
15
  end
17
16
 
18
- Logger.prepend Lamby::Logger
19
-
17
+ Logger.prepend Lamby::Logger unless ENV['LAMBY_TEST']
20
18
  end
21
-
22
- # TODO: Railtie initializer
23
- # Rails.application.config.logger = ActiveSupport::TaggedLogging.new(
24
- # ActiveSupport::Logger.new(STDOUT).tap { |logger|
25
- # logger.formatter = Rails.application.config.log_formatter
26
- # }
27
- # )
data/lib/lamby/rack.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  module Lamby
2
2
  class Rack
3
-
4
- include SamHelpers
5
-
6
3
  LAMBDA_EVENT = 'lambda.event'.freeze
7
4
  LAMBDA_CONTEXT = 'lambda.context'.freeze
8
5
  HTTP_X_REQUESTID = 'HTTP_X_REQUEST_ID'.freeze
data/lib/lamby/railtie.rb CHANGED
@@ -1,10 +1,5 @@
1
1
  module Lamby
2
2
  class Railtie < ::Rails::Railtie
3
-
4
- rake_tasks do
5
- load 'lamby/tasks.rake'
6
- load 'lamby/templates.rake'
7
- end
8
-
3
+ config.lamby = Lamby::Config.config
9
4
  end
10
5
  end
data/lib/lamby/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lamby
2
- VERSION = '3.1.3'
2
+ VERSION = '4.0.0.beta1'
3
3
  end
data/lib/lamby.rb CHANGED
@@ -3,7 +3,6 @@ require 'rack'
3
3
  require 'base64'
4
4
  require 'lamby/version'
5
5
  require 'lamby/config'
6
- require 'lamby/sam_helpers'
7
6
  require 'lamby/rack'
8
7
  require 'lamby/rack_alb'
9
8
  require 'lamby/rack_rest'
@@ -21,6 +20,10 @@ module Lamby
21
20
 
22
21
  extend self
23
22
 
23
+ def command(event, context)
24
+ handler.new(config.app, event, context)
25
+ end
26
+
24
27
  def handler(app, event, context, options = {})
25
28
  Handler.call(app, event, context, options)
26
29
  end