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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 006a47eb5bb98ed25ce659ef731f72ea815f629382906125dff18d90866b06c9
4
- data.tar.gz: '09e8fb5e9c3a7496f2d6004300f20e03e62af725a9e238abd4d67fa0d66b8ed2'
3
+ metadata.gz: 63aa7d24ff89dfba3557e9d02c08881f01d27c541beab1ac4006986e4ebadf24
4
+ data.tar.gz: 2ffa79c55d126ec13bf260bb1ecd7f9f5b76cff53e6e76fe9d3bac2cf46c34a0
5
5
  SHA512:
6
- metadata.gz: 0aa16aadd6093b213199286f61a4ac965b54386e96e441b74c567d277fb5c5fc552977fb44f580ce254ce565dc79c12db23941dbd3e490e52e24288911218e17
7
- data.tar.gz: a68af4df46647ccb88bdf6d2869b068aa26b83f75fb267a093d443146a30fc092bc73879f45b958d4e7112ceb9d769608e18fa452802e43b5674b12ebb9060d2
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
- credentials = opts[:credentials]
147
- credentials ||= Aws::Credentials.new(opts[:access_key_id].to_s, opts[:secret_access_key].to_s) if opts[:access_key_id]
148
- credentials ||= Aws::SharedCredentials.new(profile_name: opts[:profile_name])
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 region: opts[:region], credentials: credentials
152
+ Aws::S3::Client.new(config)
151
153
  end
152
154
  end
153
155
  end
@@ -1,17 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- sandbox = { region: 'us-east-1', bucket: 'bsm-bfs-unittest' }.freeze
3
+ sandbox = { bucket: 'bsm-bfs-unittest' }.freeze
4
4
  run_spec = \
5
5
  begin
6
- c = Aws::SharedCredentials.new
7
- if c.loadable?
8
- s = Aws::S3::Client.new(region: sandbox[:region], credentials: c)
9
- s.head_bucket(bucket: sandbox[:bucket])
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], region: sandbox[:region], prefix: prefix
17
+ described_class.new sandbox[:bucket], prefix: prefix
23
18
  end
24
19
  after :all do
25
- bucket = described_class.new sandbox[:bucket], region: sandbox[:region], prefix: 'x/'
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&region=#{sandbox[:region]}")
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], region: sandbox[:region], prefix: 'm/'
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
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-28 00:00:00.000000000 Z
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.4
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.4
40
+ version: 0.3.5
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []