From cacf8d8aa4682ccb66738c98e93038a9a73b99be Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Mon, 28 Sep 2009 14:06:53 -0700 Subject: Allow skip_clean as a class method Pass in a list of any files that you don't want cleaned with a path relative to the cellar. e.g. `strip_paths ['bin/znc']` It's backwards compatible with def strip_clean?, at least for now. The znc formula is updated as an example. --- Library/Homebrew/formula.rb | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index ef3674453..57db673ba 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -108,8 +108,10 @@ class Formula else HttpDownloadStrategy end end - # tell the user about any caveats regarding this package + + # tell the user about any caveats regarding this package, return a string def caveats; nil end + # patches are automatically applied after extracting the tarball # return an array of strings, or if you need a patch level other than -p0 # return a Hash eg. @@ -121,12 +123,20 @@ class Formula # The final option is to return DATA, then put a diff after __END__. You # can still return a Hash with DATA as the value for a patch level key. def patches; end - # sometimes the clean process breaks things, return true to skip anything - def skip_clean? path; false end + # rarely, you don't want your library symlinked into the main prefix # see gettext.rb for an example def keg_only?; false end + # sometimes the clean process breaks things + # skip cleaning paths in a formula with a class method like this: + # skip_clean [bin+"foo", lib+"bar"] + # redefining skip_clean? in formulas is now deprecated + def skip_clean? path + to_check = path.relative_path_from(prefix).to_s + self.class.skip_clean_paths.include?(to_check) + end + # yields self with current working directory set to the uncompressed tarball def brew validate_variable :name @@ -350,7 +360,8 @@ private raise 'You cannot override Formula.brew' if method == 'brew' end - class <