From ea593cf61cf376ffb44f7c825c8734c79cff6850 Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Tue, 11 Sep 2012 22:13:41 -0700 Subject: [PATCH] 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. --- Library/Homebrew/patches.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/patches.rb b/Library/Homebrew/patches.rb index 9abea188f6..4dbc3c1cd3 100644 --- a/Library/Homebrew/patches.rb +++ b/Library/Homebrew/patches.rb @@ -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