bfs-gs 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 460902d2cc058b953f1180b5c6baa79979e13ce6601bf7e072a6c422d17ac348
4
- data.tar.gz: 27aba18d5a723270b62575f9beb922a1614c835a03c909454f0dfbed47d4b1bd
3
+ metadata.gz: 7d02eb412617f33a9e5485ddc8f80c1a1daee35a13b8bf8de3522b42af8e67fd
4
+ data.tar.gz: 369a667e176cc6105c445ea127dc5c37d01042ab7d7f81b472591b2000070c4b
5
5
  SHA512:
6
- metadata.gz: c6b0f5d5881f56eabb64303264f3faf9b9b76f602ee90ca6f92e39987cdfbae2071c668690b024833afcd2ba10a6c79e15406c26f4ae4899865d6fb2290e6131
7
- data.tar.gz: 30825d6a15e154fda4db8fa9eae5bd2ab7652e239660f3e56ca21d2745439c2a7c781e60a85880e9a5ab9e0ce9f7fa937c7e812c2a12cd21cfd661490b58b730
6
+ metadata.gz: 7f0a7e56499b185b886945229e6bb85714ac64583b878e7f820402d0546b81a1ae885d19f6545ee6ee3655ed0a9639703b2b6826940a2f1b6786d6ccf7ab3f09
7
+ data.tar.gz: 94b29d3eb53ec0365bec5beaed37246a5b63514954262b49b9df1d9d4bc6e61fd1c1898546cea21204070b50c870db1ef4d2e445cb5f81f78f9744c88d7abd4d
@@ -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.5
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-02-17 00:00:00.000000000 Z
11
+ date: 2020-10-26 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.5
19
+ version: 0.7.4
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.5
26
+ version: 0.7.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-storage
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -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.5.0
63
+ version: 2.6.0
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="