Skip to content
Snippets Groups Projects
Commit ea593cf6 authored by Charlie Sharpsteen's avatar Charlie Sharpsteen
Browse files

patches.rb: Generalize File recognition

Extend patch case statements for files to objects inheriting from `IO`, which
includes `File`, or `StringIO` which is used by the external command
`brew-unpack` to store `DATA` sections loaded from Formula files.
parent 3d6552f8
No related branches found
No related tags found
No related merge requests found
require 'stringio'
class Patches
include Enumerable
......@@ -72,7 +74,8 @@ class Patch
@compression = nil
@url = nil
if url.kind_of? File # true when DATA is passed
if url.kind_of? IO or url.kind_of? StringIO
# File-like objects. Most common when DATA is passed.
write_data url
elsif looks_like_url(url)
@url = url # Save URL to mark this as an external patch
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment