serverless-rack 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6c6a203f16992b8ec00f2724b7fd946fa0a0273161f886a79af93fc694bb273
4
- data.tar.gz: 60ce657407be49da9ba53dcb97d4ea29d518367f09e39e16240a01b4ec8d6016
3
+ metadata.gz: 67c45bfb333ad3b27bd1d7f36e5b98ecc7ead2f27762a9ddc1c713b7d2cc5a9b
4
+ data.tar.gz: 9db88c7bf781a67032fb866886d443ff219140427ce1087e667d836a39f9271a
5
5
  SHA512:
6
- metadata.gz: 5e878e4752fc6de59f6481834951643534c65408afb5b269df0abbce0e81e3782f8dfe0c97677c71f104dfd4500abbf477139b32c089ae386cdf3c95a42faa5f
7
- data.tar.gz: ae145cbe7e2977271dd459e80bb8d708c607b90b224e7999e67007e652f02c5c7045ff722c34e5243ccc8336dd1b35b5da6b9fcdfc9489b0621934ee5c9ae1e3
6
+ metadata.gz: 1dbfe05405a816ae2a31e62a3046253f842616e72b3ca3aa0149e337f97d59e75127f3d513b657f2357e94c1c31a11701f352b2d82c75a22843f296dd388f988
7
+ data.tar.gz: 75b78e2e61ab8fcba27b75ac33c4cf328049b26ea97ff3480b4049e013d4b25d7a89c4e17896c57f08cd9f90ea53a6cdab196e97c1ba2d009888e32d23fc3bfd
@@ -1,3 +1,18 @@
1
+ # 1.0.6
2
+
3
+ - Upgrade dependencies
4
+ - Add a dockerImage config option to override the docker image to be used for compiling gems (defaults to the lambci ruby images) (#17)
5
+
6
+ _Benjamin Curtis_
7
+
8
+ - Cache the bundle that is created by docker to avoid recompiling gems (#17)
9
+
10
+ _Benjamin Curtis_
11
+
12
+ - Handle empty `API_GATEWAY_BASE_PATH` (#14)
13
+
14
+ _Joel Van Horn_
15
+
1
16
  # 1.0.5
2
17
 
3
18
  - Upgrade dependencies
data/README.md CHANGED
@@ -139,13 +139,23 @@ For more information, see https://bundler.io/docs.html.
139
139
 
140
140
  If your application depends on any gems that include compiled binaries, these
141
141
  must be compiled for the lambda execution environment. Enabling the `dockerizeBundler` configuration
142
- option will fetch and build the gems using a [docker image](https://hub.docker.com/r/logandk/serverless-rack-bundler)
143
- that emulates the lambda environment:
142
+ option will fetch and build the gems using a docker image that emulates the lambda environment:
144
143
 
145
144
  ```yaml
146
145
  custom:
147
146
  rack:
148
- dockerizeBundler: false
147
+ dockerizeBundler: true
148
+ ```
149
+
150
+ The default docker image that will be used will match the runtime you are using.
151
+ That is, if you are using the `ruby2.7` runtime, then the docker image will be
152
+ `logandk/serverless-rack-bundler:ruby2.7`. You can override the docker image with the
153
+ `dockerImage` configuration option:
154
+
155
+ ```yaml
156
+ custom:
157
+ rack:
158
+ dockerImage: lambci/lambda:build-ruby2.5
149
159
  ```
150
160
 
151
161
  ### Bundler configuration
@@ -219,6 +229,8 @@ $ sls rack serve -p 8000
219
229
  When running locally, an environment variable named `IS_OFFLINE` will be set to `True`.
220
230
  So, if you want to know when the application is running locally, check `ENV["IS_OFFLINE"]`.
221
231
 
232
+ For use with the `serverless-offline` plugin, run `sls rack install` prior to `sls offline`.
233
+
222
234
  ### Remote command execution
223
235
 
224
236
  The `rack exec` command lets you execute ruby code remotely:
@@ -15,17 +15,19 @@ TEXT_MIME_TYPES = [
15
15
  'image/svg+xml'
16
16
  ].freeze
17
17
 
18
+ def base_path
19
+ "/#{ENV['API_GATEWAY_BASE_PATH']}" unless ENV['API_GATEWAY_BASE_PATH'].to_s.empty?
20
+ end
21
+
18
22
  def keepalive_event?(event)
19
23
  ['aws.events', 'serverless-plugin-warmup'].include?(event['source'])
20
24
  end
21
25
 
22
26
  def parse_script_name(event, headers)
23
- if ENV['API_GATEWAY_BASE_PATH']
24
- "/#{ENV['API_GATEWAY_BASE_PATH']}"
25
- elsif (headers['Host'] || '').include?('amazonaws.com')
27
+ if base_path.nil? && (headers['Host'] || '').include?('amazonaws.com')
26
28
  "/#{event['requestContext']['stage']}"
27
29
  else
28
- ''
30
+ base_path.to_s
29
31
  end
30
32
  end
31
33
 
@@ -33,12 +35,11 @@ def parse_path_info(event)
33
35
  # If a user is using a custom domain on API Gateway, they may have a base
34
36
  # path in their URL. This allows us to strip it out via an optional
35
37
  # environment variable.
36
- if ENV['API_GATEWAY_BASE_PATH']
37
- base_path = "/#{ENV['API_GATEWAY_BASE_PATH']}"
38
- return event['path'][base_path.length..-1] if event['path'].start_with?(base_path)
38
+ if base_path && event['path'].start_with?(base_path)
39
+ event['path'][base_path.length..-1]
40
+ else
41
+ event['path']
39
42
  end
40
-
41
- event['path']
42
43
  end
43
44
 
44
45
  def parse_query_string(event)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'serverless-rack'
5
- s.version = '1.0.5'
5
+ s.version = '1.0.6'
6
6
  s.summary =
7
7
  'Serverless plugin to deploy Ruby Rack applications (Sinatra/Padrino/Cuba etc.) '\
8
8
  'and bundle gems'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverless-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Raarup
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  requirements: []
60
- rubygems_version: 3.0.4
60
+ rubygems_version: 3.1.2
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: Serverless plugin to deploy Ruby Rack applications (Sinatra/Padrino/Cuba