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.
This commit is contained in:
parent
3d6552f8e3
commit
ea593cf61c
@ -1,3 +1,5 @@
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user