lambda_punch 1.0.2 → 1.1.0

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: 4227bd51c1fd9c2aea1b84be39d86701cb8fc6fc44ed6440f929e39406ce17ce
4
- data.tar.gz: b6c8545418ed4678a49651932730b107c5b5ba8fb31219141dab969479c5507e
3
+ metadata.gz: ad3d3b5bc8d71f3ec550dc01f998e4df18c77b839b9dd4c44d010a08b5bf25d5
4
+ data.tar.gz: 106ecd9404fe6a570166f5a2dfc6e7654f427aec9fc1e77df2154d4031409982
5
5
  SHA512:
6
- metadata.gz: 7a62027972c551ae187bd0832271775c38ac4a677f318e6146d12e944354f397eb7c63d7b5370de1095dd50cf1e1c2b02ef0efe3bd7dc994e7574f51c1db3f86
7
- data.tar.gz: 0a1117ef7b5dd3ad0599f3b586e58e40543f8e550832af034bc2915328640d65b6bbfe6b1e40093a790295861e0bd02793df585a45d10813b3cd620d96b14a27
6
+ metadata.gz: e9526b2c0ec7490eeb323df242a0b2537cc3c783aad1c6bd622bdec58354abb1f5b0230833947ded1f8242eacd1d15625cc581a34e6d822e3343adc3732124cb
7
+ data.tar.gz: 105223ed92a8f3782e376f9d3d472d70d0a807a984a5f94425d3332450fae150dcf20c67771898741dc2134efa67c8db262dd8efb14ddfe89dc46d6cc2214870
data/CHANGELOG.md CHANGED
@@ -1,11 +1,20 @@
1
- ## [1.0.2] - 2021-10-27
1
+ ## [1.1.0] - 2023-04-16
2
+
3
+ ### Added
4
+
5
+ - New `lambda_punch` install interface.
6
+
7
+ ## [1.0.3] - 2021-10-27
8
+
9
+ ### Added
10
+
11
+ - Any Timeout Gem. Tempfile Location Interface
2
12
 
3
13
  ### Changed
4
14
 
5
- - Lock timeout gem to 0.1.x
6
- - Ensure rake is required when loading railtie tasks.
15
+ - Remove timeout version lock.
7
16
 
8
- ## [1.0.1] - 2021-07-24
17
+ ## [1.0.2] - 2021-07-24
9
18
 
10
19
  ### Changed
11
20
 
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lambda_punch (1.0.2)
4
+ lambda_punch (1.0.3)
5
5
  concurrent-ruby
6
6
  rake
7
7
  rb-inotify
8
- timeout (~> 0.1.1)
8
+ timeout
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
@@ -137,7 +137,7 @@ GEM
137
137
  activesupport (>= 4.0)
138
138
  sprockets (>= 3.0.0)
139
139
  thor (1.1.0)
140
- timeout (0.1.1)
140
+ timeout (0.2.0)
141
141
  tzinfo (2.0.4)
142
142
  concurrent-ruby (~> 1.0)
143
143
  websocket-driver (0.7.5)
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 👊 LambdaPunch
6
6
 
7
- <a href="https://lamby.custominktech.com"><img src="https://user-images.githubusercontent.com/2381/59363668-89edeb80-8d03-11e9-9985-2ce14361b7e3.png" alt="Lamby: Simple Rails & AWS Lambda Integration using Rack." align="right" width="300" /></a>Asynchronous background job processing for AWS Lambda with Ruby using [Lambda Extensions](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html). Inspired by the [SuckerPunch](https://github.com/brandonhilkert/sucker_punch) gem but specifically tooled to work with Lambda's invoke model.
7
+ <a href="https://lamby.custominktech.com"><img src="https://raw.githubusercontent.com/customink/lamby/master/images/social2.png" alt="Lamby: Simple Rails & AWS Lambda Integration using Rack." align="right" width="450" style="margin-left:1rem;margin-bottom:1rem;" /></a>Asynchronous background job processing for AWS Lambda with Ruby using [Lambda Extensions](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html). Inspired by the [SuckerPunch](https://github.com/brandonhilkert/sucker_punch) gem but specifically tooled to work with Lambda's invoke model.
8
8
 
9
9
  **For a more robust background job solution, please consider using AWS SQS with the [Lambdakiq](https://github.com/customink/lambdakiq) gem. A drop-in replacement for [Sidekiq](https://github.com/mperham/sidekiq) when running Rails in AWS Lambda using the [Lamby](https://lamby.custominktech.com/) gem.**
10
10
 
@@ -18,35 +18,36 @@ The LambdaPunch extension process is very small and lean. It only requires a few
18
18
 
19
19
  ## 🎁 Installation
20
20
 
21
- Add this line to your project's `Gemfile` and then make sure to `bundle install` afterward.
21
+ Add this line to your project's `Gemfile` and then make sure to `bundle install` afterward. It is only needed in the `production` group.
22
22
 
23
23
  ```ruby
24
24
  gem 'lambda_punch'
25
25
  ```
26
26
 
27
- Now, within your application's handler file, make sure to start the LambdaPunch DRb server outside of your handler method. Within the handler method, add an `ensure` section that lets the extension process know the request is done.
27
+ Within your project or [Rails application's](https://lamby.custominktech.com/docs/anatomy) `Dockerfile`, add the following. Make sure you do this before you `COPY` your code. The idea is to implicitly use the default `USER root` since it needs permissions to create an `/opt/extensions` directory.
28
28
 
29
- ```ruby
30
- LambdaPunch.start_server!
31
-
32
- def handler(event:, context:)
33
- # ...
34
- ensure
35
- LambdaPunch.handled!(context)
36
- end
29
+ ```dockerfile
30
+ RUN gem install lambda_punch && lambda_punch install
37
31
  ```
38
32
 
39
- Within your project or [Rails application's](https://lamby.custominktech.com/docs/anatomy) `Dockerfile`, after you copy your code, add this `RUN` command to install the extension within your container's `/opt/extensions` directory.
33
+ Installation with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) v4 (or higher) gem can be done using Lamby's `handled_proc` config. For example, appends these to your `config/environments/production.rb` file. Here we are ensuring that the LambdaPunch DRb server is running and that after each Lamby request we notify LambdaPunch.
40
34
 
41
- ```dockerfile
42
- RUN bundle exec rake lambda_punch:install
35
+ ```ruby
36
+ config.to_prepare { LambdaPunch.start_server! }
37
+ config.lamby.handled_proc = Proc.new do |_event, context|
38
+ LambdaPunch.handled!(context)
39
+ end
43
40
  ```
44
41
 
45
- If you are using `LambdaPunch` with a non-Rails project, add this to your Rake file
42
+ If you are using an older version of Lamby or a simple Ruby project with your own handler method, the installation would look something like this:
46
43
 
47
44
  ```ruby
48
- spec = Gem::Specification.find_by_name 'lambda_punch'
49
- load "#{spec.gem_dir}/lib/lambda_punch/tasks/install.rake"
45
+ LambdaPunch.start_server!
46
+ def handler(event:, context:)
47
+ # ...
48
+ ensure
49
+ LambdaPunch.handled!(context)
50
+ end
50
51
  ```
51
52
 
52
53
  ## 🧰 Usage
@@ -59,12 +60,11 @@ LambdaPunch.push do
59
60
  end
60
61
  ```
61
62
 
62
- For example, if you are using Rails with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) gem along with [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi) here is how your handler function might appear to ensure their metrics are flushed after each request.
63
+ A common use case would be to ensure the [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi) flushes its data after each request. Using Lamby in your `config/environments/production.rb` file would look like this:
63
64
 
64
65
  ```ruby
65
- def handler(event:, context:)
66
- Lamby.handler $app, event, context
67
- ensure
66
+ config.to_prepare { LambdaPunch.start_server! }
67
+ config.lamby.handled_proc = Proc.new do |_event, context|
68
68
  LambdaPunch.push { NewRelic::Agent.agent.flush_pipe_data }
69
69
  LambdaPunch.handled!(context)
70
70
  end
data/exe/lambda_punch ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+
6
+ load "#{spec.gem_dir}/lib/lambda_punch/tasks/install.rake"
7
+
8
+ command = ARGV[0] || 'install'
9
+
10
+ Rake::Task["lambda_punch:#{command}"].invoke
data/lambda_punch.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "concurrent-ruby"
22
22
  spec.add_dependency "rake"
23
23
  spec.add_dependency "rb-inotify"
24
- spec.add_dependency "timeout", "~> 0.1.1"
24
+ spec.add_dependency "timeout"
25
25
  spec.add_development_dependency "minitest-focus"
26
26
  spec.add_development_dependency "pry"
27
27
  spec.add_development_dependency "rails"
@@ -15,6 +15,10 @@ module LambdaPunch
15
15
  File.read(FILE)
16
16
  end
17
17
 
18
+ def tmp_file
19
+ FILE
20
+ end
21
+
18
22
  end
19
23
 
20
24
  def initialize
@@ -1,3 +1,3 @@
1
1
  module LambdaPunch
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/lambda_punch.rb CHANGED
@@ -58,6 +58,10 @@ module LambdaPunch
58
58
  @error_handler = func
59
59
  end
60
60
 
61
+ def tmp_file
62
+ Notifier.tmp_file
63
+ end
64
+
61
65
  extend self
62
66
 
63
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-28 00:00:00.000000000 Z
11
+ date: 2023-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: timeout
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.1
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.1
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest-focus
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -111,7 +111,8 @@ dependencies:
111
111
  description: 'LambdaPunch: Async Processing using Lambda Extensions'
112
112
  email:
113
113
  - ken@metaskills.net
114
- executables: []
114
+ executables:
115
+ - lambda_punch
115
116
  extensions: []
116
117
  extra_rdoc_files: []
117
118
  files:
@@ -133,6 +134,7 @@ files:
133
134
  - bin/setup
134
135
  - bin/test
135
136
  - docker-compose.yml
137
+ - exe/lambda_punch
136
138
  - lambda_punch.gemspec
137
139
  - lib/lambda_punch.rb
138
140
  - lib/lambda_punch/api.rb
@@ -154,7 +156,7 @@ metadata:
154
156
  homepage_uri: https://github.com/customink/lambda_punch
155
157
  source_code_uri: https://github.com/customink/lambda_punch
156
158
  changelog_uri: https://github.com/customink/lambda_punch/blob/main/CHANGELOG.md
157
- post_install_message:
159
+ post_install_message:
158
160
  rdoc_options: []
159
161
  require_paths:
160
162
  - lib
@@ -169,8 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
171
  - !ruby/object:Gem::Version
170
172
  version: '0'
171
173
  requirements: []
172
- rubygems_version: 3.1.2
173
- signing_key:
174
+ rubygems_version: 3.4.7
175
+ signing_key:
174
176
  specification_version: 4
175
177
  summary: 'LambdaPunch: Async Processing using Lambda Extensions'
176
178
  test_files: []