bfs-gs 0.7.4 → 0.8.2

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: 7d02eb412617f33a9e5485ddc8f80c1a1daee35a13b8bf8de3522b42af8e67fd
4
- data.tar.gz: 369a667e176cc6105c445ea127dc5c37d01042ab7d7f81b472591b2000070c4b
3
+ metadata.gz: 122c702df719f9cad5d305bfeec70c467ce65bda54eafdac2a73c098dbcdee96
4
+ data.tar.gz: 123e412eea2104d88de883be1dba69ab628a91e8b315b5189ebd5cea6e4faad8
5
5
  SHA512:
6
- metadata.gz: 7f0a7e56499b185b886945229e6bb85714ac64583b878e7f820402d0546b81a1ae885d19f6545ee6ee3655ed0a9639703b2b6826940a2f1b6786d6ccf7ab3f09
7
- data.tar.gz: 94b29d3eb53ec0365bec5beaed37246a5b63514954262b49b9df1d9d4bc6e61fd1c1898546cea21204070b50c870db1ef4d2e445cb5f81f78f9744c88d7abd4d
6
+ metadata.gz: eea22b92b0ad8ccbdceab4ef01cd7462877deee8fcc395faca70c8b338bf4edaaa1d592f31642b189383e78649132e6c9810c16efea707a962a0f51052cdb77b
7
+ data.tar.gz: ed44218f277442eca35210dc574409167857c2ff50f9f6a9b1af3680c9430dd39089750a057370d0a2573c674152cacf440cb3d2f620d69f4b8eeb5644f353c2
data/lib/bfs/bucket/gs.rb CHANGED
@@ -59,18 +59,11 @@ module BFS
59
59
  def create(path, encoding: self.encoding, perm: self.perm, **opts, &block)
60
60
  opts[:metadata] = norm_meta(opts[:metadata])
61
61
  path = full_path(path)
62
- temp = BFS::TempWriter.new(path, encoding: encoding, perm: perm) do |t|
62
+ BFS::Writer.new(path, encoding: encoding, perm: perm) do |t|
63
63
  File.open(t, encoding: encoding) do |file|
64
64
  @bucket.create_file(file, path, **opts)
65
65
  end
66
- end
67
- return temp unless block
68
-
69
- begin
70
- yield temp
71
- ensure
72
- temp.close
73
- end
66
+ end.perform(&block)
74
67
  end
75
68
 
76
69
  # Opens an existing file for reading
@@ -3,40 +3,41 @@ require 'spec_helper'
3
3
  # silence warnings
4
4
  module Google::Auth::CredentialsLoader
5
5
  def warn_if_cloud_sdk_credentials(*); end
6
- module_function :warn_if_cloud_sdk_credentials # rubocop:disable Style/AccessModifierDeclarations
6
+ module_function :warn_if_cloud_sdk_credentials
7
7
  end
8
8
 
9
- sandbox = { project: 'bogus', bucket: 'bsm-bfs-unittest' }.freeze
9
+ bucket_name = 'bsm-bfs-unittest'
10
10
 
11
11
  RSpec.describe BFS::Bucket::GS, gs: true do
12
- let(:prefix) { "x/#{SecureRandom.uuid}/" }
13
-
14
12
  subject do
15
- described_class.new sandbox[:bucket], project_id: sandbox[:project], prefix: prefix
13
+ described_class.new bucket_name, prefix: prefix
16
14
  end
17
- after :all do
18
- bucket = described_class.new sandbox[:bucket], project_id: sandbox[:project], prefix: 'x/'
15
+
16
+ let(:prefix) { "x/#{SecureRandom.uuid}/" }
17
+
18
+ after do
19
+ bucket = described_class.new bucket_name, prefix: prefix
19
20
  bucket.ls.each {|name| bucket.rm(name) }
20
21
  end
21
22
 
22
23
  it_behaves_like 'a bucket'
23
24
 
24
- it 'should resolve from URL' do
25
- bucket = BFS.resolve("gs://#{sandbox[:bucket]}/?project_id=#{sandbox[:project]}")
25
+ it 'resolves from URL' do
26
+ bucket = BFS.resolve("gs://#{bucket_name}")
26
27
  expect(bucket).to be_instance_of(described_class)
27
- expect(bucket.name).to eq(sandbox[:bucket])
28
+ expect(bucket.name).to eq(bucket_name)
28
29
  expect(bucket.instance_variable_get(:@prefix)).to be_nil
29
30
  bucket.close
30
31
 
31
- bucket = BFS.resolve("gs://#{sandbox[:bucket]}/a/b/")
32
+ bucket = BFS.resolve("gs://#{bucket_name}/a/b/")
32
33
  expect(bucket).to be_instance_of(described_class)
33
- expect(bucket.name).to eq(sandbox[:bucket])
34
+ expect(bucket.name).to eq(bucket_name)
34
35
  expect(bucket.instance_variable_get(:@prefix)).to eq('a/b')
35
36
  bucket.close
36
37
  end
37
38
 
38
- it 'should enumerate over a large number of files' do
39
- bucket = described_class.new sandbox[:bucket], project_id: sandbox[:project], prefix: 'm/'
39
+ it 'enumerates over a large number of files' do
40
+ bucket = described_class.new bucket_name, prefix: 'm/'
40
41
  expect(bucket.ls('**/*').count).to eq(2121)
41
42
  bucket.close
42
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.7.4
4
+ version: 0.8.2
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-10-26 00:00:00.000000000 Z
11
+ date: 2021-05-04 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.7.4
19
+ version: 0.8.2
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.7.4
26
+ version: 0.8.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-storage
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
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