From 391aa8408e4c3f7cd0706a96b8cdc403ede6776d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 1 Apr 2013 20:33:12 +0100 Subject: Add optional post_install method to Formula. Sometimes we may want to run commands after bottle installation (such as creating directories outside the Cellar) so this method allows us to do so. Closes #18382. --- Library/Homebrew/formula.rb | 3 +++ Library/Homebrew/formula_installer.rb | 2 ++ 2 files changed, 5 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1d9c1034c..2dc7d500c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -188,6 +188,9 @@ class Formula # are supported. def pour_bottle?; true end + # Can be overridden to run commands on both source and bottle installation. + def post_install; end + # tell the user about any caveats regarding this package, return a string def caveats; nil end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index ace3b59fa..0b94c5b62 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -111,6 +111,8 @@ class FormulaInstaller clean end + f.post_install + opoo "Nothing was installed to #{f.prefix}" unless f.installed? end -- cgit v1.2.3