From e91aeafc82edb2b79af67e342009cd019cd1ede5 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 4 Jun 2009 19:21:19 +0100 Subject: [PATCH] Created /Library moved brew tool to /bin Moved Forumla and Cellar/homebrew into Library. This way the homebrew core files are more sensibly placed, Cellar is more internally consistent and only generated. And Homebrew is ready for use straight out of the tarball. --- .gitignore | 6 +- {Formula => Library/Formula}/ack.rb | 0 {Formula => Library/Formula}/asciidoc.rb | 0 {Formula => Library/Formula}/boost.rb | 0 {Formula => Library/Formula}/cmake.rb | 0 {Formula => Library/Formula}/dmd.rb | 0 {Formula => Library/Formula}/fftw.rb | 0 {Formula => Library/Formula}/git.rb | 6 +- {Formula => Library/Formula}/grc.rb | 2 +- {Formula => Library/Formula}/lame.rb | 0 {Formula => Library/Formula}/liblastfm.rb | 4 +- {Formula => Library/Formula}/libogg.rb | 0 {Formula => Library/Formula}/libsamplerate.rb | 0 {Formula => Library/Formula}/mad.rb | 0 {Formula => Library/Formula}/pkg-config.rb | 0 {Formula => Library/Formula}/pngcrush.rb | 0 {Formula => Library/Formula}/qt.rb | 0 {Formula => Library/Formula}/taglib.rb | 0 {Formula => Library/Formula}/term.rb | 0 {Formula => Library/Formula}/wget.rb | 0 {Formula => Library/Formula}/xmlrpc-c.rb | 0 {Formula => Library/Formula}/yajl.rb | 0 .../homebrew => Library/Homebrew}/brewkit.rb | 68 +++++++++++-------- Library/Homebrew/env.rb | 22 ++++++ .../homebrew => Library/Homebrew}/unittest.rb | 7 +- {Cellar/homebrew => bin}/brew | 30 ++++---- 26 files changed, 81 insertions(+), 64 deletions(-) rename {Formula => Library/Formula}/ack.rb (100%) rename {Formula => Library/Formula}/asciidoc.rb (100%) rename {Formula => Library/Formula}/boost.rb (100%) rename {Formula => Library/Formula}/cmake.rb (100%) rename {Formula => Library/Formula}/dmd.rb (100%) rename {Formula => Library/Formula}/fftw.rb (100%) rename {Formula => Library/Formula}/git.rb (99%) rename {Formula => Library/Formula}/grc.rb (97%) rename {Formula => Library/Formula}/lame.rb (100%) rename {Formula => Library/Formula}/liblastfm.rb (77%) rename {Formula => Library/Formula}/libogg.rb (100%) rename {Formula => Library/Formula}/libsamplerate.rb (100%) rename {Formula => Library/Formula}/mad.rb (100%) rename {Formula => Library/Formula}/pkg-config.rb (100%) rename {Formula => Library/Formula}/pngcrush.rb (100%) rename {Formula => Library/Formula}/qt.rb (100%) rename {Formula => Library/Formula}/taglib.rb (100%) rename {Formula => Library/Formula}/term.rb (100%) rename {Formula => Library/Formula}/wget.rb (100%) rename {Formula => Library/Formula}/xmlrpc-c.rb (100%) rename {Formula => Library/Formula}/yajl.rb (100%) rename {Cellar/homebrew => Library/Homebrew}/brewkit.rb (84%) create mode 100644 Library/Homebrew/env.rb rename {Cellar/homebrew => Library/Homebrew}/unittest.rb (92%) rename {Cellar/homebrew => bin}/brew (90%) diff --git a/.gitignore b/.gitignore index 4787e8518ae5..72820f508b17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ .DS_Store /*/ -!/Cellar/ -!/Formula/ -/Cellar/*/ -!/Cellar/homebrew/ \ No newline at end of file +!/Library/ +!/bin/brew \ No newline at end of file diff --git a/Formula/ack.rb b/Library/Formula/ack.rb similarity index 100% rename from Formula/ack.rb rename to Library/Formula/ack.rb diff --git a/Formula/asciidoc.rb b/Library/Formula/asciidoc.rb similarity index 100% rename from Formula/asciidoc.rb rename to Library/Formula/asciidoc.rb diff --git a/Formula/boost.rb b/Library/Formula/boost.rb similarity index 100% rename from Formula/boost.rb rename to Library/Formula/boost.rb diff --git a/Formula/cmake.rb b/Library/Formula/cmake.rb similarity index 100% rename from Formula/cmake.rb rename to Library/Formula/cmake.rb diff --git a/Formula/dmd.rb b/Library/Formula/dmd.rb similarity index 100% rename from Formula/dmd.rb rename to Library/Formula/dmd.rb diff --git a/Formula/fftw.rb b/Library/Formula/fftw.rb similarity index 100% rename from Formula/fftw.rb rename to Library/Formula/fftw.rb diff --git a/Formula/git.rb b/Library/Formula/git.rb similarity index 99% rename from Formula/git.rb rename to Library/Formula/git.rb index 0f0620f407eb..56cf84e95a6b 100644 --- a/Formula/git.rb +++ b/Library/Formula/git.rb @@ -11,10 +11,10 @@ class Git > ~/.profile + brew grc --profile >> ~/.profile EOS end diff --git a/Formula/lame.rb b/Library/Formula/lame.rb similarity index 100% rename from Formula/lame.rb rename to Library/Formula/lame.rb diff --git a/Formula/liblastfm.rb b/Library/Formula/liblastfm.rb similarity index 77% rename from Formula/liblastfm.rb rename to Library/Formula/liblastfm.rb index 5d1999172b8f..6f2b6a3751a4 100644 --- a/Formula/liblastfm.rb +++ b/Library/Formula/liblastfm.rb @@ -2,8 +2,8 @@ class Liblastfm -# Licensed as per the GPL version 3 +# Copyright 2009 Max Howell +# +# This file is part of Homebrew. +# +# Homebrew is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Homebrew is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Homebrew. If not, see . + require 'pathname' require 'osx/cocoa' # to get number of cores +require "#{File.dirname __FILE__}/env" HOMEBREW_VERSION='0.1' @@ -181,36 +197,28 @@ def brew FileUtils.rm_rf tmp if tmp FileUtils.rm tgz if tgz and not self.cache? end - - ohai 'Finishing up' - - begin - prefix - rescue RuntimeError - # you can have packages that aren't for installing, see git - # this is a HACK though, and dirty, and not right - return - end - - prefix.find do |path| - if path==prefix #rubysucks - next - elsif path.file? - if path.extname == '.la' - path.unlink - else - fo=`file -h #{path}` - args=nil - args='-SxX' if fo =~ /Mach-O dynamically linked shared library/ - args='' if fo =~ /Mach-O executable/ #defaults strip everything - if args - puts "Stripping: #{path}" if ARGV.include? '--verbose' - `strip #{args} #{path}` - end + end + end + + def clean + prefix.find do |path| + if path==prefix #rubysucks + next + elsif path.file? + if path.extname == '.la' + path.unlink + else + fo=`file -h #{path}` + args=nil + args='-SxX' if fo =~ /Mach-O dynamically linked shared library/ + args='' if fo =~ /Mach-O executable/ #defaults strip everything + if args + puts "Stripping: #{path}" if ARGV.include? '--verbose' + `strip #{args} #{path}` end - elsif path.directory? and path!=prefix+'bin' and path!=prefix+'lib' - Find.prune end + elsif path.directory? and path!=prefix+'bin' and path!=prefix+'lib' + Find.prune end end end diff --git a/Library/Homebrew/env.rb b/Library/Homebrew/env.rb new file mode 100644 index 000000000000..e1beac1c178b --- /dev/null +++ b/Library/Homebrew/env.rb @@ -0,0 +1,22 @@ +# Copyright 2009 Max Howell +# +# This file is part of Homebrew. +# +# Homebrew is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Homebrew is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Homebrew. If not, see . + +require 'pathname' + +$root=Pathname.new(__FILE__).dirname.parent.parent.realpath +$formula=$root+'Library'+'Formula' +$cellar=$root+'Cellar' \ No newline at end of file diff --git a/Cellar/homebrew/unittest.rb b/Library/Homebrew/unittest.rb similarity index 92% rename from Cellar/homebrew/unittest.rb rename to Library/Homebrew/unittest.rb index 1982faefc126..5ec8f0e5de81 100755 --- a/Cellar/homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -1,11 +1,6 @@ #!/usr/bin/ruby -$:.unshift File.dirname(__FILE__) -require 'pathname' -$root=Pathname.new(__FILE__).realpath.dirname.parent.parent -$cellar=$root+'Cellar' -require 'brewkit' require 'test/unit' - +require "#{__FILE__}/../brewkit" class TestFormula -# Licensed as per the GPL version 3 + require 'find' require 'pathname' -$:.unshift "#{File.dirname __FILE__}/../Cellar/homebrew" -$root=Pathname.new(__FILE__).realpath.dirname.parent.parent -$formula=$root+'Formula' -$cellar=$root+'Cellar' +$:.unshift Pathname.new(__FILE__).dirname.parent.realpath+'Library'+'Homebrew' +require 'env' def prune n=0 @@ -14,7 +11,7 @@ def prune $root.find do |path| if path.directory? name=path.relative_path_from($root).to_s - if name == '.git' or name == 'Cellar' or name == 'Formula' + if name == '.git' or name == 'Cellar' or name == 'Library/Homebrew' or name == 'Library/Formula' Find.prune else dirs<