bfs-s3 0.6.4 → 0.7.3
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 +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 439b5c3e0e7cc280d527e238e6dc0d67404e720b8899b79f8cfd201950e059ea
|
4
|
+
data.tar.gz: 433ea64a8b6feec47b683be92ad07e5f5e044189f1b04609176b7bdd724a0e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d180808ac5fc59950da69521a97fe989ac28dd614c88d2f299cf413af9e9ed221dedb692e5d1e4ae8793b2b0e976d16b15f3af6a5d2c0124dc99dbf6b86320c
|
7
|
+
data.tar.gz: 1aed0a7496aae52534cb2fe082d161682bfbc343fb2e82944f94075338829080163a0d37e84d0ed978f6283c0848c3fec282b886bca32b400fcc5590234fed8e
|
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.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: 2020-
|
11
|
+
date: 2020-07-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.
|
33
|
+
version: 0.7.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.
|
40
|
+
version: 0.7.3
|
41
41
|
description: https://github.com/bsm/bfs.rb
|
42
42
|
email: dimitrij@blacksquaremedia.com
|
43
43
|
executables: []
|
@@ -60,14 +60,14 @@ 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
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.1.
|
70
|
+
rubygems_version: 3.1.4
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: S3 bucket adapter for bfs
|