bfs-s3 0.3.2 → 0.3.3

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
  SHA256:
3
- metadata.gz: 1adf9c2f6f6a8897454fafcaf5d347a323d5252476cc26a012aa945aea4b5328
4
- data.tar.gz: 2a659245fa4feda255a9928577469c24f05c5b56fd01e885dd322647c929299e
3
+ metadata.gz: 64e82eeda72f79a41868973bca6120a9533742f28e3387fc3ea43a62ff7e2ac5
4
+ data.tar.gz: bbba7f07472b885148ec0ad66c3278412ecdb16ebdff4b1f06b2ca8604f43f6a
5
5
  SHA512:
6
- metadata.gz: bf7acda8109779860069f9fe76ebfea00602cab33f8a3b8df81578b5ad5ced2b671508c6b48feef1cbdcc99a4280dd7b692f3d804f7dd3d55acfde020597c64b
7
- data.tar.gz: f2ee02fcee3f640f2e151d28bc55bc4fa539a26fa85ae3060d1e09412d443ce5d52a5cfe87590845246dda71ca9fbb3d32119be250b731f8319f0a41d8eaaff6
6
+ metadata.gz: 594b23762958eb90c9d200d081939be4eba894593d56191772cc55dad3c6f596766481b7834a696fd65220e52a31bfe99b8169d1a5ec1e268b8bd7b188654b27
7
+ data.tar.gz: bed98d39b1423065bf49077947ac85dcedf36ae31e61d7cb6d921194d20597c4bb9850a90f20bb36331bf4a8d0866e1f9f93114a23c8bd691162d1ebe8e185c5
data/lib/bfs/bucket/s3.rb CHANGED
@@ -55,13 +55,12 @@ module BFS
55
55
  path = norm_path(path)
56
56
  opts = opts.merge(
57
57
  bucket: name,
58
- max_keys: 1,
59
- prefix: opts[:prefix] ? File.join(opts[:prefix], path) : path,
58
+ key: opts[:prefix] ? File.join(opts[:prefix], path) : path,
60
59
  )
61
- object = @client.list_objects_v2(opts).contents.first
62
- raise BFS::FileNotFound, path unless object
60
+ info = @client.head_object(opts)
61
+ raise BFS::FileNotFound, path unless info
63
62
 
64
- BFS::FileInfo.new(path, object.size, object.last_modified)
63
+ BFS::FileInfo.new(path, info.content_length, info.last_modified, info.content_type, info.metadata)
65
64
  rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket
66
65
  raise BFS::FileNotFound, path
67
66
  end
@@ -27,16 +27,14 @@ RSpec.describe BFS::Bucket::S3 do
27
27
 
28
28
  allow(client).to receive(:list_objects_v2).with(bucket: 'mock-bucket', continuation_token: nil) do |*|
29
29
  contents = files.keys.map {|key| Aws::S3::Types::Object.new(key: key) }
30
- double 'ListObjectsV2Response', contents: contents, next_continuation_token: ''
30
+ Aws::S3::Types::ListObjectsV2Output.new contents: contents, next_continuation_token: ''
31
31
  end
32
- allow(client).to receive(:list_objects_v2).with(bucket: 'mock-bucket', max_keys: 1, prefix: 'a/b/c.txt') do |*|
33
- obj = Aws::S3::Types::Object.new(key: 'a/b/c.txt', size: 10, last_modified: Time.now)
34
- double 'ListObjectsV2Response', contents: [obj]
32
+ allow(client).to receive(:head_object).with(bucket: 'mock-bucket', key: 'a/b/c.txt') do |*|
33
+ Aws::S3::Types::HeadObjectOutput.new content_length: 10, last_modified: Time.now, content_type: 'text/plain', metadata: { 'key' => 'val' }
35
34
  end
36
- allow(client).to receive(:list_objects_v2).with(bucket: 'mock-bucket', max_keys: 1, prefix: 'missing.txt') do |*|
37
- double 'ListObjectsV2Response', contents: []
35
+ allow(client).to receive(:head_object).with(bucket: 'mock-bucket', key: 'missing.txt') do |*|
36
+ raise Aws::S3::Errors::NoSuchKey.new(nil, nil)
38
37
  end
39
-
40
38
  allow(client).to receive(:copy_object).with(hash_including(bucket: 'mock-bucket')) do |opts|
41
39
  src = opts[:copy_source].sub('/mock-bucket/', '')
42
40
  raise Aws::S3::Errors::NoSuchKey.new(nil, nil) unless files.key?(src)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-12 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.2
33
+ version: 0.3.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.2
40
+ version: 0.3.3
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []