bfs-gs 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae53e3d99f879a7365cb5dd3ca06b5407cdd4542cef07a839a2b1362f83c8deb
4
- data.tar.gz: 637c8a48a18b2df89381ca6ff16fbd2d4d0f993e025517d83de3032083b167ae
3
+ metadata.gz: ba5632283f82b8a38d0f25ccc839948c8d45fcdd81da8ed4bc3ab9154f62becb
4
+ data.tar.gz: eaed2684e48c0cb4cad20c51b1635ae4c4c2d173d4fdbe994e7a4f59ff760f8b
5
5
  SHA512:
6
- metadata.gz: 59dbc0f2e5cd99bc71af65e922eaa439e41392763c80e13ce71a50fb40aaa27ffda796dc46615e76340cf799d584ec1bb61438e3d8b47db75f556e51d7c3639e
7
- data.tar.gz: '08c336ee7b0a81be35f230b23b603a08f2523ae4cd5d1c04aee50b0af0576dbaf86bb053ad796cd9687a350e15d9642e38654a055361f370561f938286e7e430'
6
+ metadata.gz: f06d8e618fc56f661c965875d5597fd1a0c692c30f23e3e67d81c0889b9e37d309a211f88c51146f674a09b858be5f060a813ea95bcfb8379ca532191caa25dd
7
+ data.tar.gz: aa7dced6719a04c98817e4466b514598614b2319f4fdf597dcf650bc1760c2548a3258651dc2e74f3ee2ef54d7d7ce652745e1ce308d219da4032c336abd0597
@@ -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.5.0'
18
+ s.required_ruby_version = '>= 2.6.0'
19
19
 
20
20
  s.add_dependency 'bfs', s.version
21
21
  s.add_dependency 'google-cloud-storage', '~> 1.18'
@@ -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
  opts = opts.merge(prefix: prefix) if prefix
39
39
 
@@ -105,12 +105,15 @@ module BFS
105
105
  end
106
106
  end
107
107
 
108
- BFS.register('gs') do |url, opts|
108
+ BFS.register('gs') do |url, opts, block|
109
109
  prefix = BFS.norm_path(opts.key?(:prefix) ? opts[:prefix] : url.path)
110
110
  prefix = nil if prefix.empty?
111
-
112
- BFS::Bucket::GS.new url.host, **opts.slice(:project_id, :credentials, :acl),
113
- prefix: prefix,
114
- timeout: opts.key?(:timeout) ? opts[:timeout].to_i : nil,
115
- retries: opts.key?(:retries) ? opts[:retries].to_i : nil
111
+ opts = opts.slice(:project_id, :credentials, :acl)
112
+ extra = {
113
+ prefix: prefix,
114
+ timeout: opts.key?(:timeout) ? opts[:timeout].to_i : nil,
115
+ retries: opts.key?(:retries) ? opts[:retries].to_i : nil,
116
+ }
117
+
118
+ BFS::Bucket::GS.open url.host, **opts, **extra, &block
116
119
  end
@@ -6,17 +6,9 @@ module Google::Auth::CredentialsLoader
6
6
  module_function :warn_if_cloud_sdk_credentials # rubocop:disable Style/AccessModifierDeclarations
7
7
  end
8
8
 
9
- sandbox = { project: 'bogus', bucket: 'bsm-bfs-unittest' }.freeze
10
- run_spec = \
11
- begin
12
- s = Google::Cloud::Storage.new(project_id: sandbox[:project])
13
- !s.bucket(sandbox[:bucket]).nil?
14
- rescue Signet::AuthorizationError => e
15
- warn "WARNING: unable to run #{File.basename __FILE__}: #{e.message}"
16
- false
17
- end
9
+ sandbox = { project: 'bogus', bucket: 'bsm-bfs-unittest' }.freeze
18
10
 
19
- RSpec.describe BFS::Bucket::GS, if: run_spec do
11
+ RSpec.describe BFS::Bucket::GS, gs: true do
20
12
  let(:prefix) { "x/#{SecureRandom.uuid}/" }
21
13
 
22
14
  subject do
@@ -34,15 +26,18 @@ RSpec.describe BFS::Bucket::GS, if: run_spec do
34
26
  expect(bucket).to be_instance_of(described_class)
35
27
  expect(bucket.name).to eq(sandbox[:bucket])
36
28
  expect(bucket.instance_variable_get(:@prefix)).to be_nil
29
+ bucket.close
37
30
 
38
31
  bucket = BFS.resolve("gs://#{sandbox[:bucket]}/a/b/")
39
32
  expect(bucket).to be_instance_of(described_class)
40
33
  expect(bucket.name).to eq(sandbox[:bucket])
41
34
  expect(bucket.instance_variable_get(:@prefix)).to eq('a/b')
35
+ bucket.close
42
36
  end
43
37
 
44
38
  it 'should enumerate over a large number of files' do
45
39
  bucket = described_class.new sandbox[:bucket], project_id: sandbox[:project], prefix: 'm/'
46
40
  expect(bucket.ls('**/*').count).to eq(2121)
41
+ bucket.close
47
42
  end
48
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-gs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
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-02-17 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bfs
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.4
19
+ version: 0.7.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.4
26
+ version: 0.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-storage
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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.5.0
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.2
70
+ rubygems_version: 3.1.4
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: GS bucket adapter for bfs