jets 1.5.1 → 1.5.2

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: 6885ae6e6c06e0dc4815590b04ddc1e7e969d214529bdc4ba50491d8bc9a1c6d
4
- data.tar.gz: 619992a70dfef925eaccbd72f0d8b75755fd7be95633b34195230b5af1c7a9d3
3
+ metadata.gz: fffc1bee1f24ec886725f284f26c2876833048efa0596536155b87fddd38bce3
4
+ data.tar.gz: 32493191db6f88d33d95a7927e5723ef85b949eb511f59089b39df0e8352b064
5
5
  SHA512:
6
- metadata.gz: 20d3ea20af1a36c7faf4d224350b15fcbbb7892469e2976e129746a7768b6f10e500791ed5c4076beebad09e2db03a456e03ebaee7077fe95c7fdf5925348629
7
- data.tar.gz: 1372624f0be64e02884e0524abcfadefcc1a76d644e28b77b4d8566e4330e64bf14e28b7f676b49ac923aefbacd11fb58b7b6155e301dee7990a59badef52cf2
6
+ metadata.gz: 75655e94fc346815891d7c0f5825272c3f247442930ab16e3418f5fb0b3856c5ae32560469137f94138f3f2b9ea313186d3d9c09af6c09d5672ecb882d3d3c11
7
+ data.tar.gz: 026c25491b0762085122a7e45b649d4b36d2a3c9ff51ea791c769ba4ae64e30c083946c2f775a254405bb977055829cdbc2836366d29b9ee823494b06030b781
@@ -3,12 +3,24 @@
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/), even before v1.0.
5
5
 
6
+ ## [1.5.2]
7
+ - #138 from patchkit-net/feature/before_action_chain_break Change before_action behavior: allow chain break
8
+ - #139 from patchkit-net/bugfix/spec-gem-files-dir Fix jets.gemspec files listing method
9
+ - #140 from patchkit-net/feature/config-logger Add configurable Jets.application.config.logger
10
+ - Change before_action behavior: When any before action renders or redirects, the filter chain
11
+ is halted, and action code is not executed. This allows before_action to act as guards.
12
+ - Fix jets.gemspec how git command is executed to list files. The listing no longer needs to be done
13
+ from the jets root directory. This change enables including Jets as local bundler gem.
14
+ - Add Jets.application.config.logger field to enable custom logger instance to
15
+ be configured in config/environments/*.rb files.
16
+ - Fix scaffold ajax redirect url
17
+
6
18
  ## [1.5.1]
7
19
  - #137 from tongueroo/gems-check bypass gems check exit for custom lambda layers
8
20
 
9
21
  ## [1.5.0]
10
22
  - #135 from tongueroo/remove-rails-constant Remove Rails Constant
11
- - #136 from tongueroo/routes-namespace routes namespace support (ghost release, not documented yet on purpose)
23
+ - #136 from tongueroo/routes-namespace routes namespace support
12
24
 
13
25
  ## [1.4.11]
14
26
  - #133 from tongueroo/custom-layer add custom lambda layer support
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.5.1)
14
+ jets (1.5.2)
15
15
  activerecord (>= 5.2.1)
16
16
  activesupport (>= 5.2.1)
17
17
  aws-sdk-apigateway
@@ -76,7 +76,7 @@ GEM
76
76
  aws-sdk-cloudwatchlogs (1.12.0)
77
77
  aws-sdk-core (~> 3, >= 3.39.0)
78
78
  aws-sigv4 (~> 1.0)
79
- aws-sdk-core (3.44.2)
79
+ aws-sdk-core (3.45.0)
80
80
  aws-eventstream (~> 1.0)
81
81
  aws-partitions (~> 1.0)
82
82
  aws-sigv4 (~> 1.0)
@@ -90,7 +90,7 @@ GEM
90
90
  aws-sdk-lambda (1.16.0)
91
91
  aws-sdk-core (~> 3, >= 3.39.0)
92
92
  aws-sigv4 (~> 1.0)
93
- aws-sdk-s3 (1.30.0)
93
+ aws-sdk-s3 (1.30.1)
94
94
  aws-sdk-core (~> 3, >= 3.39.0)
95
95
  aws-sdk-kms (~> 1)
96
96
  aws-sigv4 (~> 1.0)
@@ -108,7 +108,7 @@ GEM
108
108
  crass (1.0.4)
109
109
  diff-lcs (1.3)
110
110
  dotenv (2.6.0)
111
- dynomite (1.1.1)
111
+ dynomite (1.2.0)
112
112
  activesupport
113
113
  aws-sdk-dynamodb
114
114
  erubi (1.8.0)
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.rdoc_options += Jets::Rdoc.options
19
19
 
20
20
  vendor_files = Dir.glob("vendor/**/*")
21
- gem_files = `git ls-files -z`.split("\x0").reject do |f|
21
+ gem_files = `git -C "#{File.dirname(__FILE__)}" ls-files -z`.split("\x0").reject do |f|
22
22
  f.match(%r{^(test|spec|features|docs)/})
23
23
  end
24
24
  spec.files = gem_files + vendor_files
@@ -35,6 +35,7 @@ class Jets::Application
35
35
  config.cors = true
36
36
  config.autoload_paths = default_autoload_paths
37
37
  config.extra_autoload_paths = []
38
+ config.logger = Jets::Logger.new($stderr)
38
39
 
39
40
  # function properties defaults
40
41
  config.function = ActiveSupport::OrderedOptions.new
@@ -58,4 +58,9 @@ Jets.application.configure do
58
58
  # us-east-1 EDGE endpoint
59
59
  # config.domain.cert_arn = "arn:aws:acm:us-east-1:112233445566:certificate/d68472ba-04f8-45ba-b9db-14f839d57123"
60
60
  # config.domain.endpoint_type = "EDGE"
61
+
62
+ # By default logger needs to log to $stderr for CloudWatch to receive Lambda messages, but for
63
+ # local testing environment you may want to log these messages to 'test.log' file to keep your
64
+ # testing suite output readable.
65
+ # config.logger = Jets::Logger.new($strerr)
61
66
  end
@@ -37,10 +37,14 @@ class Jets::Controller
37
37
  t1 = Time.now
38
38
  log_info_start
39
39
 
40
- run_before_actions
41
- send(@meth)
42
- triplet = ensure_render
43
- run_after_actions
40
+ if run_before_actions(break_if: -> { @rendered })
41
+ send(@meth)
42
+ triplet = ensure_render
43
+ run_after_actions
44
+ else
45
+ Jets.logger.info "Filter chain halted as #{@last_callback_name} rendered or redirected"
46
+ triplet = ensure_render
47
+ end
44
48
 
45
49
  took = Time.now - t1
46
50
  status = triplet[0]
@@ -20,8 +20,9 @@ class Jets::Controller
20
20
 
21
21
  # Instance Methods
22
22
  # define run_before_actions and run_after_actions
23
+ # returns true if all actions were run, false if break_if condition yielded `true`
23
24
  [:before, :after].each do |type|
24
- define_method "run_#{type}_actions" do
25
+ define_method "run_#{type}_actions" do |break_if: nil|
25
26
  called_method = @meth.to_sym
26
27
  callbacks = self.class.send("#{type}_actions")
27
28
  callbacks.each do |array|
@@ -36,7 +37,11 @@ class Jets::Controller
36
37
  else
37
38
  send(callback)
38
39
  end
40
+ @last_callback_name = callback
41
+
42
+ return false if !break_if.nil? && break_if.call
39
43
  end
44
+ true
40
45
  end
41
46
  end
42
47
  end # ClassOptions
@@ -42,7 +42,7 @@ module Jets::Core
42
42
  memoize :build_root
43
43
 
44
44
  def logger
45
- Jets::Logger.new($stderr)
45
+ Jets.application.config.logger
46
46
  end
47
47
  memoize :logger
48
48
 
@@ -30,7 +30,7 @@ class <%= controller_class_name %>Controller < ApplicationController
30
30
 
31
31
  if @<%= orm_instance.save %>
32
32
  if request.xhr?
33
- render json: {success: true, location: url_for("/<%= plural_table_name %>/#@{<%= singular_table_name %>.id}")}
33
+ render json: {success: true, location: url_for("/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}")}
34
34
  else
35
35
  redirect_to "/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}"
36
36
  end
@@ -43,7 +43,7 @@ class <%= controller_class_name %>Controller < ApplicationController
43
43
  def update
44
44
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
45
45
  if request.xhr?
46
- render json: {success: true, location: url_for("/<%= plural_table_name %>/#@{<%= singular_table_name %>.id}")}
46
+ render json: {success: true, location: url_for("/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}")}
47
47
  else
48
48
  redirect_to "/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}"
49
49
  end
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
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: 1.5.1
4
+ version: 1.5.2
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-01-11 00:00:00.000000000 Z
11
+ date: 2019-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord