diff options
| author | Max Howell | 2009-08-12 13:43:51 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-12 13:43:51 +0100 |
| commit | 140bfc5592bea6837925e965b9d675094c659a5f (patch) | |
| tree | fc60859400bec749671f930f24bb81e03bc34036 /Library | |
| parent | 355bfc1751a53f35689ea42b40a4211a4f42b641 (diff) | |
| download | brew-140bfc5592bea6837925e965b9d675094c659a5f.tar.bz2 | |
brew diy command
Automagically determines prefix to install to for DIY installations.
README amended.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Contributions/brew_bash_completion.sh | 2 | ||||
| -rw-r--r-- | Library/Homebrew/brew.h.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index f33204d36..7f03523fe 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -15,7 +15,7 @@ _brew_to_completion() prev="${COMP_WORDS[COMP_CWORD-1]}" # We only complete unabbreviated commands... - actions="edit homepage info install list link make uninstall" + actions="diy edit homepage info install list link make uninstall" # Subcommand list if [[ ( ${COMP_CWORD} -eq 1 ) && ( ${COMP_WORDS[0]} == brew ) ]] ; then diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb index f3dee102a..9f981f116 100644 --- a/Library/Homebrew/brew.h.rb +++ b/Library/Homebrew/brew.h.rb @@ -186,6 +186,24 @@ def prune end +def diy + path=Pathname.getwd + version=path.version + path.basename.to_s =~ /(.*?)-?#{version}/ + name=$1 + + raise "Couldn't determine version, try --set-version" if version.nil? or version.empty? + raise "Couldn't determine name, try --set-name" if name.nil? or name.empty? + + prefix=HOMEBREW_CELLAR+name+version + + if File.file? 'CMakeLists.txt' + "-DCMAKE_INSTALL_PREFIX=#{prefix}" + elsif File.file? 'Makefile.am' + "--prefix=#{prefix}" + end +end + ################################################################ class Cleaner class Cleaner def initialize f |
