omnistore 0.0.11 → 0.0.12

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.
@@ -26,6 +26,18 @@ module OmniStore
26
26
  FileUtils.rm(expand(path))
27
27
  end
28
28
 
29
+ def delete_if(dir = nil, &block)
30
+ Dir.glob("#{dir}/**/*").each do |path|
31
+ if yield(path)
32
+ if File.directory?(path)
33
+ FileUtils.rm(path)
34
+ else
35
+ FileUtils.rmdir(path)
36
+ end
37
+ end
38
+ end
39
+ end
40
+
29
41
  def read(path, options = {}, &block)
30
42
  size = options[:chunk_size] || MEGABYTE
31
43
  open(expand(path), 'rb') do |f|
@@ -29,6 +29,10 @@ module OmniStore
29
29
  bucket.objects[key].delete(options)
30
30
  end
31
31
 
32
+ def delete_if(key_prefix = nil, &block)
33
+ bucket.objects.with_prefix(key_prefix).delete_if(&block)
34
+ end
35
+
32
36
  def read(key, options = {}, &block)
33
37
  bucket.objects[key].read(options, &block)
34
38
  end
@@ -1,3 +1,3 @@
1
1
  module OmniStore
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -9,6 +9,7 @@ describe OmniStore::Storage do
9
9
  end
10
10
 
11
11
  it 'should return storage for s3' do
12
+ AWS::S3::Bucket.any_instance.stub(:exists?).and_return(true)
12
13
  OmniStore::Config.storage = 's3'
13
14
  OmniStore::Storage.remount!
14
15
  OmniStore::Storage.storage.should == OmniStore::Storage::S3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnistore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2012-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -552854129
126
+ hash: 644102575
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: -552854129
135
+ hash: 644102575
136
136
  requirements: []
137
137
  rubyforge_project:
138
138
  rubygems_version: 1.8.24