lamby 1.0.2 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/cicd.yml +17 -0
  3. data/.gitignore +1 -1
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +58 -0
  6. data/Dockerfile +12 -0
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +83 -84
  9. data/README.md +9 -3
  10. data/Rakefile +1 -0
  11. data/bin/_setup +6 -0
  12. data/bin/_test +6 -0
  13. data/bin/bootstrap +3 -17
  14. data/bin/setup +3 -3
  15. data/bin/test +6 -3
  16. data/bin/update +2 -2
  17. data/docker-compose.yml +14 -0
  18. data/lamby.gemspec +1 -2
  19. data/lib/lamby.rb +7 -4
  20. data/lib/lamby/debug.rb +8 -1
  21. data/lib/lamby/handler.rb +16 -3
  22. data/lib/lamby/logger.rb +13 -9
  23. data/lib/lamby/rack.rb +21 -9
  24. data/lib/lamby/rack_alb.rb +12 -15
  25. data/lib/lamby/rack_http.rb +84 -0
  26. data/lib/lamby/{rack_api.rb → rack_rest.rb} +7 -3
  27. data/lib/lamby/ssm_parameter_store.rb +8 -7
  28. data/lib/lamby/templates.rake +4 -3
  29. data/lib/lamby/templates/{application_load_balancer.rb → alb.rb} +2 -2
  30. data/lib/lamby/templates/{application_load_balancer → alb}/app.rb +0 -0
  31. data/lib/lamby/templates/{application_load_balancer → alb}/build +1 -1
  32. data/lib/lamby/templates/{application_load_balancer → alb}/deploy +1 -1
  33. data/lib/lamby/templates/{application_load_balancer → alb}/template.yaml +1 -1
  34. data/lib/lamby/templates/{api_gateway.rb → http.rb} +3 -3
  35. data/lib/lamby/templates/{api_gateway → http}/app.rb +1 -1
  36. data/lib/lamby/templates/{api_gateway → http}/build +1 -1
  37. data/lib/lamby/templates/{api_gateway → http}/deploy +1 -1
  38. data/lib/lamby/templates/http/template.yaml +48 -0
  39. data/lib/lamby/templates/rest.rb +25 -0
  40. data/lib/lamby/templates/rest/app.rb +10 -0
  41. data/lib/lamby/templates/rest/build +23 -0
  42. data/lib/lamby/templates/rest/deploy +22 -0
  43. data/lib/lamby/templates/{api_gateway → rest}/template.yaml +2 -2
  44. data/lib/lamby/templates/shared.rb +3 -1
  45. data/lib/lamby/version.rb +1 -1
  46. data/vendor/.keep +0 -0
  47. metadata +29 -37
  48. data/.python-version +0 -1
  49. data/.travis.yml +0 -17
  50. data/Brewfile +0 -5
  51. data/Pipfile +0 -13
  52. data/Pipfile.lock +0 -370
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca2f5b0087440de0f6a7383ac642061e199428271981d61dcbd7f2800853faec
4
- data.tar.gz: 1ad5ba4ef2a7c8275d221ec9569424875d19586778f1ac042f62614f770780a9
3
+ metadata.gz: 76c0182c6acf69bd8342ddd73b09e793684f3b12da095f212637ced6cabed916
4
+ data.tar.gz: 9718fcac74658d3979572e65dfe55a26c123bc606afd868bab808622bdef13a2
5
5
  SHA512:
6
- metadata.gz: 9cfae4fad3a68553311974a8bb8a93208f9c4f20739cbdaa880d79d3967a65d49ebe01f1080214e2d111016614da399453fb68f30492697dd875ee5d283afe47
7
- data.tar.gz: 0c7ef072c05009db700629b81ebc6d77e7f5785e63b6d927217eccb2b3b597d7f7e284a9901104c5d71d7ea39524bba557eb1fa53302ac97be8660a6decd747d
6
+ metadata.gz: 5c8240b4a45558396837cfd78b12e7528ab7441e4a4d9b69b8cab0ed90b8c13074cc8ba504827ef4f08aa8847283334b89b37e775d7c820edd636c7807a0c171
7
+ data.tar.gz: 4be0113b2ff936cd3e9e90cb641d685e45ad93c7a02c4c5cc6a5f24adc8ee8685599c0df4db1be9770b57f4d3d450a574b376fe1815e044b2086babd4b797851
@@ -0,0 +1,17 @@
1
+ name: CI/CD
2
+ on: [push]
3
+ jobs:
4
+ cicd:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - name: Checkout
8
+ uses: actions/checkout@v1
9
+ - name: Bootstrap
10
+ run: |
11
+ ./bin/bootstrap
12
+ - name: Setup
13
+ run: |
14
+ ./bin/setup
15
+ - name: Test
16
+ run: |
17
+ ./bin/test
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  /pkg/
6
6
  /spec/reports/
7
7
  /tmp/
8
+ /vendor/bundle
8
9
  test/dummy_app/.gitignore
9
10
  test/dummy_app/app.rb
10
11
  test/dummy_app/template.yaml
@@ -12,4 +13,3 @@ test/dummy_app/bin/build
12
13
  test/dummy_app/bin/deploy
13
14
  test/dummy_app/tmp
14
15
  test/dummy_app/log/**/*
15
- test/dummy_app/public/**/*
@@ -1 +1 @@
1
- 2.5.5
1
+ 2.7.0
@@ -1,7 +1,65 @@
1
+ <!-- -*- mode: markdown -*- -->
1
2
  # Keep A Changelog!
2
3
 
3
4
  See this http://keepachangelog.com link for information on how we want this documented formatted.
4
5
 
6
+ ## v2.2.1
7
+
8
+ #### Changed
9
+
10
+ * More ActiveSupport removal from SsmParameterStore.
11
+
12
+ ## v2.2.0
13
+
14
+ #### Changed
15
+
16
+ * Remove dependency on `activesupport` for rack-only applications.
17
+ * Remove ActiveSupport artifacts:
18
+ - Replace `strip_heredoc` with `<<~HEREDOC`.
19
+ - Remove instances of `Object#try`, replace with `&.`.
20
+ - Use `Rack::Utils.build_nested_query` in place of `Object#to_query`.
21
+ - Replace `Object#present?` with `to_s.empty?`.
22
+ - Replace `Array.wrap` with `Array[obj].compact.flatten`.
23
+ * Add a check against the `RAILS_ENV` AND `RACK_ENV` environment
24
+ variables prior to enabling debug mode.
25
+
26
+ ## v2.1.0
27
+
28
+ #### Changed
29
+
30
+ * Only load the railtie if `Rails` is defined.
31
+
32
+ ## v2.0.1
33
+
34
+ #### Changed
35
+
36
+ * Remove Rails runtime dep. Only rack is needed.
37
+
38
+ ## v2.0.0
39
+
40
+ Support for new API Gateway HTTP APIs!!!
41
+
42
+ #### Changed
43
+
44
+ * The `Lamby.handler` must have a `:rack` option. One of `:http`, `:rest`, `:alb`.
45
+ * Renamed template generators to match options above.
46
+ * The `lamby:install` task now defaults to HTTP API.
47
+ * Changed the name of `:api` rack option to `:rest`.
48
+ * Removed `export` from Dotenv files. Better Docker compatability.
49
+
50
+ #### Added
51
+
52
+ * New rack handler for HTTP API v1 and v2.
53
+ * Lots of backfill tests for, ALBs & REST APIs.
54
+
55
+
56
+ ## v1.0.3
57
+
58
+ #### Changed
59
+
60
+ * Change shebangs to `#!/usr/bin/env bash`
61
+
62
+
5
63
  ## v1.0.2
6
64
 
7
65
  #### Changed
@@ -0,0 +1,12 @@
1
+ FROM lambci/lambda:build-ruby2.7
2
+
3
+ # Lock down AWS SAM version.
4
+ RUN pip install awscli && \
5
+ pip uninstall --yes aws-sam-cli && \
6
+ pip install aws-sam-cli==0.45.0
7
+
8
+ # Asset Pipeline
9
+ RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - && \
10
+ yum install -y nodejs
11
+
12
+ WORKDIR /var/task
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
3
  gemspec
4
+
5
+ gem 'rails'
@@ -1,141 +1,140 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lamby (1.0.2)
4
+ lamby (2.2.1)
5
5
  rack
6
- rails
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
- actioncable (6.0.0)
12
- actionpack (= 6.0.0)
10
+ actioncable (6.0.2.2)
11
+ actionpack (= 6.0.2.2)
13
12
  nio4r (~> 2.0)
14
13
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.0)
16
- actionpack (= 6.0.0)
17
- activejob (= 6.0.0)
18
- activerecord (= 6.0.0)
19
- activestorage (= 6.0.0)
20
- activesupport (= 6.0.0)
14
+ actionmailbox (6.0.2.2)
15
+ actionpack (= 6.0.2.2)
16
+ activejob (= 6.0.2.2)
17
+ activerecord (= 6.0.2.2)
18
+ activestorage (= 6.0.2.2)
19
+ activesupport (= 6.0.2.2)
21
20
  mail (>= 2.7.1)
22
- actionmailer (6.0.0)
23
- actionpack (= 6.0.0)
24
- actionview (= 6.0.0)
25
- activejob (= 6.0.0)
21
+ actionmailer (6.0.2.2)
22
+ actionpack (= 6.0.2.2)
23
+ actionview (= 6.0.2.2)
24
+ activejob (= 6.0.2.2)
26
25
  mail (~> 2.5, >= 2.5.4)
27
26
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.0)
29
- actionview (= 6.0.0)
30
- activesupport (= 6.0.0)
31
- rack (~> 2.0)
27
+ actionpack (6.0.2.2)
28
+ actionview (= 6.0.2.2)
29
+ activesupport (= 6.0.2.2)
30
+ rack (~> 2.0, >= 2.0.8)
32
31
  rack-test (>= 0.6.3)
33
32
  rails-dom-testing (~> 2.0)
34
33
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.0)
36
- actionpack (= 6.0.0)
37
- activerecord (= 6.0.0)
38
- activestorage (= 6.0.0)
39
- activesupport (= 6.0.0)
34
+ actiontext (6.0.2.2)
35
+ actionpack (= 6.0.2.2)
36
+ activerecord (= 6.0.2.2)
37
+ activestorage (= 6.0.2.2)
38
+ activesupport (= 6.0.2.2)
40
39
  nokogiri (>= 1.8.5)
41
- actionview (6.0.0)
42
- activesupport (= 6.0.0)
40
+ actionview (6.0.2.2)
41
+ activesupport (= 6.0.2.2)
43
42
  builder (~> 3.1)
44
43
  erubi (~> 1.4)
45
44
  rails-dom-testing (~> 2.0)
46
45
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.0)
48
- activesupport (= 6.0.0)
46
+ activejob (6.0.2.2)
47
+ activesupport (= 6.0.2.2)
49
48
  globalid (>= 0.3.6)
50
- activemodel (6.0.0)
51
- activesupport (= 6.0.0)
52
- activerecord (6.0.0)
53
- activemodel (= 6.0.0)
54
- activesupport (= 6.0.0)
55
- activestorage (6.0.0)
56
- actionpack (= 6.0.0)
57
- activejob (= 6.0.0)
58
- activerecord (= 6.0.0)
49
+ activemodel (6.0.2.2)
50
+ activesupport (= 6.0.2.2)
51
+ activerecord (6.0.2.2)
52
+ activemodel (= 6.0.2.2)
53
+ activesupport (= 6.0.2.2)
54
+ activestorage (6.0.2.2)
55
+ actionpack (= 6.0.2.2)
56
+ activejob (= 6.0.2.2)
57
+ activerecord (= 6.0.2.2)
59
58
  marcel (~> 0.3.1)
60
- activesupport (6.0.0)
59
+ activesupport (6.0.2.2)
61
60
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
61
  i18n (>= 0.7, < 2)
63
62
  minitest (~> 5.1)
64
63
  tzinfo (~> 1.1)
65
- zeitwerk (~> 2.1, >= 2.1.8)
66
- aws-eventstream (1.0.2)
67
- aws-partitions (1.146.0)
68
- aws-sdk-core (3.48.2)
64
+ zeitwerk (~> 2.2)
65
+ aws-eventstream (1.0.3)
66
+ aws-partitions (1.287.0)
67
+ aws-sdk-core (3.92.0)
69
68
  aws-eventstream (~> 1.0, >= 1.0.2)
70
- aws-partitions (~> 1.0)
69
+ aws-partitions (~> 1, >= 1.239.0)
71
70
  aws-sigv4 (~> 1.1)
72
71
  jmespath (~> 1.0)
73
- aws-sdk-ssm (1.41.0)
74
- aws-sdk-core (~> 3, >= 3.48.2)
72
+ aws-sdk-ssm (1.73.0)
73
+ aws-sdk-core (~> 3, >= 3.71.0)
75
74
  aws-sigv4 (~> 1.1)
76
- aws-sigv4 (1.1.0)
75
+ aws-sigv4 (1.1.1)
77
76
  aws-eventstream (~> 1.0, >= 1.0.2)
78
- builder (3.2.3)
77
+ builder (3.2.4)
79
78
  coderay (1.1.2)
80
- concurrent-ruby (1.1.5)
81
- crass (1.0.5)
79
+ concurrent-ruby (1.1.6)
80
+ crass (1.0.6)
82
81
  erubi (1.9.0)
83
82
  globalid (0.4.2)
84
83
  activesupport (>= 4.2.0)
85
- i18n (1.7.0)
84
+ i18n (1.8.2)
86
85
  concurrent-ruby (~> 1.0)
87
86
  jmespath (1.4.0)
88
- loofah (2.3.1)
87
+ loofah (2.4.0)
89
88
  crass (~> 1.0.2)
90
89
  nokogiri (>= 1.5.9)
91
90
  mail (2.7.1)
92
91
  mini_mime (>= 0.1.1)
93
92
  marcel (0.3.3)
94
93
  mimemagic (~> 0.3.2)
95
- metaclass (0.0.4)
96
- method_source (0.9.2)
97
- mimemagic (0.3.3)
94
+ method_source (1.0.0)
95
+ mimemagic (0.3.4)
98
96
  mini_mime (1.0.2)
99
97
  mini_portile2 (2.4.0)
100
- minitest (5.11.3)
101
- mocha (1.8.0)
102
- metaclass (~> 0.0.1)
98
+ minitest (5.14.0)
99
+ minitest-focus (1.1.2)
100
+ minitest (>= 4, < 6)
101
+ mocha (1.11.2)
103
102
  nio4r (2.5.2)
104
- nokogiri (1.10.4)
103
+ nokogiri (1.10.9)
105
104
  mini_portile2 (~> 2.4.0)
106
- pry (0.12.2)
107
- coderay (~> 1.1.0)
108
- method_source (~> 0.9.0)
109
- rack (2.0.7)
105
+ pry (0.13.0)
106
+ coderay (~> 1.1)
107
+ method_source (~> 1.0)
108
+ rack (2.2.2)
110
109
  rack-test (1.1.0)
111
110
  rack (>= 1.0, < 3)
112
- rails (6.0.0)
113
- actioncable (= 6.0.0)
114
- actionmailbox (= 6.0.0)
115
- actionmailer (= 6.0.0)
116
- actionpack (= 6.0.0)
117
- actiontext (= 6.0.0)
118
- actionview (= 6.0.0)
119
- activejob (= 6.0.0)
120
- activemodel (= 6.0.0)
121
- activerecord (= 6.0.0)
122
- activestorage (= 6.0.0)
123
- activesupport (= 6.0.0)
111
+ rails (6.0.2.2)
112
+ actioncable (= 6.0.2.2)
113
+ actionmailbox (= 6.0.2.2)
114
+ actionmailer (= 6.0.2.2)
115
+ actionpack (= 6.0.2.2)
116
+ actiontext (= 6.0.2.2)
117
+ actionview (= 6.0.2.2)
118
+ activejob (= 6.0.2.2)
119
+ activemodel (= 6.0.2.2)
120
+ activerecord (= 6.0.2.2)
121
+ activestorage (= 6.0.2.2)
122
+ activesupport (= 6.0.2.2)
124
123
  bundler (>= 1.3.0)
125
- railties (= 6.0.0)
124
+ railties (= 6.0.2.2)
126
125
  sprockets-rails (>= 2.0.0)
127
126
  rails-dom-testing (2.0.3)
128
127
  activesupport (>= 4.2.0)
129
128
  nokogiri (>= 1.6)
130
129
  rails-html-sanitizer (1.3.0)
131
130
  loofah (~> 2.3)
132
- railties (6.0.0)
133
- actionpack (= 6.0.0)
134
- activesupport (= 6.0.0)
131
+ railties (6.0.2.2)
132
+ actionpack (= 6.0.2.2)
133
+ activesupport (= 6.0.2.2)
135
134
  method_source
136
135
  rake (>= 0.8.7)
137
136
  thor (>= 0.20.3, < 2.0)
138
- rake (12.3.2)
137
+ rake (13.0.1)
139
138
  sprockets (4.0.0)
140
139
  concurrent-ruby (~> 1.0)
141
140
  rack (> 1, < 3)
@@ -143,15 +142,14 @@ GEM
143
142
  actionpack (>= 4.0)
144
143
  activesupport (>= 4.0)
145
144
  sprockets (>= 3.0.0)
146
- sqlite3 (1.4.1)
147
- thor (0.20.3)
145
+ thor (1.0.1)
148
146
  thread_safe (0.3.6)
149
- tzinfo (1.2.5)
147
+ tzinfo (1.2.6)
150
148
  thread_safe (~> 0.1)
151
149
  websocket-driver (0.7.1)
152
150
  websocket-extensions (>= 0.1.0)
153
151
  websocket-extensions (0.1.4)
154
- zeitwerk (2.2.0)
152
+ zeitwerk (2.3.0)
155
153
 
156
154
  PLATFORMS
157
155
  ruby
@@ -161,10 +159,11 @@ DEPENDENCIES
161
159
  bundler
162
160
  lamby!
163
161
  minitest
162
+ minitest-focus
164
163
  mocha
165
164
  pry
165
+ rails
166
166
  rake
167
- sqlite3
168
167
 
169
168
  BUNDLED WITH
170
- 1.17.3
169
+ 2.1.4
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # Lamby [![Build Status](https://travis-ci.org/customink/lamby.svg?branch=master)](https://travis-ci.org/customink/lamby)
2
+ # Lamby [![Actions Status](https://github.com/customink/lamby/workflows/CI/CD/badge.svg)](https://github.com/customink/lamby/actions)
3
3
 
4
4
  <h2>Simple Rails &amp; AWS Lambda Integration</h2>
5
5
 
@@ -11,7 +11,7 @@ The goal of this project is to provide minimal code to allow your Rails applicat
11
11
 
12
12
  ```ruby
13
13
  def handler(event:, context:)
14
- Lamby.handler $app, event, context, rack: :alb
14
+ Lamby.handler $app, event, context, rack: :http
15
15
  end
16
16
  ```
17
17
 
@@ -27,7 +27,13 @@ https://lamby.custominktech.com/docs/installing_aws_sam
27
27
 
28
28
  ## Contributing
29
29
 
30
- After checking out the repo, run `./bin/setup` to install dependencies. Then, run `./bin/test` to run the tests.
30
+ After checking out the repo, run:
31
+
32
+ ```shell
33
+ $ ./bin/bootstrap
34
+ $ ./bin/setup
35
+ $ ./bin/test
36
+ ```
31
37
 
32
38
  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.
33
39
 
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ ENV['RUBYOPT'] = '-W:no-deprecated -W:no-experimental'
1
2
  require "bundler/gem_tasks"
2
3
  require "rake/testtask"
3
4
 
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo '== Installing dependencies =='
5
+ bundle config set --local path 'vendor/bundle'
6
+ bundle install
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ export RAILS_ENV="test"
5
+
6
+ bundle exec rake test
@@ -1,20 +1,6 @@
1
1
  #!/bin/bash
2
-
3
2
  set -e
4
3
 
5
- if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
6
- brew bundle check || {
7
- echo "==> Installing Homebrew dependencies..."
8
- brew bundle --verbose
9
- }
10
- fi
11
-
12
- rbenv install \
13
- --skip-existing \
14
- $(cat .ruby-version)
15
-
16
- CFLAGS="-I$(brew --prefix zlib)/include" \
17
- LDFLAGS="-L$(brew --prefix zlib)/lib" \
18
- pyenv install \
19
- --skip-existing \
20
- $(cat .python-version)
4
+ echo '== Building containers =='
5
+ docker pull lambci/lambda:build-ruby2.7
6
+ docker-compose build