bfs-s3 0.7.1 → 0.7.6

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: e49f967d04b05a36711b1c2b858347af451e6c6aa9690739c524b21249137aee
4
- data.tar.gz: dfe6415867f0e4af1a8b2106123972aa12f3531729b65bf0806081076cd1b903
3
+ metadata.gz: c7b0a87bb99ee39fefb3d297a891b96c740793529a187a8f19a3a9f37219b1e5
4
+ data.tar.gz: 4d38e77a1b7f0a1f3a9591dfd4f00a038aec0c43f9dda60203049d9036df8004
5
5
  SHA512:
6
- metadata.gz: f29025c22ba7bb6bb72c0a7c517da339de233964ced69e6aae02dba86f2a69a54d80a6eb7d3915808b303159c6a864fe498703583932de1368314458ef414b4e
7
- data.tar.gz: 4fd3e4ebac13f4f7f21698f8e193e977319c906902d1510e6879fdae74eecc51c41cfe3f7b1d24994511d1a8beaa2484fadde2d145a5e332c80508d3749412f2
6
+ metadata.gz: d79da1d49939071bd04072e3120d4e4d4dd7c35c78cae2eba0010e6e7a0900052cc92970ba6e56c17bb1b6595b0a5553d3d5fb274140429fd47ca9b57ba5eb17
7
+ data.tar.gz: 38831316b1684be8981982309b4d85e03b2c57e6ec29ed6e245cb8ddaa042166b5a4ca0479af621e5fa56eb0cf2740d2274029d8a4311a658428074e62f699c5
@@ -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::TempWriter.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.1
4
+ version: 0.7.6
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-11-10 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.1
33
+ version: 0.7.6
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.1
40
+ version: 0.7.6
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.1.4
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: S3 bucket adapter for bfs