jets-gems 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/jets/gems/check.rb +52 -3
- data/lib/jets/gems/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3900daa6e68d0711a454fd08be5d54fda92c5e708487adb6ce4858d28eed650
|
4
|
+
data.tar.gz: f91d1570dd62554d97ed3829cd921341f37581341146aef51c1927fa4752c5a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8882ef6371603fd9e87b3baccd182e39598f04d0039a21f62cdfcd52cfa7152d0c895eb903cf7381f96f84c73f3b2bb1e499252c9c17a69bbfdd79872736f7b1
|
7
|
+
data.tar.gz: 52c29cd14d0ee088172cde2d74c8a76b821fb21c2425ac02c8f23e84746e9e2976bd386a27933a2079602c392617c965e66073c9cfe91b9429f9769c9700c460
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
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.2.2]
|
7
|
+
- #3 fix for afterburner mode, change option to use_gemspec
|
8
|
+
|
6
9
|
## [0.2.1]
|
7
10
|
- #2 improve compiled gem detection
|
8
11
|
|
data/lib/jets/gems/check.rb
CHANGED
@@ -119,12 +119,61 @@ EOL
|
|
119
119
|
# * Went to selective checking approach with `cli: true` option. This helped gather more data.
|
120
120
|
# * jets deploy - compiled_gem_paths
|
121
121
|
# * jets gems:check - gemspec_compiled_gems
|
122
|
-
# * Going back to compiled_gem_paths with
|
122
|
+
# * Going back to compiled_gem_paths with:
|
123
123
|
# * Using the `weird_gem?` check to filter out gems removed by bundler. Note: Only happens with specific versions of json.
|
124
|
-
#
|
124
|
+
# * Keeping compiled_gem_paths for Jets Afterburner mode. Default to gemspec_compiled_gems otherwise
|
125
|
+
#
|
125
126
|
#
|
126
127
|
def compiled_gems
|
127
|
-
|
128
|
+
# @use_gemspec option finds compile gems with Gem::Specification
|
129
|
+
# The normal build process does not use this and checks the file system.
|
130
|
+
# So @use_gemspec is only used for this command:
|
131
|
+
#
|
132
|
+
# jets gems:check
|
133
|
+
#
|
134
|
+
# This is because it seems like some gems like json are remove and screws things up.
|
135
|
+
# We'll filter out for the json gem as a hacky workaround, unsure if there are more
|
136
|
+
# gems though that exhibit this behavior.
|
137
|
+
if @options[:use_gemspec] == false
|
138
|
+
# Afterburner mode
|
139
|
+
compiled_gems = compiled_gem_paths.map { |p| gem_name_from_path(p) }.uniq
|
140
|
+
# Double check that the gems are also in the gemspec list since that
|
141
|
+
# one is scoped to Bundler and will only included gems used in the project.
|
142
|
+
# This handles the possiblity of stale gems leftover from previous builds
|
143
|
+
# in the cache.
|
144
|
+
# TODO: figure out if we need
|
145
|
+
# compiled_gems.select { |g| gemspec_compiled_gems.include?(g) }
|
146
|
+
else
|
147
|
+
# default when use_gemspec not set
|
148
|
+
#
|
149
|
+
# jets deploy
|
150
|
+
# jets gems:check
|
151
|
+
#
|
152
|
+
gemspec_compiled_gems
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# Use pre-compiled gem because the gem could have development header shared
|
157
|
+
# object file dependencies. The shared dependencies are packaged up as part
|
158
|
+
# of the pre-compiled gem so it is available in the Lambda execution environment.
|
159
|
+
#
|
160
|
+
# Example paths:
|
161
|
+
# Macosx:
|
162
|
+
# opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/nokogiri-1.8.1
|
163
|
+
# opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
|
164
|
+
# Official AWS Lambda Linux AMI:
|
165
|
+
# opt/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/nokogiri-1.8.1
|
166
|
+
# Circleci Ubuntu based Linux:
|
167
|
+
# opt/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/pg-0.21.0
|
168
|
+
def compiled_gem_paths
|
169
|
+
Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/*/extensions/**/**/*.{so,bundle}")
|
170
|
+
end
|
171
|
+
|
172
|
+
# Input: opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
|
173
|
+
# Output: byebug-9.1.0
|
174
|
+
def gem_name_from_path(path)
|
175
|
+
regexp = %r{opt/ruby/gems/\d+\.\d+\.\d+/extensions/.*?/.*?/(.*?)/}
|
176
|
+
path.match(regexp)[1] # gem_name
|
128
177
|
end
|
129
178
|
|
130
179
|
# So can also check for compiled gems with Gem::Specification
|
data/lib/jets/gems/version.rb
CHANGED