bfs 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bfs/bucket/abstract.rb +9 -0
- data/lib/bfs/bucket/in_mem.rb +1 -1
- data/spec/bfs/blob_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8096df0d8d5fb715fa6e54871888fd86c0507fb9f2f38adb3f8304a1bfd3d31c
|
4
|
+
data.tar.gz: 6e06d0121ad1513e033d620a85fba7ac86e19cf87af2a2a117141eff94e66873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e10375cabf28b74a8a56d7cb3fcf0c41025ee87c14a4e075d41718a02056648133a88ffc4d0e2a4a58621143646f94e4fa976c3f3fd4ddc814c77c15c63747a
|
7
|
+
data.tar.gz: 9771acf045d241a66c1cd2729b2314220d676dca808ebebb13fc832874a42da8a492a5693a914ae2ae5cc7b0f4989ca101aa8bee82ab111bce05b70d9f32bea3
|
data/lib/bfs/bucket/abstract.rb
CHANGED
@@ -79,6 +79,15 @@ module BFS
|
|
79
79
|
|
80
80
|
protected
|
81
81
|
|
82
|
+
def norm_meta(meta)
|
83
|
+
norm = {}
|
84
|
+
meta.each do |key, value|
|
85
|
+
nkey = key.to_s.downcase.split(/-/).map(&:capitalize).join('-')
|
86
|
+
norm[nkey] = value
|
87
|
+
end if meta.is_a?(Hash)
|
88
|
+
norm
|
89
|
+
end
|
90
|
+
|
82
91
|
def norm_path(path)
|
83
92
|
BFS.norm_path(path) if path
|
84
93
|
end
|
data/lib/bfs/bucket/in_mem.rb
CHANGED
@@ -46,7 +46,7 @@ module BFS
|
|
46
46
|
io = StringIO.new
|
47
47
|
io.set_encoding(opts[:encoding] || @encoding)
|
48
48
|
|
49
|
-
@files[norm_path(path)] = Entry.new(io, Time.now, opts[:content_type], opts[:metadata]
|
49
|
+
@files[norm_path(path)] = Entry.new(io, Time.now, opts[:content_type], norm_meta(opts[:metadata]))
|
50
50
|
return io unless block
|
51
51
|
|
52
52
|
begin
|
data/spec/bfs/blob_spec.rb
CHANGED
@@ -18,10 +18,10 @@ RSpec.describe BFS::Blob do
|
|
18
18
|
|
19
19
|
it 'should write/read' do
|
20
20
|
expect { subject.read }.to raise_error(BFS::FileNotFound)
|
21
|
-
subject.write('TESTDATA', content_type: 'text/plain', metadata: { 'key' => 'val' })
|
21
|
+
subject.write('TESTDATA', content_type: 'text/plain', metadata: { 'x-key' => 'val' })
|
22
22
|
|
23
23
|
info = subject.info
|
24
|
-
expect(info).to eq(BFS::FileInfo.new('path/to/file.txt', 8, info.mtime, 'text/plain', '
|
24
|
+
expect(info).to eq(BFS::FileInfo.new('path/to/file.txt', 8, info.mtime, 'text/plain', 'X-Key' => 'val'))
|
25
25
|
expect(info.mtime).to be_within(1).of(Time.now)
|
26
26
|
|
27
27
|
expect(subject.read).to eq('TESTDATA')
|
@@ -50,7 +50,7 @@ RSpec.describe BFS::Blob do
|
|
50
50
|
it 'should write/read' do
|
51
51
|
expect { subject.read }.to raise_error(BFS::FileNotFound)
|
52
52
|
|
53
|
-
subject.write('TESTDATA', content_type: 'text/plain', metadata: { 'key' => 'val' })
|
53
|
+
subject.write('TESTDATA', content_type: 'text/plain', metadata: { 'x-key' => 'val' })
|
54
54
|
expect(subject.read).to eq('TESTDATA')
|
55
55
|
|
56
56
|
info = subject.info
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Minimalist abstraction for bucket storage
|
14
14
|
email: dimitrij@blacksquaremedia.com
|