bfs-s3 0.7.2 → 0.8.0

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: fd3e7cea0ae1a67ddf1e509257bde454c5e77466fec4681fe9664781a3600f89
4
- data.tar.gz: adea9bba2f773c8f89ea5aa1a3b71f276e546ba59e5c02c74dd366a6b9be6e3f
3
+ metadata.gz: 9e4e2d75bba619dbe3e7a68ff669b91cb5e031acbac453683f6197d11a7cc98d
4
+ data.tar.gz: 1b92cdd4b1cf3bfbd2b173498de47d7b27528f590010fe5ab5256f6bd391d373
5
5
  SHA512:
6
- metadata.gz: 69c643b31793f298f8817ae785db46ee99b5c34504ec907f655aba56c33e0d1789dd8eac5313539c05582962daee36cd914a483a08df9fd26a4f1544ef8d367a
7
- data.tar.gz: 9df82f0c2244b21e5924e4aab95cf7e67cc0db3c2d43ffb9b6b88b7b33cd2e2b82bfd7aef903010efb26026d2988826aab7ffa21241483cd3d490c071b191d60
6
+ metadata.gz: d5848551c6fe1b2cc699c3d0cdb47010e2806296cc3cb7734c8a40ede206b566d49855110e70fca2917b65cd92f943497e6acec00b6c17713f3f7a04efb7142d
7
+ data.tar.gz: 4e410ead67a7cf7886b14224d216311f759f1be92dc42d85e4ccf11772c935e22fbd723db3f26274f729ac445b15cb56f847c76fa3444799e5d80b7e9cfed398
@@ -82,18 +82,11 @@ module BFS
82
82
  opts[:server_side_encryption] ||= @sse if @sse
83
83
  opts[:storage_class] ||= @storage_class if @storage_class
84
84
 
85
- temp = BFS::TempWriter.new(path, encoding: encoding, perm: perm) do |t|
85
+ BFS::Writer.new(path, encoding: encoding, perm: perm) do |t|
86
86
  File.open(t, encoding: encoding) do |file|
87
87
  @client.put_object(opts.merge(body: file))
88
88
  end
89
- end
90
- return temp unless block
91
-
92
- begin
93
- yield temp
94
- ensure
95
- temp.close
96
- end
89
+ end.perform(&block)
97
90
  end
98
91
 
99
92
  # Opens an existing file for reading
@@ -1,45 +1,40 @@
1
1
  require 'spec_helper'
2
2
 
3
- sandbox = { bucket: 'bsm-bfs-unittest' }.freeze
4
- run_spec = \
5
- begin
6
- s = Aws::S3::Client.new
7
- s.head_bucket(bucket: sandbox[:bucket])
8
- true
9
- rescue StandardError => e
10
- warn "WARNING: unable to run #{File.basename __FILE__}: #{e.message}"
11
- false
12
- end
3
+ bucket_name = 'bsm-bfs-unittest'
13
4
 
14
- RSpec.describe BFS::Bucket::S3, if: run_spec do
5
+ RSpec.describe BFS::Bucket::S3, s3: true do
15
6
  let(:prefix) { "x/#{SecureRandom.uuid}/" }
16
7
 
17
8
  subject do
18
- described_class.new sandbox[:bucket], prefix: prefix
9
+ described_class.new bucket_name, prefix: prefix
19
10
  end
11
+
20
12
  after :all do
21
- bucket = described_class.new sandbox[:bucket], prefix: 'x/'
13
+ bucket = described_class.new bucket_name, prefix: 'x/'
22
14
  bucket.ls.each {|name| bucket.rm(name) }
23
15
  end
24
16
 
25
17
  it_behaves_like 'a bucket'
26
18
 
27
19
  it 'should resolve from URL' do
28
- bucket = BFS.resolve("s3://#{sandbox[:bucket]}/?acl=private&encoding=binary")
20
+ bucket = BFS.resolve("s3://#{bucket_name}/?acl=private&encoding=binary")
29
21
  expect(bucket).to be_instance_of(described_class)
30
- expect(bucket.name).to eq(sandbox[:bucket])
22
+ expect(bucket.name).to eq(bucket_name)
31
23
  expect(bucket.acl).to eq(:private)
32
24
  expect(bucket.encoding).to eq('binary')
33
25
  expect(bucket.instance_variable_get(:@prefix)).to be_nil
26
+ bucket.close
34
27
 
35
- bucket = BFS.resolve("s3://#{sandbox[:bucket]}/a/b/")
28
+ bucket = BFS.resolve("s3://#{bucket_name}/a/b/")
36
29
  expect(bucket).to be_instance_of(described_class)
37
- expect(bucket.name).to eq(sandbox[:bucket])
30
+ expect(bucket.name).to eq(bucket_name)
38
31
  expect(bucket.instance_variable_get(:@prefix)).to eq('a/b')
32
+ bucket.close
39
33
  end
40
34
 
41
35
  it 'should enumerate over a large number of files' do
42
- bucket = described_class.new sandbox[:bucket], prefix: 'm/'
36
+ bucket = described_class.new bucket_name, prefix: 'm/'
43
37
  expect(bucket.ls('**/*').count).to eq(2121)
38
+ bucket.close
44
39
  end
45
40
  end
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.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-02 00:00:00.000000000 Z
11
+ date: 2020-12-01 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.7.2
33
+ version: 0.8.0
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.7.2
40
+ version: 0.8.0
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []