Require open-uri in DocsCLI#download_docs

pull/129/head
Thibaut 11 years ago
parent 5cb35cb918
commit 89f2f2f3ce

@ -1,8 +1,3 @@
# Prevents this error: https://gist.github.com/nitay/0cbf5ccb2bc611f627e5
# See also: http://stackoverflow.com/questions/694115/why-does-ruby-open-uris-open-return-a-stringio-in-my-unit-test-but-a-fileio-in
OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
OpenURI::Buffer.const_set 'StringMax', 0
class DocsCLI < Thor
include Thor::Actions
@ -139,6 +134,11 @@ class DocsCLI < Thor
end
def download_docs(docs)
# Don't allow downloaded files to be created as StringIO
require 'open-uri'
OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
OpenURI::Buffer.const_set 'StringMax', 0
require 'thread'
length = docs.length
i = 0

Loading…
Cancel
Save