jets-gems 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d18468f092340cd60022baef19a0014e4c748e25cb8ffc2607d48999652d531
4
- data.tar.gz: 123290696ff086843bb334e6922804ab3f31e93c16dc8ad41ac54bc43c367725
3
+ metadata.gz: 24939370b906b38f2a866ef99ef40d0dae0b24ad8e4b123f109aebdddc509cb0
4
+ data.tar.gz: d46de1b1dd659bf4d4a17e2bfa806ab19d71efb9c7d60de029c2b0f4d381ae96
5
5
  SHA512:
6
- metadata.gz: 256c8573adf8312f191100e8c0750ca606fb8d19d3fca97bdb7e7671854cfbfd9e8d7314c201b1a9dc35615230cb5cb3388f41968c92619e64854130ca74fcdc
7
- data.tar.gz: a505aa3f8e16047620eb0d8c9b745eca1f51b3b84e1f3eb3c38f179795b7d7a5107c26c4097928e0e4ad317ca06253bdcf58266bd58ff8103a81cae8eb4b0132
6
+ metadata.gz: 1ece2839d612ee13f68675d849e1b593534afd5bbfaa3c38f0f228ce4ce07e417fe3cce47e231cadbfd9ff3bde3b319bde08df42ca3f234c7b686eb6d57beefc
7
+ data.tar.gz: 011fa4f8ff8357f51fd2f94b3332ba2ba069b1feb8e3fd887acbd65d5e2fb48c17f5ac064fa256e27d2ff012972c6c7e19c997add9845873d50857b401427a89
@@ -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.1]
7
+ - #2 improve compiled gem detection
8
+
6
9
  ## [0.2.0]
7
10
  - generalized weird_gem check
8
11
  - report ruby version also
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Jets Gems
2
2
 
3
+ [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
4
+
3
5
  [Jets](http://rubyonjets.com/) is a Ruby Serverless Framework on AWS Lambda. allows you to create serverless applications with a beautiful language: Ruby. It includes everything required to build an application and deploy it to AWS Lambda. Jets makes serverless simple.
4
6
 
5
7
  The jets-gems library works with Jets to download and extract pre-compiled gems that work on AWS Lambda.
@@ -10,7 +10,11 @@ module Jets::Gems
10
10
  return if File.exist?(@agree_file)
11
11
 
12
12
  puts <<~EOL
13
- Jets sends data about your gems to your specified lambda build service **lambdagems.com** so that it can compile and generate the necessary Lambda layers. Lambdagems only collects anonymous non-identifiable data.
13
+ Jets sends data about your gems to your specified lambda build service **lambdagems.com** so that it can compile and generate the necessary Lambda layers.
14
+
15
+ Reporting gems generally allows Lambdagems to build new gems within few minutes. So if you run into missing gems, you can try deploying again after a few minutes. Non-reported gems may take several days or longer.
16
+
17
+ Lambdagems only collects anonymous non-identifiable data.
14
18
 
15
19
  Is it okay to send your gem data to Lambdagems? (Y/n)?
16
20
  EOL
@@ -80,7 +80,10 @@ Jets is unable to build a deployment package that will work on AWS Lambda withou
80
80
  <% if agree.yes? -%>
81
81
  * No need to report this to us, as we've already been notified.
82
82
  <% elsif agree.no? -%>
83
- * You have choosen not to report data to lambdagems so we will not be notified about these missing gems. If you change your mind you can edit ~/.jets/agree
83
+ * You have choosen not to report data to lambdagems so we will not be notified about these missing gems. You can edit ~/.jets/agree to change this.
84
+ * Reporting gems generally allows Lambdagems to build the missing gems within a few minutes.
85
+ * You can try redeploying again after a few minutes.
86
+ * Non-reported gems may take days or even longer to be built.
84
87
  <% end -%>
85
88
 
86
89
  Compiled gems usually take some time to figure out how to build as they each depend on different libraries and packages.
@@ -96,53 +99,32 @@ EOL
96
99
  end
97
100
  memoize :agree
98
101
 
99
- # If there are subfolders compiled_gem_paths might have files deeper
100
- # in the directory tree. So lets grab the gem name and figure out the
101
- # unique paths of the compiled gems from there.
102
- def compiled_gems
103
- # @use_gemspec option finds compile gems with Gem::Specification
104
- # The normal build process does not use this and checks the file system.
105
- # So @use_gemspec is only used for this command:
106
- #
107
- # jets gems:check
108
- #
109
- # This is because it seems like some gems like json are remove and screws things up.
110
- # We'll filter out for the json gem as a hacky workaround, unsure if there are more
111
- # gems though that exhibit this behavior.
112
- if @options[:cli]
113
- gemspec_compiled_gems
114
- else
115
- compiled_gems = compiled_gem_paths.map { |p| gem_name_from_path(p) }.uniq
116
- # Double check that the gems are also in the gemspec list since that
117
- # one is scoped to Bundler and will only included gems used in the project.
118
- # This handles the possiblity of stale gems leftover from previous builds
119
- # in the cache.
120
- # TODO: figure out if we need
121
- # compiled_gems.select { |g| gemspec_compiled_gems.include?(g) }
122
- end
123
- end
124
-
125
- # Use pre-compiled gem because the gem could have development header shared
126
- # object file dependencies. The shared dependencies are packaged up as part
127
- # of the pre-compiled gem so it is available in the Lambda execution environment.
102
+ # Context, observations, and history:
128
103
  #
129
- # Example paths:
130
- # Macosx:
131
- # opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/nokogiri-1.8.1
132
- # opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
133
- # Official AWS Lambda Linux AMI:
134
- # opt/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/nokogiri-1.8.1
135
- # Circleci Ubuntu based Linux:
136
- # opt/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/pg-0.21.0
137
- def compiled_gem_paths
138
- Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/*/extensions/**/**/*.{so,bundle}")
139
- end
140
-
141
- # Input: opt/ruby/gems/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
142
- # Output: byebug-9.1.0
143
- def gem_name_from_path(path)
144
- regexp = %r{opt/ruby/gems/\d+\.\d+\.\d+/extensions/.*?/.*?/(.*?)/}
145
- path.match(regexp)[1] # gem_name
104
+ # Two ways to check if gem is compiled.
105
+ #
106
+ # 1. compiled_gem_paths - look for .so and .bundle extension files in the folder itself.
107
+ # 2. gemspec - uses the gemspec metadata.
108
+ #
109
+ # Observations:
110
+ #
111
+ # * The gemspec approach generally finds more compiled gems than the compiled_gem_paths approach.
112
+ # * So when using the compiled_gem_paths some compiled are missed and not properly detected like http-parser.
113
+ # * However, some gemspec found compiled gems like json are weird and they don't work when they get replaced.
114
+ #
115
+ # History:
116
+ #
117
+ # * Started with compiled_gem_paths approach
118
+ # * Tried to gemspec approach, but ran into json-2.1.0 gem issues. bundler removes? http://bit.ly/39T8uln
119
+ # * Went to selective checking approach with `cli: true` option. This helped gather more data.
120
+ # * jets deploy - compiled_gem_paths
121
+ # * jets gems:check - gemspec_compiled_gems
122
+ # * Going back to compiled_gem_paths with.
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.
125
+ #
126
+ def compiled_gems
127
+ gemspec_compiled_gems
146
128
  end
147
129
 
148
130
  # 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.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets-gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-01 00:00:00.000000000 Z
11
+ date: 2020-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gems
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.0.6
118
+ rubygems_version: 3.1.2
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Library manages pre-compiled Lambda Gems for Jets Ruby Serverless Framework