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: f1e0c63f08c090be804a0adf4cdfea3e067deb35
4
- data.tar.gz: c4e00690c78e6954b232a9e70582087643575456
3
+ metadata.gz: e0500edd450135787216b697b265b00710648c47
4
+ data.tar.gz: '0952020dbc72a12eaa3da0d27563a0bdbe466299'
5
5
  SHA512:
6
- metadata.gz: a7902952f2554ca1ed9baead54a4cb28b5748ea621726376544e24a4bebf1313fc49748a4a356344fcc4811c58a5407199e5a5347a7b0d42be403ac09daf5e19
7
- data.tar.gz: 3df31e1f1cdd93d2cb7ce3ce0081cd1381e11fc6d7bd68501b6f56c81908d0d319683a316af5446d2a2067642b05890631d4d5111a1fe904a045293baba97b27
6
+ metadata.gz: 6f95baa3f9d161cdef7f69391c3c041b7c702fcf13390c7df0b90e09efa43a6a9ce76301eefd9e890077bcefbc2b6be6df8c6df5616d9d88906bd552bfd990c7
7
+ data.tar.gz: fb60b4b167cab1df74390f51e704ec4ccc8efbbdc0fa063783869b54015d6757b4994b505db5dd3b5c18efa32defe37b397c59eb0c79431915158f4169c9c1b7
@@ -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 = Dir.glob("#{source}/**/*").select {|f| File.file? f}.map {|f| Pathname(f)}
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 = "application/json"
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
- cloudFront = Aws::CloudFront::Client.new
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
- cloudFront.create_invalidation(invalidation)
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
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module DeployAwsS3Cloudfront
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.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: {}