bfs-s3 0.7.3 → 0.8.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
  SHA256:
3
- metadata.gz: 439b5c3e0e7cc280d527e238e6dc0d67404e720b8899b79f8cfd201950e059ea
4
- data.tar.gz: 433ea64a8b6feec47b683be92ad07e5f5e044189f1b04609176b7bdd724a0e0f
3
+ metadata.gz: 91e105f0932ff1ef23c5b5214e05a714ac6ce564d3a93e55225f524d495fd4e2
4
+ data.tar.gz: f2152ef353747b86e661f69c1d1100e6f14f2d38b0498e9cea9d1f1877ec8612
5
5
  SHA512:
6
- metadata.gz: 1d180808ac5fc59950da69521a97fe989ac28dd614c88d2f299cf413af9e9ed221dedb692e5d1e4ae8793b2b0e976d16b15f3af6a5d2c0124dc99dbf6b86320c
7
- data.tar.gz: 1aed0a7496aae52534cb2fe082d161682bfbc343fb2e82944f94075338829080163a0d37e84d0ed978f6283c0848c3fec282b886bca32b400fcc5590234fed8e
6
+ metadata.gz: 45573ff60184d0c190061a0e241c10b80233db9f0ec184317500eaea59a735f1d48ef6cbce5ea53608250305e98132e2c964b95b074e9446d32a041a8dbed095
7
+ data.tar.gz: f3bf20f0dcc3a5db9c770d59ef9d30e9fd305b863e6d9e698b18ac79155d30c0c9f01bf939e46bdfec3a16de611ef0816fe059655d4a31161ca4b40aa9a8efbf
data/lib/bfs/bucket/s3.rb CHANGED
@@ -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,38 +1,39 @@
1
1
  require 'spec_helper'
2
2
 
3
- sandbox = { bucket: 'bsm-bfs-unittest' }.freeze
3
+ bucket_name = 'bsm-bfs-unittest'
4
4
 
5
5
  RSpec.describe BFS::Bucket::S3, s3: true do
6
- let(:prefix) { "x/#{SecureRandom.uuid}/" }
7
-
8
6
  subject do
9
- described_class.new sandbox[:bucket], prefix: prefix
7
+ described_class.new bucket_name, prefix: prefix
10
8
  end
11
- after :all do
12
- bucket = described_class.new sandbox[:bucket], prefix: 'x/'
9
+
10
+ let(:prefix) { "x/#{SecureRandom.uuid}/" }
11
+
12
+ after :all do # rubocop:disable RSpec/BeforeAfterAll
13
+ bucket = described_class.new bucket_name, prefix: 'x/'
13
14
  bucket.ls.each {|name| bucket.rm(name) }
14
15
  end
15
16
 
16
17
  it_behaves_like 'a bucket'
17
18
 
18
- it 'should resolve from URL' do
19
- bucket = BFS.resolve("s3://#{sandbox[:bucket]}/?acl=private&encoding=binary")
19
+ it 'resolves from URL' do
20
+ bucket = BFS.resolve("s3://#{bucket_name}/?acl=private&encoding=binary")
20
21
  expect(bucket).to be_instance_of(described_class)
21
- expect(bucket.name).to eq(sandbox[:bucket])
22
+ expect(bucket.name).to eq(bucket_name)
22
23
  expect(bucket.acl).to eq(:private)
23
24
  expect(bucket.encoding).to eq('binary')
24
25
  expect(bucket.instance_variable_get(:@prefix)).to be_nil
25
26
  bucket.close
26
27
 
27
- bucket = BFS.resolve("s3://#{sandbox[:bucket]}/a/b/")
28
+ bucket = BFS.resolve("s3://#{bucket_name}/a/b/")
28
29
  expect(bucket).to be_instance_of(described_class)
29
- expect(bucket.name).to eq(sandbox[:bucket])
30
+ expect(bucket.name).to eq(bucket_name)
30
31
  expect(bucket.instance_variable_get(:@prefix)).to eq('a/b')
31
32
  bucket.close
32
33
  end
33
34
 
34
- it 'should enumerate over a large number of files' do
35
- bucket = described_class.new sandbox[:bucket], prefix: 'm/'
35
+ it 'enumerates over a large number of files' do
36
+ bucket = described_class.new bucket_name, prefix: 'm/'
36
37
  expect(bucket.ls('**/*').count).to eq(2121)
37
38
  bucket.close
38
39
  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.3
4
+ version: 0.8.1
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-10 00:00:00.000000000 Z
11
+ date: 2021-02-04 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.3
33
+ version: 0.8.1
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.3
40
+ version: 0.8.1
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []