bfs 0.4.2 → 0.4.3
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/blob.rb +13 -8
- data/spec/bfs/blob_spec.rb +1 -0
- 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: a07dd366e21cd6cef46aa02a1097e245cb74d099b5534277ed47b5bfeecca700
|
4
|
+
data.tar.gz: d02a0438cb7f2a1937725d5835edb8aa30c27be641495dfcdfe4cd72eb2f08a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03ec7123160acf6499856b7036b0b7f5f53c7c80c7a432b30e59e37f83f81603b91c75d642feeb6dc15935024a1e804d0d2929d70d76e5a397d55bc4f52d2593
|
7
|
+
data.tar.gz: e1dcefdf1d13cfad65627f51d70c24e59cf3027e00719cd0fae2f771174b8b42768d2839b21a463f1e0cd3a3f68c35c2a2401829c30bb67f0eaefb414df52b7b
|
data/lib/bfs/blob.rb
CHANGED
@@ -11,42 +11,47 @@ module BFS
|
|
11
11
|
@bucket = BFS.resolve(url)
|
12
12
|
end
|
13
13
|
|
14
|
-
# Info returns the blob info
|
14
|
+
# Info returns the blob info.
|
15
15
|
def info(opts={})
|
16
16
|
@bucket.info(path, opts)
|
17
17
|
end
|
18
18
|
|
19
|
-
# Creates the blob and opens it for writing
|
19
|
+
# Creates the blob and opens it for writing.
|
20
20
|
def create(opts={}, &block)
|
21
21
|
@bucket.create(path, opts, &block)
|
22
22
|
end
|
23
23
|
|
24
|
-
# Opens the blob for reading
|
25
|
-
# May raise BFS::FileNotFound
|
24
|
+
# Opens the blob for reading.
|
25
|
+
# May raise BFS::FileNotFound.
|
26
26
|
def open(opts={}, &block)
|
27
27
|
@bucket.open(path, opts, &block)
|
28
28
|
end
|
29
29
|
|
30
|
-
# Deletes the blob
|
30
|
+
# Deletes the blob.
|
31
31
|
def rm(opts={})
|
32
32
|
@bucket.rm(path, opts)
|
33
33
|
end
|
34
34
|
|
35
|
-
# Shortcut method to read the contents of the blob
|
35
|
+
# Shortcut method to read the contents of the blob.
|
36
36
|
def read(opts={})
|
37
37
|
open(opts, &:read)
|
38
38
|
end
|
39
39
|
|
40
|
-
# Shortcut method to write data to blob
|
40
|
+
# Shortcut method to write data to blob.
|
41
41
|
def write(data, opts={})
|
42
42
|
create(opts) {|f| f.write data }
|
43
43
|
end
|
44
44
|
|
45
|
-
# Moves blob to dst
|
45
|
+
# Moves blob to dst.
|
46
46
|
def mv(dst, opts={})
|
47
47
|
dst = BFS.norm_path(dst)
|
48
48
|
@bucket.mv(path, dst, opts)
|
49
49
|
@path = dst
|
50
50
|
end
|
51
|
+
|
52
|
+
# Closes the underlying bucket connection.
|
53
|
+
def close
|
54
|
+
@bucket.close
|
55
|
+
end
|
51
56
|
end
|
52
57
|
end
|
data/spec/bfs/blob_spec.rb
CHANGED
@@ -5,6 +5,7 @@ RSpec.describe BFS::Blob do
|
|
5
5
|
let(:bucket) { BFS::Bucket::InMem.new }
|
6
6
|
before { allow(BFS).to receive(:resolve).and_return(bucket) }
|
7
7
|
subject { described_class.new('memtest://bucket/path/to/file.txt') }
|
8
|
+
after { subject.close }
|
8
9
|
|
9
10
|
it 'should move' do
|
10
11
|
expect(subject.path).to eq('path/to/file.txt')
|
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
|
+
version: 0.4.3
|
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-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Minimalist abstraction for bucket storage
|
14
14
|
email: dimitrij@blacksquaremedia.com
|