fog 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fog}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wesley Beary"]
@@ -24,8 +24,8 @@ module Fog
24
24
  object
25
25
  end
26
26
 
27
- def get(key, options = {})
28
- data = connection.get_object(bucket.name, key, options)
27
+ def get(key, options = {}, &block)
28
+ data = connection.get_object(bucket.name, key, options, &block)
29
29
  object_data = {
30
30
  :body => data.body,
31
31
  :key => key
@@ -88,7 +88,7 @@ unless Fog.mocking?
88
88
 
89
89
  unless params[:method] == 'HEAD'
90
90
  if response.headers['Content-Length']
91
- unless params[:block]
91
+ if error || !params[:block]
92
92
  body << @connection.read(response.headers['Content-Length'].to_i)
93
93
  else
94
94
  remaining = response.headers['Content-Length'].to_i
@@ -102,7 +102,7 @@ unless Fog.mocking?
102
102
  # 2 == "/r/n".length
103
103
  chunk_size = @connection.readline.chomp!.to_i(16) + 2
104
104
  chunk = @connection.read(chunk_size)[0...-2]
105
- unless params[:block]
105
+ if error || !params[:block]
106
106
  body << chunk
107
107
  else
108
108
  params[:block].call(chunk)
@@ -77,6 +77,17 @@ describe 'Fog::AWS::S3::Objects' do
77
77
  object.destroy
78
78
  end
79
79
 
80
+ it "should return chunked data if given a block" do
81
+ file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
82
+ object = @bucket.objects.create(:key => 'fogobjectname', :body => file)
83
+ data = ''
84
+ @bucket.objects.get('fogobjectname') do |chunk|
85
+ data << chunk
86
+ end
87
+ data.should == File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r').read
88
+ object.destroy
89
+ end
90
+
80
91
  end
81
92
 
82
93
  describe "#head" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wesley Beary