jets 5.0.2 → 5.0.3

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: 56b1cd2d4dadd8582bfaf2eeda623bed469ae4effd0cd3aff9f2c80741721b23
4
- data.tar.gz: 4abf083f6a7d090ed0bf0adf1c16b24ea6f8ec98714c0335ba165f92b5115766
3
+ metadata.gz: '09353481e33c3e69347755182cf55dab3b16e50d351bf263d21e20fb6516aa5f'
4
+ data.tar.gz: 185f9c67d33250cfd3d406612d3bd34d03179d5abb6c86a540218f2666fc448f
5
5
  SHA512:
6
- metadata.gz: aae65dfb73f92802e3a8e44b7e4171a97345ba7912143ad03d644e1ded48822541fba035d4d1c6707c0e2aed2d31c595be637c8cdc9c9eb19be13627b2576afb
7
- data.tar.gz: 3a71ac74963d2d81cb75f57bcb2a32df1a34a890f2d60f522d4a53640f8bee3ff2c6fc7ddcca73990c232724436597ecf0f2b0cc6bab2513c3d4c15c5ea99d5d
6
+ metadata.gz: 45bd552d7be3599219c725499a406907c24c9344cae56cee664a0a86f292efd6b9dbe81f27f6caabc94f19efb59080c3ff26f53214289d1f0ee11f76083ddaad
7
+ data.tar.gz: 536a79ad1957f08184600d86c126d2877ab8e254b7568d1e1b265dc288cae36017b50b254ca0acb06cbbce32111ae6ab37e0303152e9927653d837196f16f3d5
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
+ ## [5.0.3] - 2023-12-15
7
+ - [#691](https://github.com/rubyonjets/jets/pull/691) jets deploy fix for empty project
8
+ - [#692](https://github.com/rubyonjets/jets/pull/692) fix jets deploy for empty project
9
+ - [#693](https://github.com/rubyonjets/jets/pull/693) do not include sprockets-jets in new app generator for api mode
10
+ - [#694](https://github.com/rubyonjets/jets/pull/694) fix jets deploy for empty project
11
+
6
12
  ## [5.0.2] - 2023-12-11
7
13
  - [#688](https://github.com/rubyonjets/jets/pull/688) improve releases:info output
8
14
 
@@ -232,7 +232,7 @@ module Jets::Builders
232
232
  # Checking this way because when using jets standalone for Afterburner mode we don't want to run into
233
233
  # bundler gem collisions. TODO: figure out the a better way to handle the collisions.
234
234
  lines = IO.readlines("#{Jets.root}/Gemfile")
235
- lines.detect { |l| l =~ /#{name}/ && l !~ /\s.*#/ }
235
+ lines.detect { |l| l =~ /gem ['"]#{name}/ && l !~ /^\s*?#/ }
236
236
  end
237
237
 
238
238
  # Cleans out non-cached files like code-*.zip in Jets.build_root
@@ -305,7 +305,7 @@ module Jets::Builders
305
305
  puts "Skip packaging ruby".color(:yellow) # useful for developing handlers
306
306
  return
307
307
  end
308
- return if Jets.poly_only?
308
+ return unless Jets.gem_layer?
309
309
 
310
310
  check_agree
311
311
  ruby_packager.install
@@ -322,7 +322,7 @@ module Jets::Builders
322
322
  end
323
323
 
324
324
  def build_lambda_layer
325
- return if Jets.poly_only?
325
+ return unless Jets.gem_layer?
326
326
  lambda_layer = LambdaLayer.new
327
327
  lambda_layer.build
328
328
  end
@@ -45,6 +45,14 @@ module Jets::Builders
45
45
  generate_handler(vars)
46
46
  end
47
47
  end
48
+
49
+ if app_files.empty? && Jets.gem_layer?
50
+ # When there are no app files, still need to generate a shim for JetsController
51
+ lib = File.expand_path('../../..', __dir__)
52
+ path = "#{lib}/engines/internal/app/controllers/jets/public_controller.rb"
53
+ vars = Jets::Builders::ShimVars::App.new(path)
54
+ generate_handler(vars)
55
+ end
48
56
  end
49
57
 
50
58
  def generate_handler(vars)
@@ -44,7 +44,7 @@ class Jets::Cfn::Builder
44
44
  add_resource(resource)
45
45
  add_outputs(resource.outputs)
46
46
 
47
- return if Jets.poly_only?
47
+ return unless Jets.gem_layer?
48
48
  resource = Jets::Cfn::Resource::Lambda::GemLayer.new
49
49
  add_resource(resource)
50
50
  add_outputs(resource.outputs)
@@ -86,8 +86,8 @@ module Jets::Cfn
86
86
  builder_class = "Jets::Cfn::Builder::#{app_class}".constantize
87
87
 
88
88
  app_class = Jets::Klass.from_path(path)
89
- if Jets.poly_only? && app_class == Jets::PreheatJob
90
- return # No prewarm when there's only poly functions
89
+ if !Jets.gem_layer? && app_class == Jets::PreheatJob
90
+ return # No prewarm when there's only poly functions and no gem layer
91
91
  end
92
92
 
93
93
  # Builder class fully qualified name:
@@ -5,7 +5,7 @@ module Jets::Cfn::Params
5
5
  IamRole: "!GetAtt IamRole.Arn",
6
6
  S3Bucket: "!Ref S3Bucket",
7
7
  }
8
- parameters[:GemLayer] = "!Ref GemLayer" unless Jets.poly_only?
8
+ parameters[:GemLayer] = "!Ref GemLayer" if Jets.gem_layer?
9
9
  parameters
10
10
  end
11
11
 
data/lib/jets/cfn/ship.rb CHANGED
@@ -116,7 +116,7 @@ module Jets::Cfn
116
116
  end
117
117
  return unless @options[:stack_type] == :full # s3 bucket is available
118
118
  return unless Jets.config.prewarm.enable
119
- return if Jets.poly_only?
119
+ return unless Jets.gem_layer?
120
120
 
121
121
  puts "Prewarming application."
122
122
  Jets::PreheatJob.prewarm!
@@ -138,6 +138,9 @@ module Jets::Cfn
138
138
  # If only max_age is provided, then we'll generate a cache_control header.
139
139
  # Using max_age is the shorter and simply way of setting the cache_control header.
140
140
  def cache_control
141
+ # default when sprockets-jets not installed
142
+ return "public, max-age=3600" unless Jets.config.respond_to?(:assets)
143
+
141
144
  cache_control = Jets.config.assets.cache_control
142
145
  unless cache_control
143
146
  max_age = Jets.config.assets.max_age # defaults to 3600 in jets/application.rb
data/lib/jets/core.rb CHANGED
@@ -207,6 +207,10 @@ module Jets::Core
207
207
  Jets.config.cfn.build.controllers == "one_lambda_for_all_controllers"
208
208
  end
209
209
 
210
+ def gem_layer?
211
+ !Jets.poly_only? || Jets.one_lambda_for_all_controllers?
212
+ end
213
+
210
214
  # Do not memoize here. The JetsBucket.name does it's own special memoization.
211
215
  def s3_bucket
212
216
  Jets::Cfn::Resource::S3::JetsBucket.name
@@ -2,9 +2,12 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "jets", "~> <%= Jets::VERSION %>"
4
4
 
5
+ <%- if options[:mode] == 'html'-%>
6
+ gem "sprockets-jets"
7
+ <% end -%>
8
+
5
9
  <%- if options[:mode] != 'job' && !options[:database].nil? -%>
6
10
  <%= database_gemfile_entry %>
7
- gem "sprockets-jets"
8
11
  <%- end -%>
9
12
  <%- if options[:mode] == 'html' -%>
10
13
  gem "importmap-jets"
@@ -21,7 +21,7 @@ class Jets::Stack
21
21
  return unless elements
22
22
 
23
23
  if section == :parameters
24
- elements[:GemLayer] = {Type: "String"} unless Jets.poly_only?
24
+ elements[:GemLayer] = {Type: "String"} if Jets.gem_layer?
25
25
  end
26
26
  @template[section] = elements
27
27
  end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "5.0.2"
2
+ VERSION = "5.0.3"
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: 5.0.2
4
+ version: 5.0.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: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer