bfs-gs 0.6.1 → 0.6.2
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/gs.rb +10 -16
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce3945c75293459554de992abd3feb7f5e67dc37f4c85277aed1a00e25fc6f12
|
4
|
+
data.tar.gz: f8f4de972d679ec3bd44bfff8c4cfaef30b7fb3f864b28eaa366df3d1ff28007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06bc1b3093aad6a6be0dcdbfd7c17ed10d3121c5785b1aaa8ce12460ef40df05d26cdd3ba47d149d9e91ca9445cc38456b70abe17af87db023490959cd98959f
|
7
|
+
data.tar.gz: 4c6e3a77f3c0c63fa1e7eafb58c5ddb585984fbdc76b5960ab96e2ceff2a147df3f48bd9f8dbcfe66a45718a6411b0d21c1bd7dea1f005f81e338b7d4b7acf82
|
data/lib/bfs/bucket/gs.rb
CHANGED
@@ -21,17 +21,11 @@ module BFS
|
|
21
21
|
# @option opts [String] :acl set the default ACL.
|
22
22
|
# @option opts [Google::Cloud::Storage] :client custom client.
|
23
23
|
# @option opts [String] :encoding Custom encoding.
|
24
|
-
def initialize(name, **opts)
|
25
|
-
opts = opts.dup
|
26
|
-
opts.keys.each do |key|
|
27
|
-
val = opts.delete(key)
|
28
|
-
opts[key.to_sym] = val unless val.nil?
|
29
|
-
end
|
24
|
+
def initialize(name, prefix: nil, acl: nil, client: nil, **opts)
|
30
25
|
super(**opts)
|
31
26
|
|
32
|
-
@prefix =
|
33
|
-
|
34
|
-
client = opts.delete(:client) || Google::Cloud::Storage.new(**opts)
|
27
|
+
@prefix = prefix
|
28
|
+
client ||= Google::Cloud::Storage.new(**opts)
|
35
29
|
|
36
30
|
@name = name.to_s
|
37
31
|
@bucket = client.bucket(@name)
|
@@ -59,15 +53,15 @@ module BFS
|
|
59
53
|
raise BFS::FileNotFound, trim_prefix(path) unless file
|
60
54
|
|
61
55
|
name = trim_prefix(file.name)
|
62
|
-
BFS::FileInfo.new(name, file.size, file.updated_at.to_time, file.content_type, norm_meta(file.metadata))
|
56
|
+
BFS::FileInfo.new(path: name, size: file.size, mtime: file.updated_at.to_time, content_type: file.content_type, metadata: norm_meta(file.metadata))
|
63
57
|
end
|
64
58
|
|
65
59
|
# Creates a new file and opens it for writing
|
66
|
-
def create(path, **opts, &block)
|
60
|
+
def create(path, encoding: nil, perm: nil, **opts, &block)
|
67
61
|
opts[:metadata] = norm_meta(opts[:metadata])
|
68
62
|
path = full_path(path)
|
69
|
-
enc =
|
70
|
-
temp = BFS::TempWriter.new(path, encoding: enc) do |t|
|
63
|
+
enc = encoding || @encoding
|
64
|
+
temp = BFS::TempWriter.new(path, encoding: enc, perm: perm) do |t|
|
71
65
|
File.open(t, encoding: enc) do |file|
|
72
66
|
@bucket.create_file(file, path, **opts)
|
73
67
|
end
|
@@ -82,13 +76,13 @@ module BFS
|
|
82
76
|
end
|
83
77
|
|
84
78
|
# Opens an existing file for reading
|
85
|
-
def open(path, **opts, &block)
|
79
|
+
def open(path, encoding: nil, tempdir: nil, **opts, &block)
|
86
80
|
path = full_path(path)
|
87
|
-
enc =
|
81
|
+
enc = encoding || @encoding
|
88
82
|
file = @bucket.file(path)
|
89
83
|
raise BFS::FileNotFound, trim_prefix(path) unless file
|
90
84
|
|
91
|
-
temp = Tempfile.new(File.basename(path), encoding: enc)
|
85
|
+
temp = Tempfile.new(File.basename(path), tempdir, encoding: enc)
|
92
86
|
temp.close
|
93
87
|
file.download temp.path, opts
|
94
88
|
|
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
|
+
version: 0.6.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-02-
|
11
|
+
date: 2020-02-12 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.
|
19
|
+
version: 0.6.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.6.
|
26
|
+
version: 0.6.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.
|
70
|
+
rubygems_version: 3.0.6
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: GS bucket adapter for bfs
|