middleman-s3_sync 3.0.24 → 3.0.25

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: 0b9b84a585a23ac844820e4d660bced854f25d01
4
- data.tar.gz: 1a8472d86f42ba7de9818c611f557027fc80faef
3
+ metadata.gz: 53f0c96631ec71ebe886bd3ced01e219472f1f84
4
+ data.tar.gz: b21736f5dc8297323c381d7e1aec408840ded0d1
5
5
  SHA512:
6
- metadata.gz: 7074b97dad9f286539473433f04b639e247a055de8b5daba4e23cf0efb65405d46d44ecdca6f286ee3d53e3c3f5405f013e6ecfada90ec7586c31893b41711be
7
- data.tar.gz: dfa596b0827285c4101c0b4890adaa414f9b7aba311b9d64c2b08660a5d5851e62660389186b23915afb748120fd46dcee807a4f413d6730f34934cf348615f7
6
+ metadata.gz: d7af119cda3ba1ef4f4ad99575450c7d2c42760dd2625efd2cfd7d93ec1bfab79ca5e03ec1935e929bf065587ddeaef032dee108145d4eac1f2da4e7e6abd8d2
7
+ data.tar.gz: 3acc9be46d830b93d01c8b66c94ea30eb72eb09b519589458ccf5617e8bb9f44600328a74e2184828e070e52129b438154512d655fe0f34fd32ce52d9749250e
data/README.md CHANGED
@@ -231,7 +231,7 @@ compressed version of the resource.
231
231
  I used Middleman Sync as a template for building a Middleman extension.
232
232
  The code is well structured and easy to understand and it was easy to
233
233
  extend it to add my synchronization code. My gratitude goes to @karlfreeman
234
- and is work on Middleman sync.
234
+ and his work on Middleman sync.
235
235
 
236
236
  Many thanks to [Gnip](http://gnip.com) and [dojo4](http://dojo4.com) for
237
237
  supporting and sponsoring work on middleman-s3_sync.
@@ -6,7 +6,7 @@ module Middleman
6
6
  CONTENT_MD5_KEY = 'x-amz-meta-content-md5'
7
7
 
8
8
  include Status
9
-
9
+
10
10
  def s3_resource
11
11
  @full_s3_resource || @partial_s3_resource
12
12
  end
@@ -135,7 +135,7 @@ module Middleman
135
135
  def to_create?
136
136
  status == :new
137
137
  end
138
-
138
+
139
139
  def alternate_encoding?
140
140
  status == :alternate_encoding
141
141
  end
@@ -170,12 +170,14 @@ module Middleman
170
170
  if !gzipped
171
171
  # we're not gzipped, object hashes being different indicates updated content
172
172
  :updated
173
- elsif (local_content_md5 != remote_content_md5)
173
+ elsif local_content_md5 != remote_content_md5
174
174
  # we're gzipped, so we checked the content MD5, and it also changed
175
175
  :updated
176
+ elsif !encoding_match?
177
+ :updated
176
178
  else
177
179
  # we're gzipped, the object hashes differ, but the content hashes are equal
178
- # this means the gzipped bits changed while the compressed bits did not
180
+ # this means the gzipped bits changed while the original bits did not
179
181
  # what's more, we spent a HEAD request to find out
180
182
  :alternate_encoding
181
183
  end
@@ -188,7 +190,7 @@ module Middleman
188
190
  :deleted
189
191
  end
190
192
  end
191
-
193
+
192
194
  def local?
193
195
  File.exist?(local_path)
194
196
  end
@@ -208,11 +210,15 @@ module Middleman
208
210
  def relative_path
209
211
  @relative_path ||= local_path.gsub(/#{build_dir}/, '')
210
212
  end
211
-
213
+
212
214
  def remote_object_md5
213
215
  s3_resource.etag
214
216
  end
215
-
217
+
218
+ def encoding_match?
219
+ (gzipped && full_s3_resource.content_encoding == 'gzip') || (!gzipped && !full_s3_resource.content_encoding )
220
+ end
221
+
216
222
  def remote_content_md5
217
223
  full_s3_resource.metadata[CONTENT_MD5_KEY]
218
224
  end
@@ -220,7 +226,7 @@ module Middleman
220
226
  def local_object_md5
221
227
  @local_object_md5 ||= Digest::MD5.hexdigest(File.read(local_path))
222
228
  end
223
-
229
+
224
230
  def local_content_md5
225
231
  @local_content_md5 ||= Digest::MD5.hexdigest(File.read(original_path))
226
232
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module S3Sync
3
- VERSION = "3.0.24"
3
+ VERSION = "3.0.25"
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.0.24
4
+ version: 3.0.25
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: 2014-01-14 00:00:00.000000000 Z
12
+ date: 2014-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core