Unified · Split
| @@ -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 | ||
| 3 | OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax') | ||
| 4 | OpenURI::Buffer.const_set 'StringMax', 0 | ||
| 5 | |||
| 6 | class DocsCLI < Thor | 1 | class DocsCLI < Thor |
| 7 | include Thor::Actions | 2 | include Thor::Actions |
| 8 | 3 | ||
| @@ -139,6 +134,11 @@ class DocsCLI < Thor · 130 unmodified lines | |||
| 139 | end | 134 | 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.length | 143 | length = docs.length |
| 144 | i = 0 | 144 | i = 0 |