History

Require open-uri in DocsCLI#download_docs

Thibaut committed 12 years ago

Commit 89f2f2f1 parent 5cb35cb1 file · +5 −5Browse files

Unified · Split

lib/tasks/docs.thor+5−5
@@ -1,8 +1,3 @@
1# Prevents this error: https://gist.github.com/nitay/0cbf5ccb2bc611f627e5
2# See also: http://stackoverflow.com/questions/694115/why-does-ruby-open-uris-open-return-a-stringio-in-my-unit-test-but-a-fileio-in
3OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
4OpenURI::Buffer.const_set 'StringMax', 0
5
6class DocsCLI < Thor1class DocsCLI < Thor
7 include Thor::Actions2 include Thor::Actions
8 3
@@ -139,6 +134,11 @@ class DocsCLI < Thor · 130 unmodified lines
139 end134 end
140 135
141 def download_docs(docs)136 def download_docs(docs)
137 # Don't allow downloaded files to be created as StringIO
138 require 'open-uri'
139 OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
140 OpenURI::Buffer.const_set 'StringMax', 0
141
142 require 'thread'142 require 'thread'
143 length = docs.length143 length = docs.length
144 i = 0144 i = 0