serverlessgems 0.4.1 → 0.4.3
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/CHANGELOG.md +6 -0
- data/lib/jets/gems/check.rb +6 -6
- data/lib/jets/gems/extract/gem.rb +56 -0
- data/lib/jets/gems/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3bf2582904ec4259bc6d3b6d0ebcf407e2a3061c5c32c49f1c96c23d46d28048
|
|
4
|
+
data.tar.gz: fb74483267d8a14301e6bb9f1ff1b9f8eae28227ae0b9895ad7853426103a46d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ee67a43c0eb68cbddab1a0e7b1aa3b7739c56d43df9f0e1aa91e6a5f9d23630b325ffe01ced97febf178cb991a4068499c07d938221f6c7577965b974809ed9
|
|
7
|
+
data.tar.gz: 9bf66559b45718864229297600d8e4d9b85a341d5e63d20f34c61ebde5ac66c467b4d34dbb9f41b296a97cda5833f7540c6e76d0d217bd229743909d02d759b5
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.4.3] - 2025-10-11
|
|
7
|
+
- fix clean up gem variants
|
|
8
|
+
|
|
9
|
+
## [0.4.2] - 2025-10-10
|
|
10
|
+
- fix gem detection ffi - gnu suffix and clean up incompatible platform variants
|
|
11
|
+
|
|
6
12
|
## [0.4.1] - 2024-06-22
|
|
7
13
|
- standardrb and updates
|
|
8
14
|
|
data/lib/jets/gems/check.rb
CHANGED
|
@@ -56,9 +56,9 @@ module Jets::Gems
|
|
|
56
56
|
* Unavailable: <%= missing_gem['gem_name'] -%> Available versions: <%= available.join(' ') %>
|
|
57
57
|
<% end %>
|
|
58
58
|
Your current serverlessgems source: #{gems_source}
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
Jets is unable to build a deployment package that will work on AWS Lambda without the required pre-compiled gems. To remedy this, you can:
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
* Use another gem that does not require compilation.
|
|
63
63
|
* Create your own custom layer with the gem: http://rubyonjets.com/docs/extras/custom-lambda-layers/
|
|
64
64
|
<% if agree.yes? -%>
|
|
@@ -72,10 +72,10 @@ module Jets::Gems
|
|
|
72
72
|
* You can try redeploying again after a few minutes.
|
|
73
73
|
* Non-reported gems may take days or even longer to be built.
|
|
74
74
|
<% end -%>
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
Compiled gems usually take some time to figure out how to build as they each depend on different libraries and packages.
|
|
77
77
|
More info: http://rubyonjets.com/docs/serverlessgems/
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
EOL
|
|
80
80
|
erb = ERB.new(template, trim_mode: "-") # trim mode https://stackoverflow.com/questions/4632879/erb-template-removing-the-trailing-line
|
|
81
81
|
erb.result(binding)
|
|
@@ -156,9 +156,9 @@ module Jets::Gems
|
|
|
156
156
|
# On new 2021 macbook with m1 chip: the gems are being saved in a folder like so:
|
|
157
157
|
# nokogiri-1.12.5-arm64-darwin
|
|
158
158
|
# The GEM_REGEXP accounts for this case.
|
|
159
|
-
GEM_REGEXP = /-(arm|x)\d+.*-(darwin|linux)
|
|
159
|
+
GEM_REGEXP = /-(arm|x|aarch)\d+.*-(darwin|linux)(?:-gnu)?/
|
|
160
160
|
def other_compiled_gems
|
|
161
|
-
paths = Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems/*{-darwin,-linux}")
|
|
161
|
+
paths = Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems/*{-darwin,-linux}*")
|
|
162
162
|
paths.map { |p| File.basename(p).sub(GEM_REGEXP, "") }
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -19,6 +19,62 @@ module Jets::Gems::Extract
|
|
|
19
19
|
say "Unpacking into #{dest}"
|
|
20
20
|
FileUtils.mkdir_p(dest)
|
|
21
21
|
unzip(zipfile_path, dest)
|
|
22
|
+
cleanup_incompatible_platform_variants
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Removes incompatible platform variants to prevent RubyGems from choosing the wrong one
|
|
26
|
+
# For AWS Lambda, we want to keep only x86_64-linux variants and remove others
|
|
27
|
+
def cleanup_incompatible_platform_variants
|
|
28
|
+
gems_dir = "#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems"
|
|
29
|
+
specs_dir = "#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/specifications"
|
|
30
|
+
return unless Dir.exist?(gems_dir)
|
|
31
|
+
|
|
32
|
+
# Find all gem directories for this gem name
|
|
33
|
+
gem_dirs = Dir.glob("#{gems_dir}/#{gem_name}-*").select do |path|
|
|
34
|
+
File.directory?(path) && File.basename(path).start_with?(gem_name)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Group by base gem name (without platform suffix)
|
|
38
|
+
gem_groups = {}
|
|
39
|
+
gem_dirs.each do |dir|
|
|
40
|
+
name = File.basename(dir)
|
|
41
|
+
# Handle platform-specific gem names like nokogiri-1.18.10-x86_64-linux-gnu
|
|
42
|
+
base_name = name.sub(/-(x86_64-linux-gnu|aarch64-linux-gnu|arm64-linux-gnu|i386-linux-gnu|powerpc-linux-gnu|sparc-linux-gnu|mips-linux-gnu|riscv-linux-gnu|loongarch-linux-gnu|sw_64-linux-gnu|hppa-linux-gnu|ia64-linux-gnu|s390-linux-gnu|x86_64|arm64|aarch64|i386|powerpc|sparc|mips|riscv|loongarch|sw_64|hppa|ia64|s390).*/, "")
|
|
43
|
+
gem_groups[base_name] ||= []
|
|
44
|
+
gem_groups[base_name] << {dir: dir, name: name}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# For each gem group, clean up platform variants
|
|
48
|
+
gem_groups.each { |base_name, variants| cleanup_gem_variants(base_name, variants, specs_dir) }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Clean up platform variants for a specific gem group
|
|
52
|
+
def cleanup_gem_variants(base_name, variants, specs_dir)
|
|
53
|
+
return if variants.size <= 1 # No cleanup needed if only one variant
|
|
54
|
+
|
|
55
|
+
say "Found #{variants.size} platform variants for #{base_name}:"
|
|
56
|
+
variants.each { |v| say " - #{v[:name]}" }
|
|
57
|
+
|
|
58
|
+
# Always favor base gem variants (without platform suffix) - these are from Jets API
|
|
59
|
+
# Remove all platform-specific variants
|
|
60
|
+
base_variants = variants.select { |v| !v[:name].match(/-[^-]+-[^-]+$/) }
|
|
61
|
+
platform_variants = variants - base_variants
|
|
62
|
+
|
|
63
|
+
keep_variants = base_variants.any? ? base_variants : variants
|
|
64
|
+
remove_variants = platform_variants
|
|
65
|
+
|
|
66
|
+
say "Keeping: #{keep_variants.map { |v| v[:name] }.join(", ")}"
|
|
67
|
+
say "Removing: #{remove_variants.map { |v| v[:name] }.join(", ")}"
|
|
68
|
+
|
|
69
|
+
# Remove incompatible variants
|
|
70
|
+
remove_variants.each do |variant|
|
|
71
|
+
say "Removing incompatible variant: #{variant[:name]}"
|
|
72
|
+
FileUtils.rm_rf(variant[:dir])
|
|
73
|
+
|
|
74
|
+
# Also remove the corresponding gemspec
|
|
75
|
+
gemspec_path = "#{specs_dir}/#{variant[:name]}.gemspec"
|
|
76
|
+
FileUtils.rm_f(gemspec_path) if File.exist?(gemspec_path)
|
|
77
|
+
end
|
|
22
78
|
end
|
|
23
79
|
|
|
24
80
|
# ensure that we always have the full gem name
|
data/lib/jets/gems/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: serverlessgems
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tung Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-10-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gems
|
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
146
146
|
- !ruby/object:Gem::Version
|
|
147
147
|
version: '0'
|
|
148
148
|
requirements: []
|
|
149
|
-
rubygems_version: 3.
|
|
149
|
+
rubygems_version: 3.4.19
|
|
150
150
|
signing_key:
|
|
151
151
|
specification_version: 4
|
|
152
152
|
summary: Client Library works with Serverless Gems API for Jets Ruby Serverless Framework
|