bfs-s3 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bfs/bucket/s3.rb +6 -4
- data/spec/bfs/bucket/s3_spec.rb +9 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63aa7d24ff89dfba3557e9d02c08881f01d27c541beab1ac4006986e4ebadf24
|
4
|
+
data.tar.gz: 2ffa79c55d126ec13bf260bb1ecd7f9f5b76cff53e6e76fe9d3bac2cf46c34a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d39f2de32870e27de52944a1263d1626a48c9b11b236609d6e993e1728905550cab8078f2cf2e51a36b8f0062f8301acb0121fef00eeecc0311f779a5d38acb1
|
7
|
+
data.tar.gz: e66ecc98c6e0b770f61b1d71cfe15e3bf36977508eab22db733cb27c9fd96f37411815a4f6fd72efe71a818bcb487bb2299afc48cc552268bed47ae35f9dce1c
|
data/lib/bfs/bucket/s3.rb
CHANGED
@@ -143,11 +143,13 @@ module BFS
|
|
143
143
|
private
|
144
144
|
|
145
145
|
def init_client(opts)
|
146
|
-
|
147
|
-
|
148
|
-
credentials
|
146
|
+
config = {}
|
147
|
+
config[:region] = opts[:region] if opts[:region]
|
148
|
+
config[:credentials] = opts[:credentials] if opts[:credentials]
|
149
|
+
config[:credentials] ||= Aws::Credentials.new(opts[:access_key_id].to_s, opts[:secret_access_key].to_s) if opts[:access_key_id]
|
150
|
+
config[:credentials] ||= Aws::SharedCredentials.new(profile_name: opts[:profile_name]) if opts[:profile_name]
|
149
151
|
|
150
|
-
Aws::S3::Client.new
|
152
|
+
Aws::S3::Client.new(config)
|
151
153
|
end
|
152
154
|
end
|
153
155
|
end
|
data/spec/bfs/bucket/s3_spec.rb
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
sandbox = {
|
3
|
+
sandbox = { bucket: 'bsm-bfs-unittest' }.freeze
|
4
4
|
run_spec = \
|
5
5
|
begin
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
true
|
11
|
-
else
|
12
|
-
false
|
13
|
-
end
|
14
|
-
rescue Aws::Errors::ServiceError
|
6
|
+
s = Aws::S3::Client.new
|
7
|
+
s.head_bucket(bucket: sandbox[:bucket])
|
8
|
+
true
|
9
|
+
rescue StandardError
|
15
10
|
false
|
16
11
|
end
|
17
12
|
|
@@ -19,24 +14,24 @@ RSpec.describe BFS::Bucket::S3, if: run_spec do
|
|
19
14
|
let(:prefix) { "x/#{SecureRandom.uuid}/" }
|
20
15
|
|
21
16
|
subject do
|
22
|
-
described_class.new sandbox[:bucket],
|
17
|
+
described_class.new sandbox[:bucket], prefix: prefix
|
23
18
|
end
|
24
19
|
after :all do
|
25
|
-
bucket = described_class.new sandbox[:bucket],
|
20
|
+
bucket = described_class.new sandbox[:bucket], prefix: 'x/'
|
26
21
|
bucket.ls.each {|name| bucket.rm(name) }
|
27
22
|
end
|
28
23
|
|
29
24
|
it_behaves_like 'a bucket'
|
30
25
|
|
31
26
|
it 'should resolve from URL' do
|
32
|
-
bucket = BFS.resolve("s3://#{sandbox[:bucket]}?acl=private
|
27
|
+
bucket = BFS.resolve("s3://#{sandbox[:bucket]}?acl=private")
|
33
28
|
expect(bucket).to be_instance_of(described_class)
|
34
29
|
expect(bucket.name).to eq(sandbox[:bucket])
|
35
30
|
expect(bucket.acl).to eq(:private)
|
36
31
|
end
|
37
32
|
|
38
33
|
it 'should enumerate over a large number of files' do
|
39
|
-
bucket = described_class.new sandbox[:bucket],
|
34
|
+
bucket = described_class.new sandbox[:bucket], prefix: 'm/'
|
40
35
|
expect(bucket.ls('**/*').count).to eq(2121)
|
41
36
|
end
|
42
37
|
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.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-30 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.3.
|
33
|
+
version: 0.3.5
|
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.3.
|
40
|
+
version: 0.3.5
|
41
41
|
description: https://github.com/bsm/bfs.rb
|
42
42
|
email: dimitrij@blacksquaremedia.com
|
43
43
|
executables: []
|