sumomo 0.7.2 → 0.7.3

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
  SHA1:
3
- metadata.gz: eedd627e371d22547e9f4a25f5eb7f913116a391
4
- data.tar.gz: 3ed9a3f02775ede22c5072ea0b1f9136e9242489
3
+ metadata.gz: da1b5b6612475c1c796f2fc3e25d24b941e6a37f
4
+ data.tar.gz: b67672d8fb1595aa5c373bf694f675440bbe1839
5
5
  SHA512:
6
- metadata.gz: 8a542867a471555b413c97eda75e6bf42b3d44d4b763f682982150de9b8beccffaee828930df0ada01958f70cf0f47e0e7ff5d31a93298cd9c8037fa684461c1
7
- data.tar.gz: f7d7a7e77372122f0a97cef34e99bee744a6159caf8f0f675793819f2c3a74f93f39265483f377996e04708d96dacfe211c05998a44ab51dedc49d1fbb6e8871
6
+ metadata.gz: 85a1b46df2f52fb00d462c509094cd1b544f1acc5f3b34f29fd28ceaeaf0d88461fbeaac31af43fe537cf81f51c751b1940597543ed8c9ed7146d42daaaf50f3
7
+ data.tar.gz: 9a36dbedaa1bbe0a366625255b44a3bb78ad435ded63669294ee5e8401e135ecdae0dfe2fe63e8fd133187c6421849a40ad9a5c170d5fc936f6f465d2c42ae5c
data/lib/sumomo/api.rb CHANGED
@@ -177,6 +177,7 @@ module Sumomo
177
177
  HostedZoneId dns[:hosted_zone]
178
178
  Name domain_name
179
179
  Type "CNAME"
180
+ ResourceRecords [ call("Fn::Join", "", [api, ".execute-api.", ref("AWS::Region"), ".amazonaws.com"]) ]
180
181
  end
181
182
  domain_name
182
183
  else
data/lib/sumomo/cdn.rb CHANGED
@@ -1,12 +1,15 @@
1
1
 
2
2
  module Sumomo
3
3
  module Stack
4
- def make_cdn_from_dir(domain:, dir:, low_ttl: [])
4
+ def make_cdn_from_dir(domain:, dns:nil, name:nil, dir:, low_ttl: [])
5
5
 
6
6
  bucket_name = @bucket_name
7
7
 
8
+ name ||= make_default_resource_name("CDN")
9
+
8
10
  puts "Uploading files..."
9
- `aws s3 sync #{dir} "s3://#{bucket_name}/uploads/#{domain}" --size-only --delete`
11
+ `aws --version`
12
+ `aws s3 --region #{@region} sync #{dir} "s3://#{bucket_name}/uploads/#{domain}" --size-only --delete`
10
13
  puts "Done."
11
14
 
12
15
  oai = make "Custom::OriginAccessIdentity"
@@ -29,7 +32,7 @@ module Sumomo
29
32
  })
30
33
  end
31
34
 
32
- make "AWS::CloudFront::Distribution" do
35
+ cdn = make "AWS::CloudFront::Distribution", name: name do
33
36
  DistributionConfig do
34
37
  Origins [{
35
38
  Id: "originBucket",
@@ -77,6 +80,30 @@ module Sumomo
77
80
  end
78
81
  end
79
82
  end
83
+
84
+ root_name = /(?<root_name>[^.]+\.[^.]+)$/.match(domain)[:root_name]
85
+
86
+ if !dns
87
+
88
+ elsif dns[:type] == :cloudflare
89
+ make "Custom::CloudflareDNSEntry", name: "#{name}CloudFlareEntry" do
90
+ Key dns[:key]
91
+ Email dns[:email]
92
+ Domain root_name
93
+ Entry domain.sub(/#{root_name}$/, "").chomp(".")
94
+ CNAME cdn.DomainName
95
+ end
96
+ elsif dns[:type] == :route53
97
+ make "AWS::Route53::RecordSet", name: "#{name}Route53Entry" do
98
+ HostedZoneId dns[:hosted_zone]
99
+ Name domain
100
+ Type "CNAME"
101
+ ResourceRecords [ cdn.DomainName ]
102
+ end
103
+ end
104
+
105
+ cdn
106
+
80
107
  end
81
108
  end
82
109
  end
@@ -1,3 +1,3 @@
1
1
  module Sumomo
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
data/sumomo.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency "momo", "0.4.1"
34
34
  spec.add_dependency "s3cabinet"
35
- spec.add_dependency "aws-sdk", "2.10.9"
35
+ spec.add_dependency "aws-sdk", "~> 2"
36
36
  spec.add_dependency "rubyzip"
37
37
  spec.add_dependency "activesupport"
38
38
  spec.add_dependency "hashie"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: aws-sdk
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.10.9
89
+ version: '2'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.10.9
96
+ version: '2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubyzip
99
99
  requirement: !ruby/object:Gem::Requirement