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 +4 -4
- data/lib/sumomo/api.rb +1 -0
- data/lib/sumomo/cdn.rb +30 -3
- data/lib/sumomo/version.rb +1 -1
- data/sumomo.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da1b5b6612475c1c796f2fc3e25d24b941e6a37f
|
4
|
+
data.tar.gz: b67672d8fb1595aa5c373bf694f675440bbe1839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a1b46df2f52fb00d462c509094cd1b544f1acc5f3b34f29fd28ceaeaf0d88461fbeaac31af43fe537cf81f51c751b1940597543ed8c9ed7146d42daaaf50f3
|
7
|
+
data.tar.gz: 9a36dbedaa1bbe0a366625255b44a3bb78ad435ded63669294ee5e8401e135ecdae0dfe2fe63e8fd133187c6421849a40ad9a5c170d5fc936f6f465d2c42ae5c
|
data/lib/sumomo/api.rb
CHANGED
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
|
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
|
data/lib/sumomo/version.rb
CHANGED
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
|
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.
|
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
|
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
|
96
|
+
version: '2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubyzip
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|