jets 2.3.11 → 2.3.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: beb54ab2c1991990d3be85c4e2d94f72c1f73b0e12f5a8044d379c6159709227
4
- data.tar.gz: 49c29bf31948637c8a7eb32996dfa6abfb05bf9cc01b225a870b4eb101b03ebc
3
+ metadata.gz: 14f4e12068a48f8ff8d9114f69f9b01da482d89c78a4f7027a42c4c33995de93
4
+ data.tar.gz: 2a078028215d546115310857ec3c37ec629b0be726182e4c6a4f1d6ddd2f9dd2
5
5
  SHA512:
6
- metadata.gz: 42b38a1514b00fb9cf3ddaecb38aee24d684ce8cee488d165632cc583ed01fa12b74501f0ec6391c2353d495f13a8fca85670c514915295af28c7e9cfe0059f9
7
- data.tar.gz: ae08ef47dd5c96e0017d6a04151d63993dc686203c74f19cf84638822d9c3bbb7b3054e333d152bdd01942f87d6126d63c3a77d79aae7e300ed97c8ea29cd328
6
+ metadata.gz: ae698eaaba985b224cb01b43e2ac90015ae5e7a5fd1eaf4a4c9a97e76303b9fc700fe3e251843bc7fb6c209a94c51f7a07743a98203bdb27e79c6dc19c18c026
7
+ data.tar.gz: 40142abe6a735a848f1931fa1f044f5964191b1c0326cce0b00d3850b05023ab238b97b5c793d13e7c7b78bf5e4e3a1baa747f0fb233c7fd5f4e3535c9207e44
@@ -3,6 +3,16 @@
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.3.12]
7
+ - #421 use underscore for database name in database.yml
8
+ - #422 url_for: allow any activemodel compatiable object to work
9
+ - #423 add apex domain support
10
+ - #424 md5 fix subtle bug when code doesnt get uploaded from newly generated shims
11
+ - #425 add hosted zone id support
12
+ - #426 use headers origin for actual host in case of cloudfront in front
13
+ - #428 fixes to JETS_BUILD_NO_INTERNET env var option
14
+ - #429 fix simple function tmp_loader
15
+
6
16
  ## [2.3.11]
7
17
  - #419 Added forward slash before script_name env variable, so that correct path get generated. As it happens Rails
8
18
 
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Ruby and Lambda splat out a baby and that child's name is [Jets](http://rubyonjets.com/).
6
6
 
7
- ![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiRXY0bzFlZS93TUF0cXhDaGdEY2FIbTVtdW43YjB0andmbnRTL3VvbWJOcTBOM3IxWDZPSFh2OHpvczBmdU5QcHpjUThvd084RERORFlvZVI4QWVKcis0PSIsIml2UGFyYW1ldGVyU3BlYyI6IllBZk0xTmVWZ3c2K3VWdTYiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
7
+ ![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiZ08vK2hjOHczQUVoUDhSYnBNNUU4T0gxQWJuOTlLaXpwVGQ1NjJ3NnVDY1dSdFVXQ3d2VXVSQzRFcU1qd1JPMndFZlByRktIcTUrZm5GWlM5dHpjM1ZrPSIsIml2UGFyYW1ldGVyU3BlYyI6Imluc1Qrd25GanhUdHlidjUiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
8
8
  [![CircleCI](https://circleci.com/gh/tongueroo/jets.svg?style=svg)](https://circleci.com/gh/tongueroo/jets)
9
9
  [![Gem Version](https://badge.fury.io/rb/jets.svg)](https://badge.fury.io/rb/jets)
10
10
  [![Support](https://img.shields.io/badge/Support-Help-blue.svg)](http://rubyonjets.com/support/)
@@ -77,6 +77,7 @@ module Jets::Builders
77
77
  end
78
78
 
79
79
  def exist_on_s3?(filename)
80
+ return false if ENV['JETS_BUILD_NO_INTERNET']
80
81
  s3_key = "jets/code/#{filename}"
81
82
  begin
82
83
  s3.head_object(bucket: s3_bucket, key: s3_key)
@@ -98,8 +99,8 @@ module Jets::Builders
98
99
 
99
100
  # Code prep and zipping
100
101
  check_code_size!
101
- calculate_md5s # must be called before generate_shims and create_zip_files
102
102
  generate_shims
103
+ calculate_md5s # must be called before create_zip_files because checksums need to be populated
103
104
  create_zip_files
104
105
  end
105
106
 
@@ -152,6 +152,8 @@ module Jets::Commands
152
152
 
153
153
  # All CloudFormation states listed here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html
154
154
  def exit_unless_updateable!
155
+ return if ENV['JETS_FORCE_UPDATEABLE'] # useful for debugging if stack stack updating
156
+
155
157
  stack_name = Jets::Naming.parent_stack_name
156
158
  exists = stack_exists?(stack_name)
157
159
  return unless exists # continue because stack could be updating
@@ -24,6 +24,7 @@ module Jets::Commands
24
24
 
25
25
  def set_initial_variables
26
26
  @project_name = project_folder == '.' ? File.basename(Dir.pwd) : project_folder
27
+ @database_name = @project_name.gsub('-','_')
27
28
 
28
29
  # options is a frozen hash by Thor so cannot modify it.
29
30
  # Also had trouble unfreezing it with .dup. So using instance variables instead
@@ -2,7 +2,7 @@ default: &default
2
2
  adapter: <%= @database == 'mysql' ? 'mysql2' : 'postgresql' %>
3
3
  encoding: <%= @database == 'mysql' ? 'utf8mb4' : 'unicode' %>
4
4
  pool: <%%= ENV["DB_POOL"] || 5 %>
5
- database: <%%= ENV['DB_NAME'] || '<%= @project_name %>_development' %>
5
+ database: <%%= ENV['DB_NAME'] || '<%= @database_name %>_development' %>
6
6
  <% if @database == 'mysql' -%>
7
7
  username: <%%= ENV['DB_USER'] || 'root' %>
8
8
  <% else -%>
@@ -15,13 +15,13 @@ default: &default
15
15
 
16
16
  development:
17
17
  <<: *default
18
- database: <%%= ENV['DB_NAME'] || '<%= @project_name %>_development' %>
18
+ database: <%%= ENV['DB_NAME'] || '<%= @database_name %>_development' %>
19
19
 
20
20
  test:
21
21
  <<: *default
22
- database: <%= @project_name %>_test
22
+ database: <%= @database_name %>_test
23
23
 
24
24
  production:
25
25
  <<: *default
26
- database: <%= @project_name %>_production
26
+ database: <%= @database_name %>_production
27
27
  url: <%%= ENV['DATABASE_URL'] %>
@@ -72,7 +72,8 @@ class Jets::Controller
72
72
  end
73
73
 
74
74
  def actual_host
75
- headers["host"]
75
+ # actually host is in headers["origin"] when cloudfront is in front
76
+ headers["origin"] || headers["host"]
76
77
  end
77
78
 
78
79
  end
@@ -1,6 +1,8 @@
1
1
  module Jets::Job::Dsl
2
2
  module DynamodbEvent
3
3
  def dynamodb_event(table_name, options={})
4
+ return if ENV['JETS_BUILD_NO_INTERNET'] # Disable during build since jets build tries to init this
5
+
4
6
  stream_arn = full_dynamodb_stream_arn(table_name)
5
7
  default_iam_policy = default_dynamodb_stream_policy(stream_arn)
6
8
 
@@ -35,7 +35,7 @@ module Jets::Lambda
35
35
  def build
36
36
  code = IO.read(@code_path)
37
37
  function_klass = Class.new(Jets::Lambda::Function)
38
- function_klass.module_eval(code)
38
+ function_klass.module_eval(code, @code_path)
39
39
  adjust_tasks(function_klass)
40
40
  function_klass # assign this to a Constant for a pretty class name
41
41
  end
@@ -6,17 +6,16 @@ module Jets::UrlHelper
6
6
 
7
7
  # Basic implementation of url_for to allow use helpers without routes existence
8
8
  def url_for(options = nil) # :nodoc:
9
- url = case options
10
- when String
9
+ url = if options.is_a?(String)
11
10
  options
12
- when :back
11
+ elsif options == :back
13
12
  _back_url
14
- when ActiveRecord::Base
13
+ elsif options.respond_to?(:to_model)
15
14
  _handle_model(options)
16
- when Array
15
+ elsif options.is_a?(Array)
17
16
  _handle_array(options)
18
17
  else
19
- raise ArgumentError, "Please provided a String or ActiveRecord model to link_to as the the second argument. The Jets link_to helper takes as the second argument."
18
+ raise ArgumentError, "The Jets link_to helper only supports some types of arguments. Please provided a String or an object that supports ActiveModel to link_to as the the second argument."
20
19
  end
21
20
 
22
21
  add_stage_name(url)
@@ -40,9 +40,15 @@ module Jets::Resource::ApiGateway
40
40
  end
41
41
 
42
42
  def domain_name
43
- subdomain = Jets.project_namespace
44
- managed_domain_name = "#{subdomain}.#{Jets.config.domain.hosted_zone_name}"
45
- name = Jets.config.domain.name || managed_domain_name
43
+ name = Jets.config.domain.name
44
+ if Jets.config.domain.apex
45
+ name ||= Jets.config.domain.hosted_zone_name
46
+ else
47
+ subdomain = Jets.project_namespace
48
+ managed_domain_name = "#{subdomain}.#{Jets.config.domain.hosted_zone_name}"
49
+ name ||= managed_domain_name
50
+ end
51
+
46
52
  # Strip trailing period if there is one set accidentally or else get this error
47
53
  # Trailing period should be omitted from domain name (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException
48
54
  name.sub(/\.$/,'')
@@ -18,20 +18,48 @@ module Jets::Resource::Route53
18
18
  {
19
19
  dns_record: {
20
20
  type: "AWS::Route53::RecordSet",
21
- properties: {
22
- hosted_zone_name: hosted_zone_name,
23
- comment: "DNS record managed by Jets",
24
- name: name,
25
- type: "CNAME",
26
- ttl: "60",
27
- resource_records: [
28
- cname,
29
- ],
30
- }
21
+ properties: record_set_properties
31
22
  }
32
23
  }
33
24
  end
34
25
 
26
+ def record_set_properties
27
+ base = {
28
+ comment: "DNS record managed by Jets",
29
+ name: name,
30
+ }
31
+ hosted_zone_id = Jets.config.domain.hosted_zone_id
32
+ if hosted_zone_id
33
+ base[:hosted_zone_id] = hosted_zone_id
34
+ else
35
+ base[:hosted_zone_name] = hosted_zone_name
36
+ end
37
+
38
+ if Jets.config.domain.apex
39
+ base.merge(
40
+ alias_target: {
41
+ dns_name: cname,
42
+ hosted_zone_id: domain_name_hosted_zone,
43
+ },
44
+ type: "A",
45
+ )
46
+ else
47
+ base.merge({
48
+ type: "CNAME",
49
+ ttl: "60",
50
+ resource_records: [cname],
51
+ })
52
+ end
53
+ end
54
+
55
+ def domain_name_hosted_zone
56
+ if endpoint_types.include?("REGIONAL")
57
+ "!GetAtt DomainName.RegionalHostedZoneId"
58
+ else
59
+ "!GetAtt DomainName.DistributionHostedZoneId"
60
+ end
61
+ end
62
+
35
63
  def cname
36
64
  if endpoint_types.include?("REGIONAL")
37
65
  "!GetAtt DomainName.RegionalDomainName"
@@ -8,7 +8,8 @@ module Jets
8
8
 
9
9
  def initialize(yaml_path=nil)
10
10
  yaml_path ||= "#{Jets.root}/handlers/data.yml"
11
- @data = YAML.load_file(yaml_path) if File.exist?(yaml_path)
11
+ return unless File.exist?(yaml_path)
12
+ @data = YAML.load_file(yaml_path)
12
13
  @s3_bucket = @data['s3_bucket']
13
14
  @rack_zip = @data['rack_zip']
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "2.3.11"
2
+ VERSION = "2.3.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: 2.3.11
4
+ version: 2.3.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: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2020-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -1101,7 +1101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1101
1101
  - !ruby/object:Gem::Version
1102
1102
  version: '0'
1103
1103
  requirements: []
1104
- rubygems_version: 3.0.6
1104
+ rubygems_version: 3.1.2
1105
1105
  signing_key:
1106
1106
  specification_version: 4
1107
1107
  summary: Ruby Serverless Framework