jets 1.0.1 → 1.0.2
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 +4 -4
- data/.gitmodules +3 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +23 -1
- data/jets.gemspec +1 -2
- data/lib/jets.rb +5 -11
- data/lib/jets/builders/gem_replacer.rb +12 -96
- data/lib/jets/builders/ruby_packager.rb +3 -4
- data/lib/jets/builders/tidy.rb +9 -0
- data/lib/jets/commands.rb +1 -0
- data/lib/jets/commands/base.rb +10 -1
- data/lib/jets/commands/gems.rb +25 -0
- data/lib/jets/commands/help/gems/check.md +7 -0
- data/lib/jets/commands/help/import/rails.md +3 -3
- data/lib/jets/commands/import.rb +4 -0
- data/lib/jets/commands/import/base.rb +10 -0
- data/lib/jets/commands/import/cheatsheet.rb +35 -0
- data/lib/jets/commands/import/rail.rb +7 -0
- data/lib/jets/commands/import/sequence.rb +63 -47
- data/lib/jets/commands/import/templates/submodules-cheatsheet.md +89 -0
- data/lib/jets/db.rb +9 -0
- data/lib/jets/version.rb +1 -1
- data/vendor/jets-gems/Gemfile +6 -0
- data/vendor/jets-gems/Gemfile.lock +39 -0
- data/vendor/jets-gems/LICENSE.txt +21 -0
- data/vendor/jets-gems/README.md +19 -0
- data/vendor/{lambdagem → jets-gems}/Rakefile +2 -2
- data/vendor/jets-gems/bin/console +14 -0
- data/vendor/jets-gems/bin/setup +8 -0
- data/vendor/jets-gems/jets-gems.gemspec +30 -0
- data/vendor/jets-gems/lib/jets-gems.rb +1 -0
- data/vendor/jets-gems/lib/jets/gems.rb +16 -0
- data/vendor/jets-gems/lib/jets/gems/check.rb +156 -0
- data/vendor/jets-gems/lib/jets/gems/exist.rb +54 -0
- data/vendor/jets-gems/lib/jets/gems/extract.rb +7 -0
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/base.rb +25 -6
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/gem.rb +10 -8
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/ruby.rb +6 -7
- data/vendor/jets-gems/lib/jets/gems/report.rb +53 -0
- data/vendor/jets-gems/lib/jets/gems/version.rb +5 -0
- data/vendor/jets-gems/spec/jets/gems_spec.rb +5 -0
- data/vendor/jets-gems/spec/spec_helper.rb +14 -0
- metadata +41 -53
- data/vendor/lambdagem/CHANGELOG.md +0 -27
- data/vendor/lambdagem/Gemfile +0 -6
- data/vendor/lambdagem/Gemfile.lock +0 -73
- data/vendor/lambdagem/Guardfile +0 -12
- data/vendor/lambdagem/LICENSE.txt +0 -22
- data/vendor/lambdagem/README.md +0 -139
- data/vendor/lambdagem/exe/lambdagem +0 -14
- data/vendor/lambdagem/lambdagem.gemspec +0 -32
- data/vendor/lambdagem/lib/lambdagem.rb +0 -18
- data/vendor/lambdagem/lib/lambdagem/base.rb +0 -53
- data/vendor/lambdagem/lib/lambdagem/build.rb +0 -202
- data/vendor/lambdagem/lib/lambdagem/clean.rb +0 -8
- data/vendor/lambdagem/lib/lambdagem/cli.rb +0 -62
- data/vendor/lambdagem/lib/lambdagem/command.rb +0 -38
- data/vendor/lambdagem/lib/lambdagem/exist.rb +0 -50
- data/vendor/lambdagem/lib/lambdagem/extract.rb +0 -8
- data/vendor/lambdagem/lib/lambdagem/extract/class_methods.rb +0 -50
- data/vendor/lambdagem/lib/lambdagem/help.rb +0 -9
- data/vendor/lambdagem/lib/lambdagem/help/all.md +0 -11
- data/vendor/lambdagem/lib/lambdagem/help/build.md +0 -14
- data/vendor/lambdagem/lib/lambdagem/help/clean.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/extract_gem.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/extract_ruby.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/package.md +0 -20
- data/vendor/lambdagem/lib/lambdagem/help/upload.md +0 -7
- data/vendor/lambdagem/lib/lambdagem/package.rb +0 -33
- data/vendor/lambdagem/lib/lambdagem/upload.rb +0 -39
- data/vendor/lambdagem/lib/lambdagem/util.rb +0 -30
- data/vendor/lambdagem/lib/lambdagem/version.rb +0 -3
- data/vendor/lambdagem/spec/lib/build_spec.rb +0 -32
- data/vendor/lambdagem/spec/lib/cli_spec.rb +0 -24
- data/vendor/lambdagem/spec/lib/upload_spec.rb +0 -25
- data/vendor/lambdagem/spec/spec_helper.rb +0 -24
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "jets/gems"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: gems
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: hashie
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,20 +332,6 @@ dependencies:
|
|
318
332
|
- - ">="
|
319
333
|
- !ruby/object:Gem::Version
|
320
334
|
version: '0'
|
321
|
-
- !ruby/object:Gem::Dependency
|
322
|
-
name: gems
|
323
|
-
requirement: !ruby/object:Gem::Requirement
|
324
|
-
requirements:
|
325
|
-
- - ">="
|
326
|
-
- !ruby/object:Gem::Version
|
327
|
-
version: '0'
|
328
|
-
type: :runtime
|
329
|
-
prerelease: false
|
330
|
-
version_requirements: !ruby/object:Gem::Requirement
|
331
|
-
requirements:
|
332
|
-
- - ">="
|
333
|
-
- !ruby/object:Gem::Version
|
334
|
-
version: '0'
|
335
335
|
- !ruby/object:Gem::Dependency
|
336
336
|
name: byebug
|
337
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -496,6 +496,7 @@ files:
|
|
496
496
|
- lib/jets/commands/dynamodb.rb
|
497
497
|
- lib/jets/commands/dynamodb/migrate.rb
|
498
498
|
- lib/jets/commands/dynamodb/migrator.rb
|
499
|
+
- lib/jets/commands/gems.rb
|
499
500
|
- lib/jets/commands/help.rb
|
500
501
|
- lib/jets/commands/help/build.md
|
501
502
|
- lib/jets/commands/help/call.md
|
@@ -508,6 +509,7 @@ files:
|
|
508
509
|
- lib/jets/commands/help/deploy.md
|
509
510
|
- lib/jets/commands/help/dynamodb/generate.md
|
510
511
|
- lib/jets/commands/help/dynamodb/migrate.md
|
512
|
+
- lib/jets/commands/help/gems/check.md
|
511
513
|
- lib/jets/commands/help/generate.md
|
512
514
|
- lib/jets/commands/help/import/rack.md
|
513
515
|
- lib/jets/commands/help/import/rails.md
|
@@ -519,9 +521,11 @@ files:
|
|
519
521
|
- lib/jets/commands/help/url.md
|
520
522
|
- lib/jets/commands/import.rb
|
521
523
|
- lib/jets/commands/import/base.rb
|
524
|
+
- lib/jets/commands/import/cheatsheet.rb
|
522
525
|
- lib/jets/commands/import/rack.rb
|
523
526
|
- lib/jets/commands/import/rail.rb
|
524
527
|
- lib/jets/commands/import/sequence.rb
|
528
|
+
- lib/jets/commands/import/templates/submodules-cheatsheet.md
|
525
529
|
- lib/jets/commands/main.rb
|
526
530
|
- lib/jets/commands/markdown.rb
|
527
531
|
- lib/jets/commands/markdown/creator.rb
|
@@ -591,6 +595,7 @@ files:
|
|
591
595
|
- lib/jets/controller/response.rb
|
592
596
|
- lib/jets/core.rb
|
593
597
|
- lib/jets/core_ext/kernel.rb
|
598
|
+
- lib/jets/db.rb
|
594
599
|
- lib/jets/default/application.rb
|
595
600
|
- lib/jets/dotenv.rb
|
596
601
|
- lib/jets/erb.rb
|
@@ -747,43 +752,26 @@ files:
|
|
747
752
|
- vendor/dynomite/spec/lib/dynomite/migration/generator_spec.rb
|
748
753
|
- vendor/dynomite/spec/lib/dynomite/migration_spec.rb
|
749
754
|
- vendor/dynomite/spec/spec_helper.rb
|
750
|
-
- vendor/
|
751
|
-
- vendor/
|
752
|
-
- vendor/
|
753
|
-
- vendor/
|
754
|
-
- vendor/
|
755
|
-
- vendor/
|
756
|
-
- vendor/
|
757
|
-
- vendor/
|
758
|
-
- vendor/
|
759
|
-
- vendor/
|
760
|
-
- vendor/
|
761
|
-
- vendor/
|
762
|
-
- vendor/
|
763
|
-
- vendor/
|
764
|
-
- vendor/
|
765
|
-
- vendor/
|
766
|
-
- vendor/
|
767
|
-
- vendor/
|
768
|
-
- vendor/
|
769
|
-
- vendor/
|
770
|
-
- vendor/lambdagem/lib/lambdagem/extract/ruby.rb
|
771
|
-
- vendor/lambdagem/lib/lambdagem/help.rb
|
772
|
-
- vendor/lambdagem/lib/lambdagem/help/all.md
|
773
|
-
- vendor/lambdagem/lib/lambdagem/help/build.md
|
774
|
-
- vendor/lambdagem/lib/lambdagem/help/clean.md
|
775
|
-
- vendor/lambdagem/lib/lambdagem/help/extract_gem.md
|
776
|
-
- vendor/lambdagem/lib/lambdagem/help/extract_ruby.md
|
777
|
-
- vendor/lambdagem/lib/lambdagem/help/package.md
|
778
|
-
- vendor/lambdagem/lib/lambdagem/help/upload.md
|
779
|
-
- vendor/lambdagem/lib/lambdagem/package.rb
|
780
|
-
- vendor/lambdagem/lib/lambdagem/upload.rb
|
781
|
-
- vendor/lambdagem/lib/lambdagem/util.rb
|
782
|
-
- vendor/lambdagem/lib/lambdagem/version.rb
|
783
|
-
- vendor/lambdagem/spec/lib/build_spec.rb
|
784
|
-
- vendor/lambdagem/spec/lib/cli_spec.rb
|
785
|
-
- vendor/lambdagem/spec/lib/upload_spec.rb
|
786
|
-
- vendor/lambdagem/spec/spec_helper.rb
|
755
|
+
- vendor/jets-gems/Gemfile
|
756
|
+
- vendor/jets-gems/Gemfile.lock
|
757
|
+
- vendor/jets-gems/LICENSE.txt
|
758
|
+
- vendor/jets-gems/README.md
|
759
|
+
- vendor/jets-gems/Rakefile
|
760
|
+
- vendor/jets-gems/bin/console
|
761
|
+
- vendor/jets-gems/bin/setup
|
762
|
+
- vendor/jets-gems/jets-gems.gemspec
|
763
|
+
- vendor/jets-gems/lib/jets-gems.rb
|
764
|
+
- vendor/jets-gems/lib/jets/gems.rb
|
765
|
+
- vendor/jets-gems/lib/jets/gems/check.rb
|
766
|
+
- vendor/jets-gems/lib/jets/gems/exist.rb
|
767
|
+
- vendor/jets-gems/lib/jets/gems/extract.rb
|
768
|
+
- vendor/jets-gems/lib/jets/gems/extract/base.rb
|
769
|
+
- vendor/jets-gems/lib/jets/gems/extract/gem.rb
|
770
|
+
- vendor/jets-gems/lib/jets/gems/extract/ruby.rb
|
771
|
+
- vendor/jets-gems/lib/jets/gems/report.rb
|
772
|
+
- vendor/jets-gems/lib/jets/gems/version.rb
|
773
|
+
- vendor/jets-gems/spec/jets/gems_spec.rb
|
774
|
+
- vendor/jets-gems/spec/spec_helper.rb
|
787
775
|
homepage: http://rubyonjets.com
|
788
776
|
licenses:
|
789
777
|
- MIT
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Change Log
|
2
|
-
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
|
-
|
6
|
-
## [0.5.1]
|
7
|
-
- use say meth for extract classes so we can keep the noise down from the jets side
|
8
|
-
|
9
|
-
## [0.5.0]
|
10
|
-
- add lambdagem_url support
|
11
|
-
|
12
|
-
## [0.4.0]
|
13
|
-
- use jets ruby version 2.5.0 for 2.5.x ruby variants
|
14
|
-
- fix lambdagem ruby extraction
|
15
|
-
|
16
|
-
## [0.3.0]
|
17
|
-
- default to lambdagems bucket
|
18
|
-
- allow extracting different ruby versions easily
|
19
|
-
- tidy up and remove unnecessary files from gems after building
|
20
|
-
- add lambda exist class: useful as an ruby api
|
21
|
-
|
22
|
-
## [0.2.1]
|
23
|
-
- Fix gemspec.
|
24
|
-
|
25
|
-
## [0.2.0]
|
26
|
-
- Initial release.
|
27
|
-
- lambdagem build, package, upload, all extract_gem, extract_ruby, clean commands
|
data/vendor/lambdagem/Gemfile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
lambdagem (0.5.1)
|
5
|
-
aws-sdk-s3
|
6
|
-
colorize
|
7
|
-
gems
|
8
|
-
hashie
|
9
|
-
thor
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: https://rubygems.org/
|
13
|
-
specs:
|
14
|
-
aws-eventstream (1.0.1)
|
15
|
-
aws-partitions (1.100.0)
|
16
|
-
aws-sdk-core (3.24.1)
|
17
|
-
aws-eventstream (~> 1.0)
|
18
|
-
aws-partitions (~> 1.0)
|
19
|
-
aws-sigv4 (~> 1.0)
|
20
|
-
jmespath (~> 1.0)
|
21
|
-
aws-sdk-kms (1.7.0)
|
22
|
-
aws-sdk-core (~> 3)
|
23
|
-
aws-sigv4 (~> 1.0)
|
24
|
-
aws-sdk-s3 (1.17.0)
|
25
|
-
aws-sdk-core (~> 3, >= 3.21.2)
|
26
|
-
aws-sdk-kms (~> 1)
|
27
|
-
aws-sigv4 (~> 1.0)
|
28
|
-
aws-sigv4 (1.0.3)
|
29
|
-
byebug (10.0.2)
|
30
|
-
codeclimate-test-reporter (1.0.8)
|
31
|
-
simplecov (<= 0.13)
|
32
|
-
colorize (0.8.1)
|
33
|
-
diff-lcs (1.3)
|
34
|
-
docile (1.1.5)
|
35
|
-
gems (1.1.1)
|
36
|
-
json
|
37
|
-
hashie (3.6.0)
|
38
|
-
jmespath (1.4.0)
|
39
|
-
json (2.1.0)
|
40
|
-
rake (12.3.1)
|
41
|
-
rspec (3.8.0)
|
42
|
-
rspec-core (~> 3.8.0)
|
43
|
-
rspec-expectations (~> 3.8.0)
|
44
|
-
rspec-mocks (~> 3.8.0)
|
45
|
-
rspec-core (3.8.0)
|
46
|
-
rspec-support (~> 3.8.0)
|
47
|
-
rspec-expectations (3.8.1)
|
48
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.8.0)
|
50
|
-
rspec-mocks (3.8.0)
|
51
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.8.0)
|
53
|
-
rspec-support (3.8.0)
|
54
|
-
simplecov (0.13.0)
|
55
|
-
docile (~> 1.1.0)
|
56
|
-
json (>= 1.8, < 3)
|
57
|
-
simplecov-html (~> 0.10.0)
|
58
|
-
simplecov-html (0.10.2)
|
59
|
-
thor (0.20.0)
|
60
|
-
|
61
|
-
PLATFORMS
|
62
|
-
ruby
|
63
|
-
|
64
|
-
DEPENDENCIES
|
65
|
-
bundler
|
66
|
-
byebug
|
67
|
-
codeclimate-test-reporter
|
68
|
-
lambdagem!
|
69
|
-
rake
|
70
|
-
rspec
|
71
|
-
|
72
|
-
BUNDLED WITH
|
73
|
-
1.16.3
|
data/vendor/lambdagem/Guardfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
guard "rspec" do
|
2
|
-
watch(%r{^spec/.+_spec\.rb$})
|
3
|
-
watch(%r{^lib/(.+)\.rb$}) { "spec/lambdagem_spec.rb" }
|
4
|
-
watch(%r{^lib/lambdagem/(.+)\.rb$}) { "spec/lambdagem_spec.rb" }
|
5
|
-
watch("spec/spec_helper.rb") { "spec/lambdagem_spec.rb" }
|
6
|
-
watch(%r{^lib/lambdagem/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
-
end
|
8
|
-
|
9
|
-
guard "bundler" do
|
10
|
-
watch("Gemfile")
|
11
|
-
watch(/^.+\.gemspec/)
|
12
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Tung Nguyen
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/vendor/lambdagem/README.md
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
# Lambdagem
|
2
|
-
|
3
|
-
Tool to manage gems designed for AWS Lambda. Some gems require compiled binary dependencies. Lambdagem is useful for handling these types of gems. This tool does the following:
|
4
|
-
|
5
|
-
* Builds, packages, and uploads a gem artifact to s3.
|
6
|
-
* Downloads and extracts the gem from s3 in a consistent fashion.
|
7
|
-
|
8
|
-
## Summary
|
9
|
-
|
10
|
-
Summary of the important folders and files:
|
11
|
-
|
12
|
-
Folder | Description
|
13
|
-
------------- | -------------
|
14
|
-
/tmp/lambdagem | Original area where gem is built. You can find the generated Gemfile in here.
|
15
|
-
/tmp/lambdagem/bundled/gems | Where built gems are vendored.
|
16
|
-
/tmp/lambdagem/artifacts/byebug-9.1.0/bundled | Folder where the slimmed version of the artifacts are copied over. Care is taken to include only the necessary files to keep the size small.
|
17
|
-
/tmp/lambdagem/artifacts/byebug-9.1.0-x86_64-linux.tgz | The created tarball. The tarball contains "bundled" folder which contain the original underlying folder structure.
|
18
|
-
s3://lambdagems/gems/2.5.0/byebug/byebug-9.1.0-x86_64-linux.tgz | Example bucket path where the tarball gets uploaded. The tgz file contains the containing `bundled` folder.
|
19
|
-
|
20
|
-
## Usage
|
21
|
-
|
22
|
-
### Build Gem
|
23
|
-
|
24
|
-
The build command should be run on an AWS Lambda AMI EC2 instance. To build the latest version of a gem:
|
25
|
-
|
26
|
-
```sh
|
27
|
-
lambdagem build byebug
|
28
|
-
```
|
29
|
-
|
30
|
-
The gem gets built in the `/tmp/lambdagem` folder and is vendored to `/tmp/lambdagem/bundled/gems`. The `/tmp/lambdagem` folder is cleared out at the beginning of each run. To build a specific version append the version to the name like so:
|
31
|
-
|
32
|
-
```sh
|
33
|
-
lambdagem build byebug-0.9.1
|
34
|
-
```
|
35
|
-
|
36
|
-
The build command produces a `bundled` folder containing the gem and any compiled .so extensions belonging to the gem.
|
37
|
-
|
38
|
-
The bundled folder does not include system library files outside of the gem. The bundled folder is left in place though so that additional scripts can add system library dependencies to the same bundled folder. If there are no system dependencies to be added, move onto creating the tarball package.
|
39
|
-
|
40
|
-
To package up the bundled folder into a tarball:
|
41
|
-
|
42
|
-
```sh
|
43
|
-
lambda package byebug
|
44
|
-
```
|
45
|
-
|
46
|
-
The package command produces a compressed tarball that contains the bundled folder and its binary extensions. Lambdagem temporarily stores the tarball at:
|
47
|
-
|
48
|
-
```
|
49
|
-
/tmp/lambdagem/artifacts/byebug-9.1.0-x86_64-linux.tar.gz
|
50
|
-
```
|
51
|
-
|
52
|
-
Next, upload to s3:
|
53
|
-
|
54
|
-
```sh
|
55
|
-
lambdagem upload byebug --s3 S3_BUCKET
|
56
|
-
```
|
57
|
-
|
58
|
-
The file will be uploaded to s3 with this path structure:
|
59
|
-
|
60
|
-
```
|
61
|
-
s3://S3_BUCKET/gems/MINOR_RUBY_VERSION/byebug/byebug-9.1.0-x86_64-linux.tgz
|
62
|
-
```
|
63
|
-
|
64
|
-
Gems uploaded to s3 are public-read by default. You can override this behavior by setting the environment variable `LAMBDAGEM_S3_ACL=private`.
|
65
|
-
|
66
|
-
### Extract Gem
|
67
|
-
|
68
|
-
The extract command can be run from any environment. Though the extracted gems will only work in an AWS Lambda Linux based environment.
|
69
|
-
|
70
|
-
The `--s3` option is required for the extract command. Here's an example how you would download a gem from s3 and extracts it in a standard way:
|
71
|
-
|
72
|
-
```sh
|
73
|
-
lambdagem extract byebug-0.9.1 --s3 lambdagems
|
74
|
-
```
|
75
|
-
|
76
|
-
This extracts the gem and produces a top-level `bundled` folder. This bundled folded is meant to be added to your project folder.
|
77
|
-
|
78
|
-
AWS Lambda extracts your code to `/var/task` so this will result in producing a final `/var/task/bundled` folder in the Lambda environment.
|
79
|
-
|
80
|
-
# Concepts to Understand
|
81
|
-
|
82
|
-
To understand how this tool works it is helpful to see how ruby structures gems on the file system. The `lambdagem build` command makes a lot more sense when you understand the underlying structure.
|
83
|
-
|
84
|
-
## Bundling
|
85
|
-
|
86
|
-
There are 2 important folders to under the `bundled/gems` folder: gems and extensions. Here are their paths with some helpful surrounding context:
|
87
|
-
|
88
|
-
* bundled/gems/ruby/2.5.0/gems/byebug-9.1.0
|
89
|
-
* bundled/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/byebug-9.1.0
|
90
|
-
|
91
|
-
Here are the relevant parts of the tree structure to help further understand:
|
92
|
-
|
93
|
-
```sh
|
94
|
-
$ tree -L 4 bundled/gems/ruby/2.5.0 # deleted some info to keep short
|
95
|
-
bundled/gems/ruby/2.5.0
|
96
|
-
├── extensions
|
97
|
-
│ └── x86_64-linux
|
98
|
-
│ └── 2.5.0-static
|
99
|
-
│ └── byebug-9.1.0
|
100
|
-
│── gems
|
101
|
-
│ └── byebug-9.1.0
|
102
|
-
└── specifications
|
103
|
-
$
|
104
|
-
```
|
105
|
-
|
106
|
-
So the strategy we'll employ is to tarball up the relevant gem folders from underneath the `bundled/gems/ruby/2.5.0` folder:
|
107
|
-
|
108
|
-
* 2.5.0/gems/byebug-9.1.0
|
109
|
-
* 2.5.0/extensions/x86_64-linux/2.5.0-static/byebug-9.1.0
|
110
|
-
* 2.5.0/specifications
|
111
|
-
|
112
|
-
We will then be able to extract the `bundled` folder and reproduce the `bundled/gems/ruby` path structure.
|
113
|
-
|
114
|
-
The tarball could be named `bundled.tgz` to be consistent with the `bundled` folder that is packaged up, but we elect to name the file with the gem info instead, example: `byebug-9.1.0-x86_64-linux.tgz`.
|
115
|
-
|
116
|
-
## S3 Uploaded Path
|
117
|
-
|
118
|
-
The `byebug-9.1.0-x86_64-linux.tgz` file gets uploaded to s3 at following path:
|
119
|
-
|
120
|
-
* s3://S3_BUCKET/gems/2.5.0/byebug/byebug-9.1.0-x86_64-linux.tgz
|
121
|
-
|
122
|
-
### Gem Extraction
|
123
|
-
|
124
|
-
To extract the gem and restore the directory structure, you can use the `lambdagem extract` command. Also understanding the underlying folder structure helps make clear what the `lambdagem extract` command does.
|
125
|
-
|
126
|
-
Reminder that 2 important folders to under the `bundled/gems/ruby/2.5.0` folder are: gems, extensions and specifications. Here are their paths with some helpful surrounding context:
|
127
|
-
|
128
|
-
* bundled/gems/ruby/2.5.0/gems/byebug-9.1.0
|
129
|
-
* bundled/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/byebug-9.1.0
|
130
|
-
* specifications
|
131
|
-
|
132
|
-
The `lambdagem extract` command should be run at the root of the project because it contains files for `bundled` folder with the original path structure.
|
133
|
-
|
134
|
-
Lambdagem will untar the file and **replace** the relevant folders under the `bundle/gems/ruby/2.5.0` folder. For example, the existing gem folders will be deleted and replaced entirely:
|
135
|
-
|
136
|
-
* bundled/gems/ruby/2.5.0/gems/byebug-9.1.0
|
137
|
-
* bundled/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/byebug-9.1.0
|
138
|
-
|
139
|
-
Only the gem the `byebug-9.1.0` gem folders get replaced, the other gems are left alone. Extra system dependencies added under the `bundled` folder are also left untouched.
|