jets 2.0.4 → 2.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: 2b8feeca879fd1adda5fb63cd872c48fe16db73fc07e12589e82074dc2d23a21
4
- data.tar.gz: 6719c8ea953c06b04e09af7942ff51696027af86ae67b7eadeafdcea9d536d31
3
+ metadata.gz: 123389cefd68a8b8a119f83358019cd456d76d181c42a320051a73e1c03c87e6
4
+ data.tar.gz: d805927821c334310cdb8ae2c998f4e1b3ef87921a660d48dfc90e923789b595
5
5
  SHA512:
6
- metadata.gz: 6f98de3cc8fb239474ed79cbf0031b8ec3d880f2fc862e21e09d5f3f59d1743ccd071320c9e0984a6cb5b9608c15cd338a8ddb6096245e6fe822abd9d73aeb5f
7
- data.tar.gz: 9d118c05ac914b609e4a4e4d792723fa3e017f954327ecfdc96648be186a8db18a7246255ed736dca468c59582f9253ec7dda83d43bc45508878c69bfbd06cba
6
+ metadata.gz: 80ffdd4a8cf53d311c0db441ca44d15acab2c107cb45f09e857bf9245b57b875ad6504ca65beebb55ae263484750681e737c6c66d513e4fc3701a3150d62a6e0
7
+ data.tar.gz: e9a0be9ea49d69363426a161f07cfec13a0a9ca14f351a543f48c9589674d850a1e9ea9d147e712cdd50805eb8605ffde957b83d7a529904b70663f7c91ddee2
@@ -112,12 +112,6 @@ jobs:
112
112
  output = json
113
113
  EOL
114
114
 
115
- cat >~/.aws/credentials <<EOL
116
- [default]
117
- aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}
118
- aws_access_key_id = ${AWS_ACCESS_KEY_ID}
119
- EOL
120
-
121
115
  # collect reports
122
116
  - store_test_results:
123
117
  path: /tmp/test-results
@@ -7,10 +7,8 @@ assignees: ''
7
7
 
8
8
  ---
9
9
 
10
- <!--
11
- The Jets issue tracker IS NOT for usage questions! Please post your question on our dedicated forum at https://community.rubyonjets.com
10
+ The Jets issue tracker IS NOT for usage questions! Please post your question on our dedicated forum at https://community.rubyonjets.com
12
11
 
13
- To be sensitive to everyone's time, we may close issues asking questions without comment. Posting your questions in the Jets community forum is the best place. It also benefits others by making the questions easier to find. Here are some additional options also http://rubyonjets.com/docs/support/ 👌
12
+ To be sensitive to everyone's time, we may close issues asking questions without comment. If you repeatedly post questions in the issues tracker, you may be blocked from ever submitting issues to Jets again. Please use your best judgment. 👍
14
13
 
15
- Thank you!
16
- -->
14
+ Posting your questions in the Jets community forum benefits others by grouping questions in a dedicated place. Here are some additional options also http://rubyonjets.com/docs/support/ 😁
@@ -3,6 +3,17 @@
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
+ ## [2.0.5]
7
+ - #333 Always keep vendor directory
8
+ - #335 Controller action_name method
9
+ - #336 Escape paths passed to rsync
10
+ - #338 Support for "apiKeyRequired" option for API method
11
+ - #339 Implement endpoint_policy configuration
12
+ - #340 Fix tidy_spec from #333
13
+ - #341 Return exist status 1 if deployment fails
14
+ - #342 Adding support for `:only` option, to the skip\_before_action method
15
+ - #343 spec helpers: dont cache request headers between specs
16
+
6
17
  ## [2.0.4]
7
18
  - #332 spec helpers: include routes helper
8
19
 
@@ -99,6 +99,8 @@ class Jets::Application
99
99
  config.api.cors_authorization_type = nil # nil so ApiGateway::Cors#cors_authorization_type handles
100
100
  config.api.binary_media_types = ['multipart/form-data']
101
101
  config.api.endpoint_type = 'EDGE' # PRIVATE, EDGE, REGIONAL
102
+ config.api.endpoint_policy = nil # required when endpoint_type is EDGE
103
+ config.api.api_key_required = false # Turn off API key required
102
104
 
103
105
  config.domain = ActiveSupport::OrderedOptions.new
104
106
  # config.domain.name = "#{Jets.project_namespace}.coolapp.com" # Default is nil
@@ -55,7 +55,7 @@ module Jets::Builders
55
55
  # We clean out ignored files pretty aggressively. So provide
56
56
  # a way for users to keep files from being cleaned out.
57
57
  def jetskeep
58
- always = %w[.bundle packs]
58
+ always = %w[.bundle packs vendor]
59
59
  path = "#{@project_root}/.jetskeep"
60
60
  return always unless File.exist?(path)
61
61
 
@@ -40,7 +40,7 @@ module Jets::Cfn
40
40
  The specific child stack usually shows more detailed information and can be used to resolve the issue.
41
41
  Example of checking the CloudFormation console: https://rubyonjets.com/docs/debugging/cloudformation/
42
42
  EOL
43
- return
43
+ exit 1
44
44
  end
45
45
 
46
46
  prewarm
@@ -97,6 +97,10 @@ class Jets::Controller
97
97
  paths
98
98
  end
99
99
 
100
+ def action_name
101
+ @meth
102
+ end
103
+
100
104
  def self.controller_path
101
105
  name.sub(/Controller$/, "".freeze).underscore
102
106
  end
@@ -127,5 +131,14 @@ class Jets::Controller
127
131
  self.auth_type
128
132
  end
129
133
  end
134
+
135
+ class_attribute :api_key_needed
136
+ def self.api_key_required(value=nil)
137
+ if !value.nil?
138
+ self.api_key_needed = value
139
+ else
140
+ self.api_key_needed
141
+ end
142
+ end
130
143
  end
131
144
  end
@@ -8,25 +8,28 @@ class Jets::Controller
8
8
  class_attribute :after_actions, default: []
9
9
 
10
10
  class << self
11
- def before_action(meth, options={})
11
+ def before_action(meth, options = {})
12
12
  self.before_actions += [[meth, options]]
13
13
  end
14
14
 
15
- def prepend_before_action(meth, options={})
15
+ def prepend_before_action(meth, options = {})
16
16
  self.before_actions = [[meth, options]] + self.before_actions
17
17
  end
18
18
 
19
- def skip_before_action(meth)
20
- self.before_actions = self.before_actions.reject { |el| el.first.to_s == meth.to_s }
19
+ def skip_before_action(meth, options = {})
20
+ # adds the methods in the only to the exception list for the callback
21
+ return append_except_to_callbacks(self.before_actions, meth, options[:only]) if options[:only].present?
22
+
23
+ self.before_actions.reject! { |el| el.first.to_s == meth.to_s }
21
24
  end
22
25
 
23
26
  alias_method :append_before_action, :before_action
24
27
 
25
- def after_action(meth, options={})
28
+ def after_action(meth, options = {})
26
29
  self.after_actions += [[meth, options]]
27
30
  end
28
31
 
29
- def prepend_after_action(meth, options={})
32
+ def prepend_after_action(meth, options = {})
30
33
  self.after_actions = [[meth, options]] + self.after_actions
31
34
  end
32
35
 
@@ -35,6 +38,20 @@ class Jets::Controller
35
38
  end
36
39
 
37
40
  alias_method :append_after_action, :after_action
41
+
42
+ private
43
+
44
+ def append_except_to_callbacks(callback_methods, meth, excepted_methods)
45
+ callback_methods.map! do |callback_method|
46
+ if callback_method.first.to_s == meth.to_s
47
+ exceptions = callback_method.second[:except] || []
48
+ exceptions.concat(Array.wrap(excepted_methods))
49
+ callback_method.second[:except] = exceptions
50
+ end
51
+
52
+ callback_method
53
+ end
54
+ end
38
55
  end
39
56
  end # included
40
57
 
@@ -20,6 +20,7 @@ module Jets::Resource::ApiGateway
20
20
  http_method: @route.method,
21
21
  request_parameters: {},
22
22
  authorization_type: authorization_type,
23
+ api_key_required: api_key_required?,
23
24
  integration: {
24
25
  integration_http_method: "POST",
25
26
  type: "AWS_PROXY",
@@ -72,10 +73,26 @@ module Jets::Resource::ApiGateway
72
73
  end
73
74
 
74
75
  def controller_auth_type
75
- controller_name = @route.to.split('#').first
76
- controller = "#{controller_name}_controller".camelize.constantize
77
76
  # Already handles inheritance via class_attribute
78
- controller.authorization_type
77
+ controller_klass.authorization_type
78
+ end
79
+
80
+ def api_key_required?
81
+ api_key_required == true
82
+ end
83
+
84
+ def api_key_required
85
+ @route.api_key_required ||
86
+ controller_klass.api_key_required ||
87
+ Jets.config.api.api_key_required
88
+ end
89
+
90
+ def controller_klass
91
+ @controller_klass ||= "#{controller_name}_controller".camelize.constantize
92
+ end
93
+
94
+ def controller_name
95
+ @controller_name ||= @route.to.split('#').first
79
96
  end
80
97
 
81
98
  def resource_id
@@ -6,6 +6,7 @@ module Jets::Resource::ApiGateway
6
6
  endpoint_configuration: { types: endpoint_types }
7
7
  }
8
8
  properties[:binary_media_types] = binary_media_types if binary_media_types
9
+ properties[:policy] = endpoint_policy if endpoint_policy
9
10
 
10
11
  {
11
12
  internal_logical_id => {
@@ -52,5 +53,12 @@ module Jets::Resource::ApiGateway
52
53
 
53
54
  [types].flatten
54
55
  end
56
+
57
+ def endpoint_policy
58
+ endpoint_policy = Jets.config.api.endpoint_policy
59
+ return nil if endpoint_policy.nil? || endpoint_policy.empty?
60
+
61
+ endpoint_policy
62
+ end
55
63
  end
56
64
  end
@@ -33,10 +33,6 @@ class Jets::Router
33
33
  klass = class_name.constantize # Index, Show, Edit, New
34
34
  code = klass.new(@options, @scope, @controller)
35
35
 
36
- # puts "define_#{action}_methods:".color(:yellow) if code.path_method
37
- # puts code.path_method.color(:blue) if code.path_method
38
- # puts code.url_method.color(:blue) if code.url_method
39
-
40
36
  def_meth(code.path_method) if code.path_method
41
37
  def_meth(code.url_method) if code.url_method
42
38
  end
@@ -187,6 +187,10 @@ class Jets::Router
187
187
  @options[:authorization_type]
188
188
  end
189
189
 
190
+ def api_key_required
191
+ @options[:api_key_required]
192
+ end
193
+
190
194
  private
191
195
  def ensure_jets_format(path)
192
196
  path.split('/').map do |s|
@@ -223,4 +227,4 @@ class Jets::Router
223
227
  text
224
228
  end
225
229
  end
226
- end
230
+ end
@@ -2,12 +2,11 @@ module Jets::SpecHelpers
2
2
  module Controllers
3
3
  include Jets::Router::Helpers # must be at the top because response is overridden later
4
4
 
5
- attr_reader :request, :response
6
-
7
- def initialize(*)
8
- super
9
- @request = Request.new(:get, '/', {}, Params.new)
10
- @response = nil # will be set after http_call
5
+ attr_reader :response
6
+ # Note: caching it like this instead of within the initialize results in the headers not being cached
7
+ # See: https://community.rubyonjets.com/t/is-jets-spechelpers-controllers-request-being-cached/244/2
8
+ def request
9
+ @request ||= Request.new(:get, '/', {}, Params.new)
11
10
  end
12
11
 
13
12
  rest_methods = %w[get post put patch delete]
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  class Jets::Util
2
4
  class << self
3
5
  # Make sure that the result is a text.
@@ -14,7 +16,7 @@ class Jets::Util
14
16
  src.chop! if src.ends_with?('/')
15
17
  dest.chop! if dest.ends_with?('/')
16
18
  check_rsync_installed!
17
- sh "rsync -a --links --no-specials --no-devices #{src}/ #{dest}/", quiet: true
19
+ sh "rsync -a --links --no-specials --no-devices #{Shellwords.escape(src)}/ #{Shellwords.escape(dest)}/", quiet: true
18
20
  end
19
21
 
20
22
  @@rsync_installed = false
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "2.0.4"
2
+ VERSION = "2.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: 2.0.4
4
+ version: 2.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: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2019-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer