bfs 0.6.4 → 0.6.5
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/abstract.rb +8 -2
- data/spec/bfs/bucket/fs_spec.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42c7ec0b9c8599e48be9756f29d10f2f023cac4ed533567ce3e25f3b9ccdcbfc
|
4
|
+
data.tar.gz: 2d63d874378606434e6311491c80b5993a21da95d465ec71c526e80faa2aa989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f54cb6d54163291b5c4ba7df49d3bb358aa9ac524d2b73492265a67635b864be8fd710a0f5a7eca10c7420d8060fe64483e28d5b135a4e1272bb11000ce8cf
|
7
|
+
data.tar.gz: a4d43696270f615cd187952a88949b3e45fd3cfd0ad34a52d5cb2d8e52c1d50dba250d03a8bcb2f4ff85f1b12894ddcf464078555da98b0a13e3c8f962588a0d
|
data/lib/bfs/bucket/abstract.rb
CHANGED
@@ -9,9 +9,15 @@ module BFS
|
|
9
9
|
# @param [Hash] opts options
|
10
10
|
# @option opts [String] :encoding Custom encoding. Default: Encoding.default_external.
|
11
11
|
# @option opts [Integer] :perm optional file permissions. Default: 0600.
|
12
|
-
def initialize(encoding: Encoding.default_external, **_opts)
|
12
|
+
def initialize(encoding: Encoding.default_external, perm: nil, **_opts)
|
13
13
|
@encoding = encoding
|
14
|
-
|
14
|
+
|
15
|
+
case perm
|
16
|
+
when Integer
|
17
|
+
@perm = perm
|
18
|
+
when String
|
19
|
+
@perm = perm.to_i(8)
|
20
|
+
end
|
15
21
|
end
|
16
22
|
|
17
23
|
# Lists the contents of a bucket using a glob pattern
|
data/spec/bfs/bucket/fs_spec.rb
CHANGED
@@ -17,7 +17,14 @@ RSpec.describe BFS::Bucket::FS do
|
|
17
17
|
expect(bucket.ls.to_a).to eq(['test.txt'])
|
18
18
|
end
|
19
19
|
|
20
|
-
it 'should support custom perms' do
|
20
|
+
it 'should support custom perms on #initialize' do
|
21
|
+
blob = BFS::Blob.new("file://#{tmpdir}/test.txt?perm=0666")
|
22
|
+
blob.create {|w| w.write 'foo' }
|
23
|
+
expect(blob.info.mode).to eq(0o666)
|
24
|
+
blob.close
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should support custom perms on #create' do
|
21
28
|
blob = BFS::Blob.new("file://#{tmpdir}/test.txt")
|
22
29
|
blob.create(perm: 0o666) {|w| w.write 'foo' }
|
23
30
|
expect(blob.info.mode).to eq(0o666)
|