From c28bd7b57193c808f896c0f2a0eac20e8fd075bb Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 4 Sep 2009 15:28:18 +0100 Subject: Allow formulae to use __END__ For this to work the "running script" must be the formulae file. Making this so wasn't so hard, there is now an install.rb script which is included with the -r flag to the ruby executable. An at_exit handler calls the install function. Having the install logic in its own file made it feel like there was so much space that I added extra error handling. So there is something to be said for separating functionality out into its own files. Still the error handling sucks, we'll need to marshall the exception back to the bin/brew command. Which is another PITA. Still overall I think this will prove worthwhile. But if it doesn't we'll revert. As a first usage, you can put a diff after __END__ and return DATA from Formula::patches to make Homebrew aware of it. --- Library/Homebrew/utils.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/utils.rb') diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index ff58aabfd..8606b21fe 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -75,8 +75,8 @@ def safe_system cmd, *args end end -def curl url, *args - safe_system 'curl', '-f#LA', HOMEBREW_USER_AGENT, url, *args +def curl *args + safe_system 'curl', '-f#LA', HOMEBREW_USER_AGENT, *args unless args.empty? end def puts_columns items, cols = 4 -- cgit v1.2.3