jets 3.0.0 → 3.0.5

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: 64340de503207710a82a13ca132501a65e030dd295edf2aff5fec1499c6e4d43
4
- data.tar.gz: 615dea597ff7fefafb59352aa3a68ef0c0b4b1338c7c9df1c36121e54c68fb7f
3
+ metadata.gz: b6747e94dd8a8e896d3f6a539b25ebcdbc312e08e39f34d25def19475e9fc28c
4
+ data.tar.gz: 418eb70b04920716a3f1aa2db8e92db7ef7f6aefac2243d4b05d0d6ca3aa6307
5
5
  SHA512:
6
- metadata.gz: 208dc2bbe537c0b99bd09927185d8e75dee87a76dc1320b6755e2e53136a85c66940ff3e6f0c74d5e806d3d49b49125d351ec27d8ceb7207d17b55cb593c1cbe
7
- data.tar.gz: 8e2f0b5ea3c84f907cc72e4eae4779da20d31d11affe6987ad55d2e92861b320104deeec00aefe5121bf5043f73b5ab2c3e5653b86297faaac00b88181651157
6
+ metadata.gz: a8cd79aa34648cab12d41d0acc7edd41ce4c9125b576f6409533d5088fec7200bb0596cb4257de5f8cd658b0d6fd82f8f46855a9340eba2aeefb1970a60c6579
7
+ data.tar.gz: 59ae9ee9cccacd97cfc9ca7515b65826a15da99e5a198e068faf8f77adf25da2d2523c45169da3aee378080a7411ca3f08efd5a5d74f908065e267bdbee57260
data/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
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
+ ## [3.0.5] - 2021-04-23
7
+ - [#542](https://github.com/boltops-tools/jets/pull/542) fix custom layers
8
+
9
+ ## [3.0.4] - 2021-04-13
10
+ - [#537](https://github.com/boltops-tools/jets/pull/537) Docs Add instructions for aws-cli prerequisite
11
+ - [#528](https://github.com/boltops-tools/jets/pull/528) Adjust permissions to fix custom layer
12
+ - [#539](https://github.com/boltops-tools/jets/pull/539) FIX DEPRECATION WARNING: connection_config is deprecated
13
+ - [#540](https://github.com/boltops-tools/jets/pull/540) Allow body param for controller request spec helpers
14
+ - update serverlessgems gem
15
+
16
+ ## [3.0.3] - 2021-03-24
17
+ - [#532](https://github.com/boltops-tools/jets/pull/532) Update Copy Write Year
18
+ - [#536](https://github.com/boltops-tools/jets/pull/536) use mini_mime instead
19
+
20
+ ## [3.0.2] - 2021-01-12
21
+ - update serverlessgems gem
22
+
23
+ ## [3.0.1] - 2021-01-12
24
+ - [#524](https://github.com/boltops-tools/jets/pull/524) fix native gem detection
25
+
6
26
  ## [3.0.0]
7
27
  * #328 i18n docs
8
28
  * #391 Deploy Option: Auto Replace API Gateway
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 Tung Nguyen
1
+ Copyright (c) 2021 Tung Nguyen
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -12,8 +12,14 @@ Ruby and Lambda splat out a baby and that child's name is [Jets](http://rubyonje
12
12
 
13
13
  [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](https://www.boltops.com)
14
14
 
15
+ Please **watch/star** this repo to help grow and support the project.
16
+
15
17
  **Upgrading**: If you are upgrading Jets, please check on the [Upgrading Notes](http://rubyonjets.com/docs/extras/upgrading/).
16
18
 
19
+ ## Sponsors
20
+
21
+ [![](https://img.boltops.com/boltops/tools/jets/sponsors/arist.png)](https://arist.co/)
22
+
17
23
  ## What is Ruby on Jets?
18
24
 
19
25
  Jets is a Ruby Serverless Framework. Jets 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.
@@ -189,7 +195,7 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
189
195
  * [Official AWS Ruby Support for Jets](https://blog.boltops.com/2018/12/12/official-aws-ruby-support-for-jets-serverless-framework)
190
196
  * [Build an API with Jets](https://blog.boltops.com/2019/01/13/build-an-api-service-with-jets-ruby-serverless-framework)
191
197
  * [Serverless Ruby Cron Jobs Tutorial: Route53 Backup](https://blog.boltops.com/2019/01/03/serverless-ruby-cron-jobs-with-jets-route53-backup)
192
- * [Serverless Slack Commands: Fun with AWS Image Recognition](https://blog.boltops.com/2019/01/14/serverless-slack-commands-with-ruby)
198
+ * [Serverless Slack Commands: Fun with AWS Image Recognition](https://blog.boltops.com/2021/02/02/serverless-slack-commands-with-ruby)
193
199
  * [Jets Afterburner: Rails Support](https://blog.boltops.com/2018/12/21/jets-afterburner-serverless-rails-on-aws-lambda-in-5-minutes)
194
200
  * [Jets Mega Mode: Jets and Rails](https://blog.boltops.com/2018/11/03/jets-mega-mode-run-rails-on-aws-lambda)
195
201
  * [Toronto Serverless Presentation](https://blog.boltops.com/2018/09/25/toronto-serverless-presentation-jets-framework-on-aws-lambda)
data/jets.gemspec CHANGED
@@ -52,12 +52,12 @@ Gem::Specification.new do |spec|
52
52
  spec.add_dependency "jets-html-sanitizer"
53
53
  spec.add_dependency "kramdown"
54
54
  spec.add_dependency "memoist"
55
- spec.add_dependency "mimemagic"
55
+ spec.add_dependency "mini_mime"
56
56
  spec.add_dependency "rack"
57
57
  spec.add_dependency "railties", "~> 6.1.0" # for ActiveRecord database_tasks.rb
58
58
  spec.add_dependency "rainbow"
59
59
  spec.add_dependency "recursive-open-struct"
60
- spec.add_dependency "serverlessgems"
60
+ spec.add_dependency "serverlessgems", "~> 0.1.3"
61
61
  spec.add_dependency "shotgun"
62
62
  spec.add_dependency "text-table"
63
63
  spec.add_dependency "thor"
@@ -20,11 +20,23 @@ module Jets::Builders
20
20
  found_gems.each do |gem_name|
21
21
  gem_extractor = Jets::Gems::Extract::Gem.new(gem_name, @options)
22
22
  gem_extractor.run
23
+ rename_gem(gem_name)
23
24
  end
24
25
 
25
26
  tidy
26
27
  end
27
28
 
29
+ def rename_gem(gem_name)
30
+ ruby_folder = "#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}"
31
+ gems_folder = "#{ruby_folder}/gems"
32
+ expr = "#{gems_folder}/#{gem_name}-x*-{darwin,linux}"
33
+ src = Dir.glob(expr).first
34
+ return unless src
35
+
36
+ dest = src.sub("-darwin", "-linux")
37
+ FileUtils.mv(src, dest) unless File.exist?(dest) # looks like rename_gem actually runs twice
38
+ end
39
+
28
40
  def sh(command)
29
41
  puts "=> #{command}".color(:green)
30
42
  success = system(command)
@@ -23,7 +23,7 @@ module Jets::Builders
23
23
  # => Creating zip file for /tmp/jets/demo/stage/bundled
24
24
 
25
25
  # https://serverfault.com/questions/265675/how-can-i-zip-compress-a-symlink
26
- command = "cd #{@path} && zip --symlinks -rq #{zip_file} ."
26
+ command = "cd #{@path} && chmod -R 755 . && zip --symlinks -rq #{zip_file} ."
27
27
  sh(command)
28
28
  # move out of the lower folder to the stage folder
29
29
  # mv /tmp/jets/demo/stage/code/code.zip /tmp/jets/demo/stage/code.zip
@@ -67,7 +67,7 @@ module Jets::Builders
67
67
  end
68
68
  create_bundle_config(frozen: true)
69
69
 
70
- remove_bundled_with("#{cache_area}/Gemfile.lock")
70
+ rewrite_gemfile_lock("#{cache_area}/Gemfile.lock")
71
71
 
72
72
  # Copy the Gemfile.lock back to the project in case it was updated.
73
73
  # For example we add the jets-rails to the Gemfile.
@@ -149,9 +149,10 @@ module Jets::Builders
149
149
 
150
150
  # Remove the BUNDLED WITH line since we don't control the bundler gem version on AWS Lambda
151
151
  # And this can cause issues with require 'bundler/setup'
152
- def remove_bundled_with(gemfile_lock)
152
+ def rewrite_gemfile_lock(gemfile_lock)
153
153
  lines = IO.readlines(gemfile_lock)
154
154
 
155
+ # Remove BUNDLED WITH
155
156
  # amount is the number of lines to remove
156
157
  new_lines, capture, count, amount = [], true, 0, 2
157
158
  lines.each do |l|
@@ -165,6 +166,27 @@ module Jets::Builders
165
166
  end
166
167
  end
167
168
 
169
+ # Replace things like nokogiri (1.11.1-x86_64-darwin) => nokogiri (1.11.1)
170
+ lines, new_lines = new_lines, []
171
+ lines.each do |l|
172
+ if l.include?("-x86_64-darwin")
173
+ l = l.sub('-x86_64-darwin','')
174
+ end
175
+ new_lines << l
176
+ end
177
+
178
+ # Make sure platform is ruby
179
+ lines, new_lines, marker = new_lines, [], false
180
+ lines.each do |l|
181
+ if marker # the next loop has the platform we want to replace
182
+ new_lines << " ruby\n"
183
+ marker = false
184
+ next
185
+ end
186
+ marker = l.include?('PLATFORMS')
187
+ new_lines << l
188
+ end
189
+
168
190
  content = new_lines.join('')
169
191
  IO.write(gemfile_lock, content)
170
192
  end
@@ -1,5 +1,5 @@
1
1
  require "rack/mime"
2
- require "mimemagic"
2
+ require "mini_mime"
3
3
 
4
4
  class Jets::PublicController < Jets::Controller::Base
5
5
  layout false
@@ -12,7 +12,7 @@ class Jets::PublicController < Jets::Controller::Base
12
12
 
13
13
  if File.exist?(catchall_path)
14
14
  content_type = Rack::Mime.mime_type(File.extname(catchall_path))
15
- binary = !MimeMagic.by_path(catchall_path).text?
15
+ binary = !MiniMime.lookup_by_filename(catchall_path).content_type.include?("text")
16
16
 
17
17
  # For binary support to work, the client also has to send the right Accept header.
18
18
  # And the media type has been to added to api gateway.
@@ -1,11 +1,15 @@
1
1
  module ActiveRecord
2
2
  module MigrationChecker
3
3
  def prepare_test_db
4
- current_config = ::ActiveRecord::Base.connection_config
4
+ current_config = ::ActiveRecord::Base.connection_db_config
5
5
  all_configs = ::ActiveRecord::Base.configurations.configs_for(env_name: Jets.env)
6
6
 
7
7
  needs_update = !all_configs.all? do |db_config|
8
- ::ActiveRecord::Tasks::DatabaseTasks.schema_up_to_date?(db_config.config, ::ActiveRecord::Base.schema_format, nil, Jets.env, db_config.spec_name)
8
+ ::ActiveRecord::Tasks::DatabaseTasks.schema_up_to_date?(
9
+ db_config.configuration_hash,
10
+ ::ActiveRecord::Base.schema_format,
11
+ nil
12
+ )
9
13
  end
10
14
 
11
15
  if needs_update
@@ -136,6 +136,8 @@ module Jets::Resource::Lambda
136
136
 
137
137
  def get_layers(runtime)
138
138
  return nil unless runtime =~ /^ruby/
139
+ return Jets.config.lambda.layers if Jets.config.gems.disable
140
+
139
141
  ["!Ref GemLayer"] + Jets.config.lambda.layers
140
142
  end
141
143
 
@@ -32,7 +32,8 @@ module Jets::SpecHelpers
32
32
  request.params.query_params ||= params.delete(:params)
33
33
  request.params.query_params ||= params
34
34
  else
35
- request.params.body_params = params.delete(:params)
35
+ request.params.body_params = params.delete(:body)
36
+ request.params.body_params ||= params.delete(:params)
36
37
  request.params.body_params ||= params
37
38
  end
38
39
 
@@ -31,14 +31,20 @@ module Jets::SpecHelpers::Controllers
31
31
  json['headers'] = (headers || {}).stringify_keys
32
32
 
33
33
  if method != :get
34
- json['headers']['Content-Type'] = 'application/x-www-form-urlencoded'
35
- body = Rack::Multipart.build_multipart(params.body_params)
34
+ json['headers']['Content-Type'] ||= 'application/x-www-form-urlencoded'
36
35
 
37
- if body
36
+ if params.body_params.is_a? String
37
+ body = params.body_params
38
38
  json['headers']['Content-Length'] ||= body.length.to_s
39
- json['headers']['Content-Type'] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}"
40
39
  else
41
- body = Rack::Utils.build_nested_query(params.body_params)
40
+ body = Rack::Multipart.build_multipart(params.body_params)
41
+
42
+ if body
43
+ json['headers']['Content-Length'] ||= body.length.to_s
44
+ json['headers']['Content-Type'] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}"
45
+ else
46
+ body = Rack::Utils.build_nested_query(params.body_params)
47
+ end
42
48
  end
43
49
 
44
50
  json['body'] = Base64.encode64(body)
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.5"
3
3
  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: 3.0.0
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -361,7 +361,7 @@ dependencies:
361
361
  - !ruby/object:Gem::Version
362
362
  version: '0'
363
363
  - !ruby/object:Gem::Dependency
364
- name: mimemagic
364
+ name: mini_mime
365
365
  requirement: !ruby/object:Gem::Requirement
366
366
  requirements:
367
367
  - - ">="
@@ -434,16 +434,16 @@ dependencies:
434
434
  name: serverlessgems
435
435
  requirement: !ruby/object:Gem::Requirement
436
436
  requirements:
437
- - - ">="
437
+ - - "~>"
438
438
  - !ruby/object:Gem::Version
439
- version: '0'
439
+ version: 0.1.3
440
440
  type: :runtime
441
441
  prerelease: false
442
442
  version_requirements: !ruby/object:Gem::Requirement
443
443
  requirements:
444
- - - ">="
444
+ - - "~>"
445
445
  - !ruby/object:Gem::Version
446
- version: '0'
446
+ version: 0.1.3
447
447
  - !ruby/object:Gem::Dependency
448
448
  name: shotgun
449
449
  requirement: !ruby/object:Gem::Requirement
@@ -1096,7 +1096,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1096
1096
  - !ruby/object:Gem::Version
1097
1097
  version: '0'
1098
1098
  requirements: []
1099
- rubygems_version: 3.1.4
1099
+ rubygems_version: 3.2.5
1100
1100
  signing_key:
1101
1101
  specification_version: 4
1102
1102
  summary: Ruby Serverless Framework