aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/patches.rb
diff options
context:
space:
mode:
authorCharlie Sharpsteen2012-09-11 22:13:41 -0700
committerCharlie Sharpsteen2012-09-11 22:37:07 -0700
commitb01c5e00733ad1768ad1e09b5d47e2a87813a044 (patch)
treecf1af4071389a82767b4105ce04b7dfcc575c8b8 /Library/Homebrew/patches.rb
parentb910c6263a40932a8efbcc13717bc9eb88a557d2 (diff)
downloadhomebrew-b01c5e00733ad1768ad1e09b5d47e2a87813a044.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/patches.rb')
-rw-r--r--Library/Homebrew/patches.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/patches.rb b/Library/Homebrew/patches.rb
index 9abea188f..4dbc3c1cd 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