fastlane-plugin-deploy_aws_s3_cloudfront 0.1.0 → 0.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0500edd450135787216b697b265b00710648c47
|
4
|
+
data.tar.gz: '0952020dbc72a12eaa3da0d27563a0bdbe466299'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f95baa3f9d161cdef7f69391c3c041b7c702fcf13390c7df0b90e09efa43a6a9ce76301eefd9e890077bcefbc2b6be6df8c6df5616d9d88906bd552bfd990c7
|
7
|
+
data.tar.gz: fb60b4b167cab1df74390f51e704ec4ccc8efbbdc0fa063783869b54015d6757b4994b505db5dd3b5c18efa32defe37b397c59eb0c79431915158f4169c9c1b7
|
data/lib/fastlane/plugin/deploy_aws_s3_cloudfront/actions/deploy_aws_s3_cloudfront_action.rb
CHANGED
@@ -3,6 +3,7 @@ require_relative '../helper/deploy_aws_s3_cloudfront_helper'
|
|
3
3
|
|
4
4
|
require 'aws-sdk-s3'
|
5
5
|
require 'aws-sdk-cloudfront'
|
6
|
+
require 'mimemagic'
|
6
7
|
|
7
8
|
module Fastlane
|
8
9
|
module Actions
|
@@ -14,16 +15,16 @@ module Fastlane
|
|
14
15
|
|
15
16
|
s3client = Aws::S3::Client.new(region: 'us-east-1')
|
16
17
|
|
17
|
-
files =
|
18
|
+
files = get_files_from_source(source)
|
18
19
|
|
19
|
-
paths = files.map {|file|
|
20
|
+
paths = files.map { |file|
|
20
21
|
key = file.relative_path_from(Pathname(source)).to_s
|
21
|
-
content_type =
|
22
|
+
content_type = get_content_type(file)
|
22
23
|
s3client.put_object({body: file.open("rb"), bucket: bucket, key: key.to_s, content_type: content_type})
|
23
|
-
"/" + key
|
24
|
+
return "/" + key
|
24
25
|
}
|
25
26
|
|
26
|
-
|
27
|
+
cloudfront = Aws::CloudFront::Client.new
|
27
28
|
|
28
29
|
invalidation = {
|
29
30
|
distribution_id: distribution_id,
|
@@ -36,9 +37,18 @@ module Fastlane
|
|
36
37
|
},
|
37
38
|
}
|
38
39
|
|
39
|
-
|
40
|
+
cloudfront.create_invalidation(invalidation)
|
40
41
|
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.get_files_from_source(source)
|
45
|
+
return Dir.glob("#{source}/**/*").select {|f| File.file? f}.map {|f| Pathname(f)}
|
46
|
+
end
|
41
47
|
|
48
|
+
def self.get_content_type(file)
|
49
|
+
content_type = MimeMagic.by_path(file)
|
50
|
+
content_type = 'application/octet-stream' unless content_type
|
51
|
+
return content_type.to_s
|
42
52
|
end
|
43
53
|
|
44
54
|
def self.description
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-deploy_aws_s3_cloudfront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hector
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.15'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mimemagic
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pry
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +190,7 @@ files:
|
|
176
190
|
- lib/fastlane/plugin/deploy_aws_s3_cloudfront/actions/deploy_aws_s3_cloudfront_action.rb
|
177
191
|
- lib/fastlane/plugin/deploy_aws_s3_cloudfront/helper/deploy_aws_s3_cloudfront_helper.rb
|
178
192
|
- lib/fastlane/plugin/deploy_aws_s3_cloudfront/version.rb
|
179
|
-
homepage:
|
193
|
+
homepage: https://github.com/MrJeffApp/fastlane-plugin-deploy_aws_s3_cloudfront
|
180
194
|
licenses:
|
181
195
|
- MIT
|
182
196
|
metadata: {}
|