jets 3.0.8 → 3.0.12

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: db3aab7667c9ee9aaa2149d30132dbf423516b4195e643dad4f8a2108fe03bfc
4
- data.tar.gz: 5e126f386e4d0bba1c3714e66470e692c08c099c932f8f6a1c9a62556487aabe
3
+ metadata.gz: df619199e09ad52bd8f622f765867bb6560d3818a3b6297d9f82dd9ed7b4a9a4
4
+ data.tar.gz: d66d07f780595a0075caeadd6869a7e26aa85edb3b5af1c4a9680d2958201dd7
5
5
  SHA512:
6
- metadata.gz: 3c57ac868b4d54d0eff01884597af16188f59584eb20c8a348ce9bb8936e19dd50cc6f5d2271b7e0a4a0078586b40be9dcb5f47f92a870164482369662831aaa
7
- data.tar.gz: 83757df158f81b1447652c1edbe5e684c3cad325a7326a567d6fab391f6bae3ed86b847a87b17a62fb07314053e40e1a10575b8a97d76c8107ff598980ad285d
6
+ metadata.gz: a77badece003642190f7f7054d690d1c716d3d74a835275ac639dda48fa4f42fd80158e2559ff7ddfea175cb7e53a5bc353071d11448162c9b919a8a61620a76
7
+ data.tar.gz: b2cc100b93f46fc0625146ef6ac6d5579fb814aa764d30440abda2b5f31e9e236e9eff7a3fc5d159fdf1cb4a992a00429fbe42625e14b7b32da4a28b8b2ad6a7
data/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
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.12] - 2021-08-08
7
+ - [#578](https://github.com/boltops-tools/jets/pull/578) Update "jets delete" documentation to be --yes instead of --skip
8
+ - [#580](https://github.com/boltops-tools/jets/pull/580) Use active support instead of actionview
9
+ - [#581](https://github.com/boltops-tools/jets/pull/581) Csrf csrf-param authenticity_token and use @rails/ujs for crud
10
+
11
+ ## [3.0.11] - 2021-07-15
12
+ - update serverlessgems gem
13
+
14
+ ## [3.0.10] - 2021-07-14
15
+ - [#575](https://github.com/boltops-tools/jets/pull/575) fix missing webpacker helpers
16
+ - [#576](https://github.com/boltops-tools/jets/pull/576) Fixes API Gateway base path Lambda not respecting various config opts
17
+ - [#577](https://github.com/boltops-tools/jets/pull/577) Adjust .jetskeep handling and add .jetsignore docs
18
+ - fix dbconsole (#568)
19
+
20
+ ## [3.0.9] - 2021-06-14
21
+ - fix content type s3 metadata (#564)
22
+
6
23
  ## [3.0.8] - 2021-06-03
7
24
  - Update cli.md (#560)
8
25
  - respect .jetsignore also (#562)
data/jets.gemspec CHANGED
@@ -57,7 +57,7 @@ Gem::Specification.new do |spec|
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", "~> 0.1.3"
60
+ spec.add_dependency "serverlessgems", "~> 0.1.4"
61
61
  spec.add_dependency "shotgun"
62
62
  spec.add_dependency "text-table"
63
63
  spec.add_dependency "thor"
@@ -1,4 +1,4 @@
1
- require 'action_view'
1
+ require "active_support/number_helper"
2
2
 
3
3
  # Examples:
4
4
  #
@@ -10,7 +10,7 @@ require 'action_view'
10
10
  #
11
11
  module Jets::Builders
12
12
  class Md5Zip
13
- include ActionView::Helpers::NumberHelper # number_to_human_size
13
+ include ActiveSupport::NumberHelper # number_to_human_size
14
14
  include Util
15
15
 
16
16
  def initialize(folder)
@@ -38,7 +38,7 @@ module Jets::Builders
38
38
  removals += get_removals("#{@project_root}/.jetsignore")
39
39
  removals = removals.reject do |p|
40
40
  jetskeep.find do |keep|
41
- p.include?(keep)
41
+ p == keep
42
42
  end
43
43
  end
44
44
  removals.uniq
@@ -56,7 +56,7 @@ module Jets::Builders
56
56
  # We clean out ignored files pretty aggressively. So provide
57
57
  # a way for users to keep files from being cleaned out.
58
58
  def jetskeep
59
- always = %w[.bundle packs vendor]
59
+ always = %w[.bundle /public/packs /public/packs-test vendor]
60
60
  path = "#{@project_root}/.jetskeep"
61
61
  return always unless File.exist?(path)
62
62
 
@@ -1,5 +1,6 @@
1
1
  require 'action_view'
2
2
  require 'digest'
3
+ require 'rack/mime'
3
4
 
4
5
  module Jets::Cfn
5
6
  class Upload
@@ -8,12 +9,6 @@ module Jets::Cfn
8
9
 
9
10
  attr_reader :bucket_name
10
11
 
11
- CONTENT_TYPES_BY_EXTENSION = {
12
- '.css' => 'text/css',
13
- '.js' => 'application/javascript',
14
- '.html' => 'text/html'
15
- }
16
-
17
12
  def initialize(bucket_name)
18
13
  @bucket_name = bucket_name
19
14
  end
@@ -93,16 +88,23 @@ module Jets::Cfn
93
88
  end
94
89
 
95
90
  def upload_to_s3(full_path)
96
- return if identical_on_s3?(full_path)
91
+ return if identical_on_s3?(full_path) && !ENV['JETS_ASSET_UPLOAD_FORCE']
97
92
 
98
93
  key = s3_key(full_path)
99
94
  obj = s3_resource.bucket(bucket_name).object(key)
100
- puts "Uploading and setting content type for s3://#{bucket_name}/#{key}" # uncomment to see and debug
101
- obj.upload_file(full_path, { acl: "public-read", cache_control: cache_control }.merge(content_type_headers(full_path)))
95
+ content_type = content_type_headers(full_path)
96
+ puts "Uploading and setting content type for s3://#{bucket_name}/#{key} content_type #{content_type[:content_type].inspect}"
97
+ obj.upload_file(full_path, { acl: "public-read", cache_control: cache_control }.merge(content_type))
102
98
  end
103
99
 
100
+ CONTENT_TYPES_BY_EXTENSION = {
101
+ '.css' => 'text/css',
102
+ '.html' => 'text/html',
103
+ '.js' => 'application/javascript',
104
+ }
104
105
  def content_type_headers(full_path)
105
- content_type = CONTENT_TYPES_BY_EXTENSION[File.extname(full_path)]
106
+ ext = File.extname(full_path)
107
+ content_type = CONTENT_TYPES_BY_EXTENSION[ext] || Rack::Mime.mime_type(ext)
106
108
  if content_type
107
109
  { content_type: content_type }
108
110
  else
@@ -1,12 +1,15 @@
1
1
  # Thanks: Rails dbconsole_command.rb
2
2
  module Jets::Commands
3
3
  class Dbconsole
4
+ extend Memoist
5
+
4
6
  def self.start(*args)
5
7
  new(*args).start
6
8
  end
7
9
 
8
10
  def initialize(options = {})
9
- @options = options
11
+ defaults = {"include_password" => true}
12
+ @options = defaults.merge(options)
10
13
  end
11
14
 
12
15
  def start
@@ -85,14 +88,14 @@ module Jets::Commands
85
88
  end
86
89
 
87
90
  def config
88
- @config ||= begin
89
- if configurations[environment].blank?
90
- raise ActiveRecord::AdapterNotSpecified, "'#{environment}' database is not configured. Available configuration: #{configurations.inspect}"
91
- else
92
- configurations[environment]
93
- end
91
+ configs = configurations.configs_for(env_name: environment)
92
+ if configs.blank?
93
+ raise ActiveRecord::AdapterNotSpecified, "'#{environment}' database is not configured. Available configuration: #{configurations.inspect}"
94
+ else
95
+ configs.first.configuration_hash.dup.stringify_keys!
94
96
  end
95
97
  end
98
+ memoize :config
96
99
 
97
100
  def environment
98
101
  Jets.env.to_s
@@ -2,7 +2,7 @@ module Jets::Commands
2
2
  class Gems < Jets::Commands::Base
3
3
  desc "check", "Check if pre-built Lambda gems are available from the sources"
4
4
  long_desc Help.text("gems:check")
5
- option :show_source, type: :boolean, desc: "Show source"
5
+ option :verbose, type: :boolean, desc: "Verbose mode"
6
6
  def check
7
7
  check = Jets::Gems::Check.new(@options)
8
8
  check.run! # exits early if missing gems found
@@ -17,6 +17,6 @@ This deletes the all the contents in the internal s3 bucket that jets uses and t
17
17
  Project demo-dev deleted!
18
18
  $
19
19
 
20
- You can bypass the are you sure prompt with the `--sure` flag.
20
+ You can bypass the are you sure prompt with the `--yes` flag.
21
21
 
22
- $ jets delete --sure
22
+ $ jets delete --yes
@@ -114,7 +114,7 @@ JS
114
114
  after = "const { environment } = require('@rails/webpacker')\n"
115
115
  insert_into_file("config/webpack/environment.js", jquery, after: after)
116
116
 
117
- run("yarn add bootstrap jquery popper.js postcss-cssnext")
117
+ run("yarn add bootstrap jquery popper.js postcss-cssnext @rails/ujs")
118
118
  end
119
119
 
120
120
  def git_init
@@ -18,5 +18,6 @@
18
18
  <% if @bootstrap -%>
19
19
  import 'bootstrap/dist/js/bootstrap';
20
20
  <% end -%>
21
- import '../src/jets/crud'
22
- console.log('Hello World from Webpacker')
21
+
22
+ import Rails from "@rails/ujs"
23
+ Rails.start()
data/lib/jets/core.rb CHANGED
@@ -43,7 +43,7 @@ module Jets::Core
43
43
  memoize :logger
44
44
 
45
45
  def webpacker?
46
- Gem.loaded_specs.keys.include?("webpacker")
46
+ Gem.loaded_specs.keys.any?{|k| k.start_with?("webpacker")}
47
47
  end
48
48
  memoize :webpacker?
49
49
 
@@ -77,7 +77,10 @@ module Jets::UrlHelper
77
77
 
78
78
  def csrf_meta_tags
79
79
  if protect_against_forgery?
80
- tag("meta", name: "csrf-token", content: masked_authenticity_token).html_safe
80
+ html = tag("meta", name: "csrf-token", content: masked_authenticity_token).html_safe
81
+ html << "\n"
82
+ html << tag("meta", name: "csrf-param", content: "authenticity_token").html_safe
83
+ html
81
84
  end
82
85
  end
83
86
  end # UrlHelper
@@ -25,7 +25,9 @@ module Jets::Resource::ApiGateway::BasePath
25
25
  end
26
26
 
27
27
  def layers
28
- ["!Ref GemLayer"]
28
+ return Jets.config.lambda.layers if Jets.config.gems.disable
29
+
30
+ ["!Ref GemLayer"] + Jets.config.lambda.layers
29
31
  end
30
32
 
31
33
  def function_name
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.8"
2
+ VERSION = "3.0.12"
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.8
4
+ version: 3.0.12
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-06-03 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -436,14 +436,14 @@ dependencies:
436
436
  requirements:
437
437
  - - "~>"
438
438
  - !ruby/object:Gem::Version
439
- version: 0.1.3
439
+ version: 0.1.4
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.1.3
446
+ version: 0.1.4
447
447
  - !ruby/object:Gem::Dependency
448
448
  name: shotgun
449
449
  requirement: !ruby/object:Gem::Requirement
@@ -776,7 +776,6 @@ files:
776
776
  - lib/jets/commands/templates/skeleton/spec/spec_helper.rb.tt
777
777
  - lib/jets/commands/templates/webpacker/app/javascript/packs/application.js.tt
778
778
  - lib/jets/commands/templates/webpacker/app/javascript/packs/theme.scss.tt
779
- - lib/jets/commands/templates/webpacker/app/javascript/src/jets/crud.js
780
779
  - lib/jets/commands/upgrade.rb
781
780
  - lib/jets/commands/upgrade/templates/bin/webpack
782
781
  - lib/jets/commands/upgrade/templates/bin/webpack-dev-server
@@ -1,90 +0,0 @@
1
- // This file is automatically generated by Jets. It is used by
2
- // app/javascript/packs/application.js.
3
- //
4
- // It handles the delete and update action in an unobstrusive way.
5
- // Code could be improved and is meant to provide only a starting point.
6
-
7
- $(function() {
8
- function handleAll(e) {
9
- var target = $(e.target);
10
- if (target.is('a') && target.data("method") == "delete") {
11
- return handleDelete(e);
12
- } else if (target.attr('type') == "submit") {
13
- return handleUpdate(e);
14
- } else {
15
- return true;
16
- }
17
-
18
- e.preventDefault();
19
- }
20
-
21
- function handleDelete(e) {
22
- event.preventDefault();
23
- var link = $(e.target);
24
- var message = link.data("confirm");
25
- if (message) {
26
- var sure = confirm(message);
27
- if (sure) {
28
- deleteItem(link);
29
- } else {
30
- console.log("Deletion cancelled");
31
- }
32
- }
33
- }
34
-
35
- function handleUpdate(e) {
36
- var submit = $(e.target);
37
- var form = submit.closest('form');
38
- var url = form.attr("action");
39
- var method = $("input[name=_method]");
40
-
41
- if (method.attr("value") != "put") {
42
- return true;
43
- }
44
-
45
- e.preventDefault();
46
- var data = $(form).serialize();
47
- $.ajax({
48
- url: url,
49
- type: 'PUT',
50
- data: data,
51
- dataType: "json",
52
- success: function(response) {
53
- window.location.href = response.location;
54
- },
55
- error: function(xhr, textStatus, errorThrown) {
56
- console.log('Error! Status = ' + xhr.status);
57
- },
58
- complete: function(data) {
59
- console.log("data %o", data);
60
- }
61
- });
62
- }
63
-
64
- function deleteItem(link) {
65
- var node = link.closest('.jets-element-to-delete');
66
- node.hide(); // immediately hide element
67
-
68
- var resource = link.attr("href");
69
- var token = $('meta[name=csrf-token]').attr('content');
70
- var data = { authenticity_token: token };
71
- var request = $.ajax({
72
- url: resource,
73
- method: "DELETE",
74
- data: data,
75
- dataType: "json"
76
- });
77
-
78
- request.done(function(msg) {
79
- console.log("msg %o", msg)
80
- node.remove();
81
- });
82
-
83
- request.fail(function(jqXHR, textStatus) {
84
- console.log("textStatus %o", textStatus)
85
- node.show(); // in the event of a failure re-display the node
86
- });
87
- }
88
-
89
- $('body').click(handleAll)
90
- });