bfs 0.2.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b8d15cd430ed129880e1dcae5573b5ec7b9b7998094d950c7650f951c91a336
4
- data.tar.gz: bd074f7b801ed837dc55db15f1dd7a192f050cc9f0ac7d0fe96ff401cc2dc660
3
+ metadata.gz: 8a1a89324c4f87407cc865d220a755cb70ec0beee373f14db8e247b142da8602
4
+ data.tar.gz: 17f3a768f7fb63e495c090cfbf55dfbeb2543c94d24ba3d4869d60748eab3900
5
5
  SHA512:
6
- metadata.gz: 8a10d11748fe17841ceddbb652f380da9d049c3f41efaed685209f41a47bc8b5d9fba86f5174f434644359a67d3905ca960fd20bc5797512bcad566b2241ab9c
7
- data.tar.gz: c9ce56c64e7426c62db78750d0ef9e711d3a828c0bb9d901579b66d9f921c52a48cd7c86a86997f374488e3e78d870136165f5da1884addcee719961be2760b3
6
+ metadata.gz: 5c0fccee0fb228f78357d337b17507a2061467359806d5c0cf19fbd71eee0bed26bf3f4a954ea7b555ad85191ec0ed0dd3e576e985892f41b037c217a39eea7b
7
+ data.tar.gz: 3e8a8050838f0f3b95ad3aec6464399a833354d10fb0a4c599de2b7e3d1b9eb2b3a625fc390d6147b43d6fc7a86013b670c5949389563143fd8fcf3124154c24
@@ -13,8 +13,10 @@ module BFS
13
13
 
14
14
  # Lists the contents of a bucket using a glob pattern
15
15
  def ls(pattern='**/*', _opts={})
16
- Pathname.glob(@root.join(pattern)).select(&:file?).map do |name|
17
- trim_prefix(name.to_s)
16
+ Enumerator.new do |y|
17
+ Pathname.glob(@root.join(pattern)) do |pname|
18
+ y << trim_prefix(pname.to_s) if pname.file?
19
+ end
18
20
  end
19
21
  end
20
22
 
@@ -13,8 +13,10 @@ module BFS
13
13
 
14
14
  # Lists the contents of a bucket using a glob pattern
15
15
  def ls(pattern='**/*', _opts={})
16
- @files.each_key.select do |key|
17
- File.fnmatch?(pattern, key, File::FNM_PATHNAME)
16
+ Enumerator.new do |y|
17
+ @files.each_key do |key|
18
+ y << key if File.fnmatch?(pattern, key, File::FNM_PATHNAME)
19
+ end
18
20
  end
19
21
  end
20
22
 
@@ -4,7 +4,7 @@ module BFS
4
4
  class TempWriter
5
5
  def initialize(name, &closer)
6
6
  @closer = closer
7
- @tempfile = ::Tempfile.new(File.basename(name.to_s))
7
+ @tempfile = ::Tempfile.new(File.basename(name.to_s), binmode: true)
8
8
  end
9
9
 
10
10
  def path
@@ -12,6 +12,6 @@ RSpec.describe BFS::Bucket::FS do
12
12
 
13
13
  bucket = BFS.resolve("file://#{tmpdir}")
14
14
  expect(bucket).to be_instance_of(described_class)
15
- expect(bucket.ls).to eq(['test.txt'])
15
+ expect(bucket.ls.to_a).to eq(['test.txt'])
16
16
  end
17
17
  end
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.2.2
4
+ version: 0.3.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: 2018-10-18 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Minimalist abstraction for bucket storage
14
14
  email: dimitrij@blacksquaremedia.com