bfs 0.4.4 → 0.5.0

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: 3115a351e861d29c6a6f6ccbc249bdc6c9ecb8aa8d3920124db6e556fd1f0c6f
4
- data.tar.gz: b98132bf36cc3ce7d34958253f23b7dab386b4b9a2c5bb7480d017d56b41e0c5
3
+ metadata.gz: 8096df0d8d5fb715fa6e54871888fd86c0507fb9f2f38adb3f8304a1bfd3d31c
4
+ data.tar.gz: 6e06d0121ad1513e033d620a85fba7ac86e19cf87af2a2a117141eff94e66873
5
5
  SHA512:
6
- metadata.gz: 4992de998a6b74e54d41d44d8061418cabfeb2c86f581c07bd4a5557a1684aa821e17655668184a21e57e9f352ad0e302c66a3b4d443e84331e37d89c4c6ddbc
7
- data.tar.gz: de0e32d0a38f045864f86ea837d188fd3dbb72cad1695386c4abb0d38ee3bececefd828d8b7efcee332d7a50d7ae5eaa36b7f7b33e1332560ba6f207c58a12bf
6
+ metadata.gz: 7e10375cabf28b74a8a56d7cb3fcf0c41025ee87c14a4e075d41718a02056648133a88ffc4d0e2a4a58621143646f94e4fa976c3f3fd4ddc814c77c15c63747a
7
+ data.tar.gz: 9771acf045d241a66c1cd2729b2314220d676dca808ebebb13fc832874a42da8a492a5693a914ae2ae5cc7b0f4989ca101aa8bee82ab111bce05b70d9f32bea3
@@ -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
@@ -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
@@ -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', 'key' => 'val'))
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.4
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-27 00:00:00.000000000 Z
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