miasma-aws 0.1.12 → 0.1.14

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: 2967860cfc9a00bdddaeec82c625e67b0deebbc2
4
- data.tar.gz: 5aed93a44a616148a18a432b2e5f6a94b41c2958
3
+ metadata.gz: 73b61343ba58ba168a4374d7a27ebccf03be0755
4
+ data.tar.gz: 4a0890aae5f14b0fe5199aca62993698f92b7404
5
5
  SHA512:
6
- metadata.gz: 83cc2ff04ee739492a8c721d532c1c801f4e2a409c1472c5221c8e5cb67524406b067fa832d1307113e6621ae38eb83e08808cbaca507c0e798463a644f81e1e
7
- data.tar.gz: 8ed083d3348fd7dfc087c7195275b5c272bb8500e05c1a45eda9fef0978862cd3aee6ad55105916a4f43dd9aab3318e96f1cd99149713e0152bd5eb71e3fb984
6
+ metadata.gz: 8760d6337a22a3575ae9f95aa4a658b84138c790fa933250630b48791630223de8d0cfbc0ca1ae792da71c66d4b83c5507a31b88f779bdaaebfa73d3145c71ff
7
+ data.tar.gz: 61df3b1d4b30f7500bba01565bb0158276cafcb8d4b0ae4bd500a68a495168d1cd32c9571f157c92c89c3d9f39f291f83135869ad48e93912a3e20e3c5bfa1f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.14
2
+ * Fix checksum generation on multi-part uploads
3
+ * Fix paginated fetching of bucket objects
4
+
1
5
  ## v0.1.12
2
6
  * Update default file paths to use `Dir.home` instead of ~ expansion
3
7
  * Fix bug reading .aws/credentials when whitespace is used
@@ -1,4 +1,4 @@
1
1
  module MiasmaAws
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.1.12')
3
+ VERSION = Gem::Version.new('0.1.14')
4
4
  end
@@ -15,6 +15,33 @@ module Miasma
15
15
  include Contrib::AwsApiCore::ApiCommon
16
16
  include Contrib::AwsApiCore::RequestUtils
17
17
 
18
+ # Fetch all results when tokens are being used
19
+ # for paging results
20
+ #
21
+ # @param next_token [String]
22
+ # @param result_key [Array<String, Symbol>] path to result
23
+ # @yield block to perform request
24
+ # @yieldparam options [Hash] request parameters (token information)
25
+ # @return [Array]
26
+ # @note this is customized to S3 since its API is slightly
27
+ # different than the usual token based fetching
28
+ def all_result_pages(next_token, *result_key, &block)
29
+ list = []
30
+ options = next_token ? Smash.new('marker' => next_token) : Smash.new
31
+ result = block.call(options)
32
+ content = result.get(*result_key.dup)
33
+ if(content.is_a?(Array))
34
+ list += content
35
+ else
36
+ list << content
37
+ end
38
+ set = result.get(*result_key.slice(0, 2))
39
+ if(set.is_a?(Hash) && set['IsTruncated'] && set['Contents'])
40
+ list += all_result_pages(set['Contents'].last['Key'], *result_key, &block)
41
+ end
42
+ list.compact
43
+ end
44
+
18
45
  # Simple init override to force HOST and adjust region for
19
46
  # signatures if required
20
47
  def initialize(args)
@@ -222,7 +249,7 @@ module Miasma
222
249
  count = 1
223
250
  parts = []
224
251
  file.body.rewind
225
- while(content = file.body.read(Storage::READ_BODY_CHUNK_SIZE))
252
+ while(content = file.body.read(Storage::READ_BODY_CHUNK_SIZE * 1.5))
226
253
  parts << [
227
254
  count,
228
255
  request(
@@ -231,7 +258,7 @@ module Miasma
231
258
  :endpoint => bucket_endpoint(file.bucket),
232
259
  :headers => Smash.new(
233
260
  'Content-Length' => content.size,
234
- 'Content-MD5' => Base64.urlsafe_encode64(Digest::MD5.digest(content))
261
+ 'Content-MD5' => Digest::MD5.base64digest(content)
235
262
  ),
236
263
  :params => Smash.new(
237
264
  'partNumber' => count,
@@ -266,7 +293,7 @@ module Miasma
266
293
  :body => complete
267
294
  )
268
295
  file.etag = result.get(:body, 'CompleteMultipartUploadResult', 'ETag')
269
- rescue
296
+ rescue => e
270
297
  request(
271
298
  :method => :delete,
272
299
  :path => file_path(file),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miasma-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: miasma