brew diy command
Automagically determines prefix to install to for DIY installations. README amended.
This commit is contained in:
parent
355bfc1751
commit
140bfc5592
@ -15,7 +15,7 @@ _brew_to_completion()
|
|||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
# We only complete unabbreviated commands...
|
# 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
|
# Subcommand list
|
||||||
if [[ ( ${COMP_CWORD} -eq 1 ) && ( ${COMP_WORDS[0]} == brew ) ]] ; then
|
if [[ ( ${COMP_CWORD} -eq 1 ) && ( ${COMP_WORDS[0]} == brew ) ]] ; then
|
||||||
|
|||||||
@ -186,6 +186,24 @@ def prune
|
|||||||
end
|
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
|
||||||
class Cleaner
|
class Cleaner
|
||||||
def initialize f
|
def initialize f
|
||||||
|
|||||||
9
README
9
README
@ -46,6 +46,11 @@ Here's why you may prefer Homebrew to the alternatives:
|
|||||||
make install
|
make install
|
||||||
brew ln wget
|
brew ln wget
|
||||||
|
|
||||||
|
Or Homebrew can figure out the prefix:
|
||||||
|
|
||||||
|
./configure `brew diy`
|
||||||
|
cmake . `brew diy`
|
||||||
|
|
||||||
This means you can also install multiple versions of the same package and
|
This means you can also install multiple versions of the same package and
|
||||||
switch on demand.
|
switch on demand.
|
||||||
|
|
||||||
@ -150,7 +155,7 @@ Update package list:
|
|||||||
cd /usr/local && git pull origin masterbrew [1]
|
cd /usr/local && git pull origin masterbrew [1]
|
||||||
|
|
||||||
Delete a package:
|
Delete a package:
|
||||||
brew rm wget OR rm -rf /usr/local/Cellar/wget && brew prune
|
brew rm wget OR rm -rf /usr/local/Cellar/wget && brew prune
|
||||||
|
|
||||||
List all files in a package:
|
List all files in a package:
|
||||||
brew list wget OR find /usr/local/Cellar/wget
|
brew list wget OR find /usr/local/Cellar/wget
|
||||||
@ -168,7 +173,7 @@ Show expensive packages:
|
|||||||
du -md1 /usr/local/Cellar
|
du -md1 /usr/local/Cellar
|
||||||
|
|
||||||
View the packages brew has downloaded and cached:
|
View the packages brew has downloaded and cached:
|
||||||
ls `brew --cache` OR ls ~/Library/Caches/Homebrew
|
ls `brew --cache` OR ls ~/Library/Caches/Homebrew
|
||||||
|
|
||||||
With Homebrew this is all Ruby. If you want to improve the package
|
With Homebrew this is all Ruby. If you want to improve the package
|
||||||
installation, amend the Ruby script. If you want to improve the brew command
|
installation, amend the Ruby script. If you want to improve the brew command
|
||||||
|
|||||||
4
bin/brew
4
bin/brew
@ -66,6 +66,7 @@ begin
|
|||||||
else
|
else
|
||||||
Process.wait pid
|
Process.wait pid
|
||||||
end
|
end
|
||||||
|
#FIXME I don't think $? represents the exit code from the child fork…
|
||||||
exit! $? if $? != 0 # exception in other brew will be visible on screen
|
exit! $? if $? != 0 # exception in other brew will be visible on screen
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -114,6 +115,9 @@ begin
|
|||||||
exec "mate", *ARGV.named.collect {|name| make name}
|
exec "mate", *ARGV.named.collect {|name| make name}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
when 'diy'
|
||||||
|
puts diy
|
||||||
|
|
||||||
when 'info', 'abv'
|
when 'info', 'abv'
|
||||||
if ARGV.named_empty?
|
if ARGV.named_empty?
|
||||||
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
|
puts `ls #{HOMEBREW_CELLAR} | wc -l`.strip+" kegs, "+HOMEBREW_CELLAR.abv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user