jets 3.0.10 → 3.0.14

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: 0b2e85111e507304b3bd11375499c70f4ba880e1f2523e5f7b2ff627e6558b76
4
- data.tar.gz: 5e7bbb320f5e580726ab4d66e11cc47feca970edc61d6d01f1ed25fea2693bad
3
+ metadata.gz: 571efa758f33bf44042d6e8be73c933011680217cd4e87b0324f85b5fc7c37dc
4
+ data.tar.gz: fac7b4ceae0b9d7e0fe8f494f57cf409d71a08d26dbd259424800d3a9feb268b
5
5
  SHA512:
6
- metadata.gz: 7dbf8891880be71e8b40da911ebb13e5ad39365158efa9bd62426b17e94d8b264a9832f14e32f10a8b402daf34cecda8f5986bcfcc70cb9278a7793b398b61d0
7
- data.tar.gz: 6397148e88442a557552397ab01c7b7697f3642593f0aaedcbddd15f01c824e47b64922d21208bf99e01dd2929b547fcc3ef07a0c91afb6e49a58fe46185667f
6
+ metadata.gz: 3ee364750aaa8c1f74a92ec9da2363e77cd7af84db97977b54a40cb087a32bbbec4e413b5cac5117018468c84b23ed18646f5416b9aaf3d425e668dabfb21b6c
7
+ data.tar.gz: 446e82b01a2d07679d1f51f8dd7e461d7ddfd67a46759fc22fa59c740fe8f6011a711a7acdc80ea1d4e62786f8e79eec7596c283f3758fd9734546d2bb555953
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.14] - 2021-09-01
7
+ - [#583](https://github.com/boltops-tools/jets/pull/583) Don't overwrite content_type when rendering json or xml with content_type specified
8
+ - [#584](https://github.com/boltops-tools/jets/pull/584) Adds an override flag to change behaviour when Jets is behind an ELB running Jets Server
9
+ - [#585](https://github.com/boltops-tools/jets/pull/585) add_stage controller method
10
+ - [#586](https://github.com/boltops-tools/jets/pull/586) JETS_ELB env var flag
11
+
12
+ ## [3.0.13] - 2021-08-17
13
+ - [#582](https://github.com/boltops-tools/jets/pull/582) use Shotgun::Static middleware always
14
+
15
+ ## [3.0.12] - 2021-08-08
16
+ - [#578](https://github.com/boltops-tools/jets/pull/578) Update "jets delete" documentation to be --yes instead of --skip
17
+ - [#580](https://github.com/boltops-tools/jets/pull/580) Use active support instead of actionview
18
+ - [#581](https://github.com/boltops-tools/jets/pull/581) Csrf csrf-param authenticity_token and use @rails/ujs for crud
19
+
20
+ ## [3.0.11] - 2021-07-15
21
+ - update serverlessgems gem
22
+
6
23
  ## [3.0.10] - 2021-07-14
7
24
  - [#575](https://github.com/boltops-tools/jets/pull/575) fix missing webpacker helpers
8
25
  - [#576](https://github.com/boltops-tools/jets/pull/576) Fixes API Gateway base path Lambda not respecting various config opts
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)
@@ -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()
@@ -70,6 +70,7 @@ module Jets::Controller::Middleware
70
70
 
71
71
  def on_aws?(env)
72
72
  return false if Jets.env.test? # usually with test we're passing in full API Gateway fixtures with the HTTP_X_AMZN_TRACE_ID
73
+ return false if ENV['JETS_ELB'] # If we're using an ELB and Jets is inside a container running jets server, we don't want to pretend we're on AWS.
73
74
  on_cloud9 = !!(env['HTTP_HOST'] =~ /cloud9\..*\.amazonaws\.com/)
74
75
  !!env['HTTP_X_AMZN_TRACE_ID'] && !on_cloud9
75
76
  end
@@ -7,16 +7,7 @@ class Jets::Controller
7
7
  raise "redirect_to url parameter must be a String. Please pass in a string"
8
8
  end
9
9
 
10
- uri = URI.parse(url)
11
- # if no location.host, we been provided a relative host
12
- if !uri.host && actual_host
13
- url = "/#{url}" unless url.starts_with?('/')
14
- url = add_stage_name(url)
15
- redirect_url = actual_host + url
16
- else
17
- redirect_url = url
18
- end
19
-
10
+ redirect_url = add_stage(url)
20
11
  redirect_url = ensure_protocol(redirect_url)
21
12
 
22
13
  aws_proxy = Rendering::RackRenderer.new(self,
@@ -33,6 +33,8 @@ class Jets::Controller
33
33
  end
34
34
 
35
35
  def adjust_content_type!(options)
36
+ return if options.key?(:content_type)
37
+
36
38
  if options.key?(:json)
37
39
  options[:content_type] = "application/json"
38
40
  elsif options.key?(:xml)
@@ -60,15 +62,26 @@ class Jets::Controller
60
62
  rest.merge(template: template)
61
63
  end
62
64
 
63
- # Add API Gateway Stage Name
64
- def add_stage_name(url)
65
+ # Example usage:
66
+ #
67
+ # render json: {success: true, location: add_stage(posts_path)}
68
+ #
69
+ def add_stage(url)
65
70
  return url unless actual_host
66
71
 
67
- Jets::Controller::Stage.add(actual_host, url)
72
+ uri = URI.parse(url)
73
+ # if no location.host, we been provided a relative host
74
+ if !uri.host && actual_host
75
+ url = "/#{url}" unless url.starts_with?('/')
76
+ url = Jets::Controller::Stage.add(actual_host, url)
77
+ actual_host + url
78
+ else
79
+ url
80
+ end
68
81
  end
69
82
 
70
83
  def url_for(url)
71
- add_stage_name(url)
84
+ add_stage(url)
72
85
  end
73
86
 
74
87
  # Actual host can be headers["origin"] when cloudfront is in front.
@@ -1,3 +1,5 @@
1
+ require "shotgun"
2
+
1
3
  module Jets::Middleware
2
4
  class DefaultStack
3
5
  attr_reader :config, :app
@@ -8,7 +10,7 @@ module Jets::Middleware
8
10
 
9
11
  def build_stack
10
12
  Stack.new do |middleware|
11
- middleware.use Shotgun::Static if Jets.env.development?
13
+ middleware.use Shotgun::Static
12
14
  middleware.use Rack::Runtime
13
15
  middleware.use Jets::Controller::Middleware::Cors if cors_enabled?
14
16
  middleware.use Rack::MethodOverride # must come before Middleware::Local for multipart post forms to work
@@ -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
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.10"
2
+ VERSION = "3.0.14"
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.10
4
+ version: 3.0.14
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-07-14 00:00:00.000000000 Z
11
+ date: 2021-09-01 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
- });