middleman-s3_sync 3.3.0 → 3.3.1

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: 0ea0d9098ccfca7a420089e791da7f7881298c5c
4
- data.tar.gz: 93b501fb586db5be0cd329c448ac2edb5da3c044
3
+ metadata.gz: bbe1bbc3f37ac9a58dc960c2851e4cca0da2d9af
4
+ data.tar.gz: dabc060ce159efcd4da2914c287bd472de251d2c
5
5
  SHA512:
6
- metadata.gz: 1d4b328645fe0171b6b5f01c0b0f2f19428c17a06b0e0af8bfa9b908763982e5a12b52b2c33e7b1a57b4e7e6bdd424ae27e302d97b17db7a8f08654868239615
7
- data.tar.gz: 9d427de8aca80db2ff476dc42da6a2fc11bb769651c8f16a24780dbc0b9a9ae51459a038ae8c85abff8a45c5728d511791254bdc8566368f8d066a1d0089453a
6
+ metadata.gz: 4373ce2b29ba731e7bbbc4669985dc053237346af133bb393ff3ad77d9e1452c68c0cb7d677750a4fccfce1c7dc0486d9b277c380c94c5458e35b7bfb1026ead
7
+ data.tar.gz: 086a206d09def300b30a0360d8f3734779cee3eced112569f5ccd1bf301406245acf41647f871eee2d4aba3c8021fe8fbd8009e0b3e8283077916be67344da22
data/README.md CHANGED
@@ -60,6 +60,7 @@ The following defaults apply to the configuration items:
60
60
  | ----------------- | ---------------------------- |
61
61
  | aws_access_key_id | ```ENV['AWS_ACCESS_KEY_ID']``` |
62
62
  | aws_secret_access_key | ```ENV['AWS_SECRET_ACCESS_KEY']``` |
63
+ | bucket | ```ENV['AWS_BUCKET']``` |
63
64
  | delete | ```true``` |
64
65
  | after_build | ```false``` |
65
66
  | prefer_gzip | ```true``` |
@@ -113,6 +114,7 @@ map to the following values:
113
114
  | --------------------- | ---------------------------------- |
114
115
  | aws_access_key_id | ```ENV['AWS_ACCESS_KEY_ID']``` |
115
116
  | aws_secret_access_key | ```ENV['AWS_SECRET_ACCESS_KEY']``` |
117
+ | bucket | ```ENV['AWS_BUCKET']``` |
116
118
 
117
119
  The environment is used when the credentials are not set in the activate
118
120
  method or passed through the ```.s3_sync``` configuration file.
@@ -33,7 +33,9 @@ module Middleman
33
33
  aliases: '-n'
34
34
 
35
35
  def s3_sync
36
- ::Middleman::S3Sync.app = ::Middleman::Application.server.inst
36
+ ::Middleman::S3Sync.app = ::Middleman::Application.server.inst do
37
+ config[:environment] = :build
38
+ end
37
39
 
38
40
  s3_sync_options = ::Middleman::S3Sync.s3_sync_options
39
41
 
@@ -8,7 +8,7 @@ module Middleman
8
8
  option :prefix, nil, 'Path prefix of the resource we are looking for on the server.'
9
9
  option :http_prefix, nil, 'Path prefix of the resources'
10
10
  option :acl, 'public-read', 'ACL for the resources being pushed to S3'
11
- option :bucket, 'nil', 'The name of the bucket we are pushing to.'
11
+ option :bucket, nil, 'The name of the bucket we are pushing to.'
12
12
  option :region, 'us-east-1', 'The name of the AWS region hosting the S3 bucket'
13
13
  option :aws_access_key_id, ENV['AWS_ACCESS_KEY_ID'] , 'The AWS access key id'
14
14
  option :aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY'], 'The AWS secret access key'
@@ -35,6 +35,7 @@ module Middleman
35
35
  read_config
36
36
  options.aws_access_key_id ||= ENV['AWS_ACCESS_KEY_ID']
37
37
  options.aws_secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']
38
+ options.bucket ||= ENV['AWS_BUCKET']
38
39
  options.http_prefix = app.http_prefix if app.respond_to? :http_prefix
39
40
  options.build_dir ||= app.build_dir if app.respond_to? :build_dir
40
41
  ::Middleman::S3Sync.s3_sync_options = s3_sync_options
@@ -68,9 +69,9 @@ module Middleman
68
69
  io = File.open(config_file_path, "r")
69
70
  end
70
71
 
71
- config = YAML.load(io).symbolize_keys
72
+ config = (YAML.load(io) || {}).symbolize_keys
72
73
 
73
- OPTIONS.each do |config_option|
74
+ options.all_settings.map(&:key).each do |config_option|
74
75
  self.send("#{config_option}=".to_sym, config[config_option]) if config[config_option]
75
76
  end
76
77
  end
@@ -166,7 +166,7 @@ module Middleman
166
166
  end
167
167
 
168
168
  def local?
169
- File.exist?(local_path)
169
+ File.exist?(local_path) && resource
170
170
  end
171
171
 
172
172
  def remote?
@@ -210,8 +210,8 @@ module Middleman
210
210
  end
211
211
 
212
212
  def content_type
213
- @content_type ||= Middleman::S3Sync.content_types[path]
214
- @content_type ||= resource.content_type
213
+ @content_type ||= Middleman::S3Sync.content_types[local_path]
214
+ @content_type ||= !resource.nil? ? resource.content_type : nil
215
215
  end
216
216
 
217
217
  def caching_policy
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.3.0"
3
+ VERSION = "3.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-s3_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederic Jean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-25 00:00:00.000000000 Z
12
+ date: 2015-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core