shrine-lambda 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -7
- data/README.md +78 -11
- data/lib/shrine/plugins/lambda/version.rb +7 -0
- data/lib/shrine/plugins/shrine-lambda.rb +1 -0
- data/shrine-lambda.gemspec +22 -12
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 366018c294b31c7b6cf3fcb385dc1101df63f764fc55c1401a25dba2ed57a486
|
4
|
+
data.tar.gz: 2978133c7f3fd0c97063dfc550343f32f83505a9f07dc30ebfb15321906dfef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3611b568a2638199bd474b0b3075d7f7bf10e4a0f7c40c18d6386fdc3cad992e55a1e3481e59ba2b61245982f14f24c3c63e7dfd7dcd98691a4874cc81bfe813
|
7
|
+
data.tar.gz: e4a36b7652589214d0d35506e9631a00ede249f279db176043eb059407f8f9468ba07f5a4998288c7af485bb83d02adf094ec31bb12a08a1d50271dc189b8d68
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,28 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
DEPRECATION NOTICE: shrine-lambda gem will be renamed to shrine-aws-lambda for clarity
|
4
4
|
|
5
|
-
|
5
|
+
The current version, 0.1.1, is the last version under the shrine-lambda name.
|
6
|
+
|
7
|
+
Thank you for using this gem!
|
8
|
+
|
9
|
+
## [v0.1.1](https://github.com/texpert/shrine-lambda/tree/v0.1.1) (2021-04-09)
|
10
|
+
|
11
|
+
[Full Changelog](https://github.com/texpert/shrine-lambda/compare/v0.1.0...v0.1.1)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- Add Gem Maintenance chapter, language labels to markdown code to README.md [\#20](https://github.com/texpert/shrine-lambda/pull/20) ([texpert](https://github.com/texpert))
|
16
|
+
- Set post-install deprecation notice about renaming the gem, add version file [\#19](https://github.com/texpert/shrine-lambda/pull/19) ([texpert](https://github.com/texpert))
|
17
|
+
- Fix uninitialized constant Shrine::Error when adding shrine-lambda to… [\#18](https://github.com/texpert/shrine-lambda/pull/18) ([texpert](https://github.com/texpert))
|
18
|
+
|
19
|
+
## [v0.1.0](https://github.com/texpert/shrine-lambda/tree/v0.1.0) (2020-05-24)
|
20
|
+
|
21
|
+
[Full Changelog](https://github.com/texpert/shrine-lambda/compare/v0.0.1...v0.1.0)
|
6
22
|
|
7
23
|
**Breaking changes:**
|
8
24
|
|
9
|
-
- BREAKING CHANGE: Uploader's `:
|
25
|
+
- BREAKING CHANGE: Uploader's `:lambda_process` method renamed to `:lambda_process_versions` [\#14](https://github.com/texpert/shrine-lambda/pull/14) ([texpert](https://github.com/texpert))
|
10
26
|
|
11
27
|
**Implemented enhancements:**
|
12
28
|
|
@@ -14,17 +30,18 @@
|
|
14
30
|
|
15
31
|
**Merged pull requests:**
|
16
32
|
|
33
|
+
- Prepare the 0.1.0 release [\#16](https://github.com/texpert/shrine-lambda/pull/16) ([texpert](https://github.com/texpert))
|
17
34
|
- Added github\_changelog\_generator as a development dependency [\#15](https://github.com/texpert/shrine-lambda/pull/15) ([texpert](https://github.com/texpert))
|
18
35
|
- Release v. 0.0.1 [\#11](https://github.com/texpert/shrine-lambda/pull/11) ([texpert](https://github.com/texpert))
|
19
36
|
- Prepairing for release. [\#10](https://github.com/texpert/shrine-lambda/pull/10) ([texpert](https://github.com/texpert))
|
20
37
|
- Plugin documentation. [\#9](https://github.com/texpert/shrine-lambda/pull/9) ([texpert](https://github.com/texpert))
|
21
|
-
- Comply with Shrine's `
|
38
|
+
- Comply with Shrine's `upload_options` plugin to be able to set ACL's … [\#8](https://github.com/texpert/shrine-lambda/pull/8) ([texpert](https://github.com/texpert))
|
22
39
|
- Finalized and documented the authorization and saving methods. [\#7](https://github.com/texpert/shrine-lambda/pull/7) ([texpert](https://github.com/texpert))
|
23
|
-
- Fixed the class of `
|
40
|
+
- Fixed the class of `lambda_client`. [\#6](https://github.com/texpert/shrine-lambda/pull/6) ([texpert](https://github.com/texpert))
|
24
41
|
- AWS session security token is now used to calculate request signature… [\#5](https://github.com/texpert/shrine-lambda/pull/5) ([texpert](https://github.com/texpert))
|
25
42
|
- Authorization of Lambda requests to `callbackURL` implemented by calc… [\#4](https://github.com/texpert/shrine-lambda/pull/4) ([texpert](https://github.com/texpert))
|
26
|
-
- `:
|
27
|
-
- Fix of `:configure` and implementation of client and `:
|
43
|
+
- `:lambda_process` methods implementation and `:configure` method refactoring [\#3](https://github.com/texpert/shrine-lambda/pull/3) ([texpert](https://github.com/texpert))
|
44
|
+
- Fix of `:configure` and implementation of client and `:lambda_function_list` methods. [\#2](https://github.com/texpert/shrine-lambda/pull/2) ([texpert](https://github.com/texpert))
|
28
45
|
- Initial gem and plugin config [\#1](https://github.com/texpert/shrine-lambda/pull/1) ([texpert](https://github.com/texpert))
|
29
46
|
|
30
47
|
## [v0.0.1](https://github.com/texpert/shrine-lambda/tree/v0.0.1) (2018-02-12)
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Shrine-Lambda's setup. So, the invoking application must provide a HTTP endpoint
|
|
30
30
|
|
31
31
|
Add Shrine-Lambda gem to the application's Gemfile:
|
32
32
|
|
33
|
-
```
|
33
|
+
```ruby
|
34
34
|
gem 'shrine-lambda'
|
35
35
|
```
|
36
36
|
|
@@ -40,10 +40,10 @@ Run `$ bundle install` command in the application's root folder to install the g
|
|
40
40
|
Note, that for working with AWS, the AWS credentials (the `access_key_id` and the `secret_access_key`) should be set
|
41
41
|
either in the [Shrine] initializer, or in [default profile][AWS profiles] in the `~/.aws` folder.
|
42
42
|
|
43
|
-
```
|
43
|
+
```ruby
|
44
44
|
# config/initializers/shrine.rb:
|
45
45
|
|
46
|
-
...
|
46
|
+
# ...
|
47
47
|
|
48
48
|
s3_options = { access_key_id: 'your_aws_access_key_id',
|
49
49
|
secret_access_key: 'your_aws_secret_access_key',
|
@@ -56,10 +56,10 @@ Add to the [Shrine]'s initializer file the Shrine-Lambda plugin registration wit
|
|
56
56
|
the [AWS Lambda] functions list retrieval call (which will retrieve the functions list on application initialization
|
57
57
|
and will store the list into the `Shrine.opts[:lambda_function_list]` for further checking):
|
58
58
|
|
59
|
-
```
|
59
|
+
```ruby
|
60
60
|
# config/initializers/shrine.rb:
|
61
61
|
|
62
|
-
...
|
62
|
+
# ...
|
63
63
|
|
64
64
|
Shrine.plugin :lambda, s3_options.merge(callback_url: "https://#{ENV.fetch('APP_HOST')}/lambda")
|
65
65
|
Shrine.lambda_function_list
|
@@ -74,7 +74,7 @@ Srine-Lamda uses the [Shrine backgrounding plugin] for asynchronous operation, s
|
|
74
74
|
Here is a full example of a Shrine initializer of a [Rails] application using [Roda] endpoints for presigned_url's
|
75
75
|
(used for direct file uploads to [AWS S3]) and [AWS Lambda] callbacks:
|
76
76
|
|
77
|
-
```
|
77
|
+
```ruby
|
78
78
|
# config/initializers/shrine.rb:
|
79
79
|
|
80
80
|
# frozen_string_literal: true
|
@@ -173,7 +173,7 @@ the Lambda function's `:access_key_id` received in the request authorization hea
|
|
173
173
|
|
174
174
|
Shrine-Lambda assemblies are built inside the `#lambda_process_versions` method in the `LambdaUploader` class:
|
175
175
|
|
176
|
-
```
|
176
|
+
```ruby
|
177
177
|
# app/uploaders/lambda_uploader.rb:
|
178
178
|
|
179
179
|
# frozen_string_literal: true
|
@@ -230,7 +230,7 @@ enable the uploader to deal with different processed versions of the original fi
|
|
230
230
|
|
231
231
|
The default options used by Shrine-Lambda plugin are the following:
|
232
232
|
|
233
|
-
```
|
233
|
+
```ruby
|
234
234
|
{ callbackURL: Shrine.opts[:callback_url],
|
235
235
|
copy_original: true,
|
236
236
|
storages: Shrine.buckets_to_use(%i[cache store]),
|
@@ -239,7 +239,7 @@ The default options used by Shrine-Lambda plugin are the following:
|
|
239
239
|
|
240
240
|
These options could be overrided in the `LambdaUploader` specifying them as the `assembly` keys:
|
241
241
|
|
242
|
-
```
|
242
|
+
```ruby
|
243
243
|
assembly[:callbackURL] = some_callback_url]
|
244
244
|
assembly[:copy_original = false # If this is `false`, only the processed file versions will be stored
|
245
245
|
assembly[:storages] = Shrine.buckets_to_use(%i[cache store other_store])
|
@@ -255,7 +255,7 @@ Any S3 buckets could be specified, as long as the buckets are defined in the Shr
|
|
255
255
|
A `:callbackUrl` endpoint should be implemented to catch the [AWS Lambda] processing results, authorize, and save them.
|
256
256
|
Here is an example of a [Roda] endpoint:
|
257
257
|
|
258
|
-
```
|
258
|
+
```ruby
|
259
259
|
# lib/rapi/base.rb:
|
260
260
|
|
261
261
|
# frozen_string_literal: true
|
@@ -303,7 +303,7 @@ to put it into a background job. This is configured in the `LambdaUploader` clas
|
|
303
303
|
|
304
304
|
Then the job file should be implemented:
|
305
305
|
|
306
|
-
```
|
306
|
+
```ruby
|
307
307
|
# app/jobs/lambda_promote_job.rb:
|
308
308
|
|
309
309
|
# frozen_string_literal: true
|
@@ -313,9 +313,76 @@ class LambdaPromoteJob < ApplicationJob
|
|
313
313
|
Timeout.timeout(30) { Shrine::Attacher.lambda_process(data) }
|
314
314
|
end
|
315
315
|
end
|
316
|
+
```
|
317
|
+
|
318
|
+
### Gem Maintenance
|
319
|
+
|
320
|
+
#### Preparing a release
|
321
|
+
|
322
|
+
Merge all the pull requests that should make it into the new release into the `main` branch, then checkout and pull the
|
323
|
+
branch and run the `github_changelog_generator`, specifying the new version as a `--future-release` command line
|
324
|
+
parameter:
|
325
|
+
|
326
|
+
```bash
|
327
|
+
$ git checkout main
|
328
|
+
$ git pull
|
329
|
+
|
330
|
+
$ github_changelog_generator -u texpert -p shrine-lambda --future-release v0.1.1
|
331
|
+
```
|
332
|
+
|
333
|
+
Then add the changes to `git`, commit and push the `Preparing the new release` commit directly into the `main` branch:
|
334
|
+
|
335
|
+
```bash
|
336
|
+
$ git add .
|
337
|
+
$ git commit -m 'Preparing the new v0.1.1 release'
|
338
|
+
$ git push
|
339
|
+
```
|
340
|
+
|
341
|
+
#### RubyGems credentials
|
342
|
+
|
343
|
+
Ensure you have the RubyGems credentials located in the `~/.gem/credentials` file.
|
344
|
+
|
345
|
+
#### Adding a gem owner
|
346
|
+
|
347
|
+
```bash
|
348
|
+
$ gem owner shrine-lambda -a friend@example.com
|
349
|
+
```
|
350
|
+
|
351
|
+
#### Building a new gem version
|
352
|
+
|
353
|
+
Adjust the new gem version number in the `lib/shrine/plugins/lambda/version.rb` file. It is used when building the gem
|
354
|
+
by the following command:
|
355
|
+
|
356
|
+
```bash
|
357
|
+
$ gem build shrine-lambda.gemspec
|
358
|
+
```
|
359
|
+
|
360
|
+
Assuming the version was set to `0.1.1`, a `shrine-lambda-0.1.1.gem` binary file will be generated at the root of the app (repo).
|
361
|
+
|
362
|
+
- The binary file shouldn't be added into the `git` tree, it will be pushed into the RubyGems and to the GitHub releases
|
316
363
|
|
364
|
+
#### Pushing a new gem release to RubyGems
|
365
|
+
|
366
|
+
```bash
|
367
|
+
$ gem push shrine-lambda-0.1.1.gem # don't forget to specify the correct version number
|
317
368
|
```
|
318
369
|
|
370
|
+
#### Crafting the new release on GitHub
|
371
|
+
|
372
|
+
On the [Releases page](https://github.com/texpert/shrine-lambda/releases) push the `Draft a new release` button.
|
373
|
+
|
374
|
+
The new release editing page opens, on which the following actions could be taken:
|
375
|
+
|
376
|
+
- Choose the repo branch (default is `main`)
|
377
|
+
- Insert a tag version (usually, the tag should correspond to the gem's new version, v0.0.1, for example)
|
378
|
+
- the tag will be created by GitHub on the last commit into the chosen branch
|
379
|
+
- Fill the release Title and Description
|
380
|
+
- Attach the binary file with the generated gem version
|
381
|
+
- If the release is not yet ready for production, mark the `This is a pre-release` checkbox
|
382
|
+
- Press either the `Publish release`, or the `Save draft button` if you want to publish it later
|
383
|
+
- After publishing the release, the the binary gem file will be available on GitHub and could be removed locally
|
384
|
+
|
385
|
+
|
319
386
|
## Inspiration
|
320
387
|
|
321
388
|
I want to thank [Janko Marohnić][Janko] for the awesome [Shrine] gem and, also, for guiding me to look at his
|
data/shrine-lambda.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
gem.name = 'shrine-lambda'
|
5
|
-
gem.version = '0.1.0'
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
6
4
|
|
7
|
-
|
5
|
+
require 'shrine/plugins/lambda/version.rb'
|
8
6
|
|
9
|
-
|
10
|
-
gem.
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.name = 'shrine-lambda'
|
9
|
+
gem.version = Shrine::Plugins::Lambda::VERSION
|
11
10
|
gem.authors = ['Aurel Branzeanu']
|
12
|
-
gem.description = <<-DESC
|
13
|
-
AWS Lambda integration plugin for Shrine File Attachment toolkit for Ruby applications.
|
14
|
-
Used for invoking AWS Lambda functions for processing files already stored in some AWS S3 bucket.
|
15
|
-
DESC
|
16
11
|
gem.email = ['branzeanu.aurel@gmail.com']
|
17
|
-
gem.
|
18
|
-
|
12
|
+
gem.homepage = 'https://github.com/texpert/shrine-lambda'
|
13
|
+
gem.summary = 'AWS Lambda integration plugin for Shrine.'
|
14
|
+
gem.description = <<~DESC
|
15
|
+
AWS Lambda integration plugin for Shrine File Attachment toolkit for Ruby applications.
|
16
|
+
Used for invoking AWS Lambda functions for processing files already stored in some AWS S3 bucket.
|
17
|
+
DESC
|
18
|
+
gem.license = 'MIT'
|
19
19
|
gem.files = Dir['CHANGELOG.md', 'README.md', 'LICENSE', 'lib/**/*.rb', '*.gemspec']
|
20
20
|
gem.require_path = 'lib/shrine/plugins'
|
21
21
|
|
@@ -23,6 +23,8 @@ Gem::Specification.new do |gem|
|
|
23
23
|
'changelog_uri' => 'https://github.com/texpert/shrine-lambda/CHANGELOG.md',
|
24
24
|
'source_code_uri' => 'https://github.com/texpert/shrine-lambda' }
|
25
25
|
|
26
|
+
gem.required_ruby_version = '>= 2.3'
|
27
|
+
|
26
28
|
gem.add_dependency 'aws-sdk-lambda', '~> 1.0'
|
27
29
|
gem.add_dependency 'aws-sdk-s3', '~> 1.2'
|
28
30
|
gem.add_dependency 'shrine', '~> 2.6'
|
@@ -34,4 +36,12 @@ Gem::Specification.new do |gem|
|
|
34
36
|
gem.add_development_dependency 'rspec'
|
35
37
|
gem.add_development_dependency 'rubocop', '0.81'
|
36
38
|
gem.add_development_dependency 'sqlite3' unless RUBY_ENGINE == 'jruby'
|
39
|
+
|
40
|
+
gem.post_install_message = <<~POSTINSTALL
|
41
|
+
DEPRECATION NOTICE: shrine-lambda gem will be renamed to shrine-aws-lambda for clarity
|
42
|
+
|
43
|
+
The current version, 0.1.1, is the last version under the shrine-lambda name.
|
44
|
+
|
45
|
+
Thank you for using this gem!
|
46
|
+
POSTINSTALL
|
37
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-lambda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurel Branzeanu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-lambda
|
@@ -150,9 +150,9 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description: |
|
154
|
-
|
155
|
-
|
153
|
+
description: |
|
154
|
+
AWS Lambda integration plugin for Shrine File Attachment toolkit for Ruby applications.
|
155
|
+
Used for invoking AWS Lambda functions for processing files already stored in some AWS S3 bucket.
|
156
156
|
email:
|
157
157
|
- branzeanu.aurel@gmail.com
|
158
158
|
executables: []
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- CHANGELOG.md
|
163
163
|
- LICENSE
|
164
164
|
- README.md
|
165
|
+
- lib/shrine/plugins/lambda/version.rb
|
165
166
|
- lib/shrine/plugins/shrine-lambda.rb
|
166
167
|
- shrine-lambda.gemspec
|
167
168
|
homepage: https://github.com/texpert/shrine-lambda
|
@@ -171,7 +172,12 @@ metadata:
|
|
171
172
|
bug_tracker_uri: https://github.com/texpert/shrine-lambda/issues
|
172
173
|
changelog_uri: https://github.com/texpert/shrine-lambda/CHANGELOG.md
|
173
174
|
source_code_uri: https://github.com/texpert/shrine-lambda
|
174
|
-
post_install_message:
|
175
|
+
post_install_message: |
|
176
|
+
DEPRECATION NOTICE: shrine-lambda gem will be renamed to shrine-aws-lambda for clarity
|
177
|
+
|
178
|
+
The current version, 0.1.1, is the last version under the shrine-lambda name.
|
179
|
+
|
180
|
+
Thank you for using this gem!
|
175
181
|
rdoc_options: []
|
176
182
|
require_paths:
|
177
183
|
- lib/shrine/plugins
|
@@ -186,8 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
192
|
- !ruby/object:Gem::Version
|
187
193
|
version: '0'
|
188
194
|
requirements: []
|
189
|
-
rubygems_version: 3.0.
|
190
|
-
signing_key:
|
195
|
+
rubygems_version: 3.0.3
|
196
|
+
signing_key:
|
191
197
|
specification_version: 4
|
192
198
|
summary: AWS Lambda integration plugin for Shrine.
|
193
199
|
test_files: []
|