jekyll-s3-yearofmoo 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,8 +71,25 @@ cloudfront_distribution_id: YOUR_CLOUDFRONT_DIST_ID (OPTIONAL)
71
71
  paths
72
72
  end
73
73
 
74
- def customize_file_details(file)
74
+ def customize_file_metadata(file, object)
75
+ data = { :access => 'public-read' }
76
+ expiry = find_matching_expires_header(file)
77
+ if expiry
78
+ data[:expiry] = expiry
79
+ end
80
+ data
81
+ end
75
82
 
83
+ def find_matching_expires_header(file)
84
+ headers = @config['expire_headers']
85
+ raise headers.to_yaml
86
+ headers.each do |expire|
87
+ pattern = Regexp.new expire['pattern']
88
+ value = expire['value']
89
+ if value =~ pattern
90
+ return value
91
+ end
92
+ end
76
93
  end
77
94
 
78
95
  # Please spec me!
@@ -97,7 +114,10 @@ cloudfront_distribution_id: YOUR_CLOUDFRONT_DIST_ID (OPTIONAL)
97
114
  to_upload = local_files
98
115
  to_upload.each do |f|
99
116
  run_with_retry do
100
- if AWS::S3::S3Object.store(f, open("#{dir}/#{f}"), @s3_bucket, :access => 'public-read')
117
+ path = "#{dir}/#{f}"
118
+ metadata = customize_file_metadata(path)
119
+ raise metadata.to_yaml
120
+ if AWS::S3::S3Object.store(f, open(path), @s3_bucket, metadata)
101
121
  puts("Upload #{f}: Success!")
102
122
  else
103
123
  puts("Upload #{f}: FAILURE!")
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module S3
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Philippe Creux