jets-gems 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24939370b906b38f2a866ef99ef40d0dae0b24ad8e4b123f109aebdddc509cb0
4
- data.tar.gz: d46de1b1dd659bf4d4a17e2bfa806ab19d71efb9c7d60de029c2b0f4d381ae96
3
+ metadata.gz: e3900daa6e68d0711a454fd08be5d54fda92c5e708487adb6ce4858d28eed650
4
+ data.tar.gz: f91d1570dd62554d97ed3829cd921341f37581341146aef51c1927fa4752c5a9
5
5
  SHA512:
6
- metadata.gz: 1ece2839d612ee13f68675d849e1b593534afd5bbfaa3c38f0f228ce4ce07e417fe3cce47e231cadbfd9ff3bde3b319bde08df42ca3f234c7b686eb6d57beefc
7
- data.tar.gz: 011fa4f8ff8357f51fd2f94b3332ba2ba069b1feb8e3fd887acbd65d5e2fb48c17f5ac064fa256e27d2ff012972c6c7e19c997add9845873d50857b401427a89
6
+ metadata.gz: 8882ef6371603fd9e87b3baccd182e39598f04d0039a21f62cdfcd52cfa7152d0c895eb903cf7381f96f84c73f3b2bb1e499252c9c17a69bbfdd79872736f7b1
7
+ data.tar.gz: 52c29cd14d0ee088172cde2d74c8a76b821fb21c2425ac02c8f23e84746e9e2976bd386a27933a2079602c392617c965e66073c9cfe91b9429f9769c9700c460
@@ -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
 
@@ -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
- # * Removed compiled_gem_paths and compiled_gem_paths methods. Can get it from git history if needed again.
124
+ # * Keeping compiled_gem_paths for Jets Afterburner mode. Default to gemspec_compiled_gems otherwise
125
+ #
125
126
  #
126
127
  def compiled_gems
127
- gemspec_compiled_gems
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
@@ -1,5 +1,5 @@
1
1
  module Jets
2
2
  module Gems
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets-gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen