tc4r 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -20,6 +20,10 @@ Or install it yourself as:
20
20
 
21
21
  TODO: Write usage instructions here
22
22
 
23
+ ### Change Log
24
+ 0.0.2 Monkey Patch Nestful to support binary buffering.
25
+ - Related to: https://github.com/maccman/nestful/pull/22
26
+
23
27
  ## Contributing
24
28
 
25
29
  1. Fork it
@@ -0,0 +1,27 @@
1
+ module Nestful
2
+ class Request
3
+ attr_reader :buffer_binmode
4
+
5
+ def decoded(result)
6
+ if buffer
7
+ data = Tempfile.new("nfr.#{rand(1000)}")
8
+ data.binmode if buffer_binmode
9
+ size = 0
10
+ total = result.content_length
11
+
12
+ result.read_body do |chunk|
13
+ callback(:progress, self, total, size += chunk.size)
14
+ data.write(chunk)
15
+ end
16
+
17
+ data.rewind
18
+ data
19
+ else
20
+ return result if raw
21
+ data = result.body
22
+ format ? format.decode(data) : data
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -8,4 +8,5 @@ require 'tc4r/build'
8
8
 
9
9
  require 'nestful'
10
10
 
11
- require 'tc4r/client'
11
+ require 'tc4r/client'
12
+ require 'monkey_patch/nestful_decode'
@@ -77,6 +77,7 @@ module Tc4r
77
77
  options = default_options.merge(options)
78
78
 
79
79
  download_parameters = {:buffer => true}
80
+ download_parameters[:buffer_binmode] = true
80
81
  if options[:with_progress]
81
82
  download_parameters[:progress] = progress_bar
82
83
  end
@@ -1,3 +1,3 @@
1
1
  module Tc4r
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tc4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir:
11
11
  - bin
12
12
  cert_chain: []
13
- date: 2012-08-27 00:00:00.000000000 Z
13
+ date: 2012-10-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: commander
@@ -156,6 +156,7 @@ files:
156
156
  - Rakefile
157
157
  - bin/tc
158
158
  - bin/tc-setup
159
+ - lib/monkey_patch/nestful_decode.rb
159
160
  - lib/tc4r.rb
160
161
  - lib/tc4r/build.rb
161
162
  - lib/tc4r/build_type.rb