bfs-s3 0.6.5 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bfs-s3.gemspec +1 -1
- data/lib/bfs/bucket/s3.rb +4 -3
- data/spec/bfs/bucket/s3_spec.rb +5 -11
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac3a8ad583c3cd4849b744a550bf281cc2c8b921538fda890981fb6fcf566a7e
|
4
|
+
data.tar.gz: 35a48baca7cc5e8d6903f1e5ef4bb215199e9635e8ae84b9fe928d98a857fd87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844c31903cb25363730e01ba630f3127ed0af3b9cbfccb249ab74d4fe7c468b27c7f94230a7ac6898447eaa01301f66ac0872911517bc135495c6c78e07d93be
|
7
|
+
data.tar.gz: 3ba0d4876291f272426843ce319b9bcea2f3487ce617bb6604e15b310525e6808838e085986d0d35d395b673519d18bab87bd5d3587b050a45b105627648cfd6
|
data/bfs-s3.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
17
17
|
s.require_paths = ['lib']
|
18
|
-
s.required_ruby_version = '>= 2.
|
18
|
+
s.required_ruby_version = '>= 2.6.0'
|
19
19
|
|
20
20
|
s.add_dependency 'aws-sdk-s3', '~> 1.38'
|
21
21
|
s.add_dependency 'bfs', s.version
|
data/lib/bfs/bucket/s3.rb
CHANGED
@@ -33,7 +33,7 @@ module BFS
|
|
33
33
|
|
34
34
|
# Lists the contents of a bucket using a glob pattern
|
35
35
|
def ls(pattern = '**/*', **opts)
|
36
|
-
prefix = pattern[%r{^[
|
36
|
+
prefix = pattern[%r{^[^*?\{\}\[\]]+/}]
|
37
37
|
prefix = File.join(*[@prefix, prefix].compact) if @prefix
|
38
38
|
|
39
39
|
opts = opts.merge(bucket: name, prefix: @prefix)
|
@@ -158,9 +158,10 @@ module BFS
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
BFS.register('s3') do |url, opts|
|
161
|
+
BFS.register('s3') do |url, opts, block|
|
162
162
|
prefix = BFS.norm_path(opts[:prefix] || url.path)
|
163
163
|
opts[:prefix] = prefix.empty? ? nil : prefix
|
164
|
+
opts = opts.slice(:prefix, :region, :sse, :access_key_id, :secret_access_key, :acl, :storage_class, :encoding)
|
164
165
|
|
165
|
-
BFS::Bucket::S3.
|
166
|
+
BFS::Bucket::S3.open url.host, **opts, &block
|
166
167
|
end
|
data/spec/bfs/bucket/s3_spec.rb
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
sandbox
|
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
|
+
sandbox = { bucket: 'bsm-bfs-unittest' }.freeze
|
13
4
|
|
14
|
-
RSpec.describe BFS::Bucket::S3,
|
5
|
+
RSpec.describe BFS::Bucket::S3, s3: true do
|
15
6
|
let(:prefix) { "x/#{SecureRandom.uuid}/" }
|
16
7
|
|
17
8
|
subject do
|
@@ -31,15 +22,18 @@ RSpec.describe BFS::Bucket::S3, if: run_spec do
|
|
31
22
|
expect(bucket.acl).to eq(:private)
|
32
23
|
expect(bucket.encoding).to eq('binary')
|
33
24
|
expect(bucket.instance_variable_get(:@prefix)).to be_nil
|
25
|
+
bucket.close
|
34
26
|
|
35
27
|
bucket = BFS.resolve("s3://#{sandbox[:bucket]}/a/b/")
|
36
28
|
expect(bucket).to be_instance_of(described_class)
|
37
29
|
expect(bucket.name).to eq(sandbox[:bucket])
|
38
30
|
expect(bucket.instance_variable_get(:@prefix)).to eq('a/b')
|
31
|
+
bucket.close
|
39
32
|
end
|
40
33
|
|
41
34
|
it 'should enumerate over a large number of files' do
|
42
35
|
bucket = described_class.new sandbox[:bucket], prefix: 'm/'
|
43
36
|
expect(bucket.ls('**/*').count).to eq(2121)
|
37
|
+
bucket.close
|
44
38
|
end
|
45
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.
|
4
|
+
version: 0.7.4
|
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-
|
11
|
+
date: 2020-10-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.
|
33
|
+
version: 0.7.4
|
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.
|
40
|
+
version: 0.7.4
|
41
41
|
description: https://github.com/bsm/bfs.rb
|
42
42
|
email: dimitrij@blacksquaremedia.com
|
43
43
|
executables: []
|
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 2.
|
63
|
+
version: 2.6.0
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|