Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Created /Library moved brew tool to /bin
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mxcl committed Jun 4, 2009
1 parent 84ad47b commit e91aeaf
Show file tree
Hide file tree
Showing 26 changed files with 81 additions and 64 deletions.
6 changes: 2 additions & 4 deletions .gitignore
@@ -1,6 +1,4 @@
.DS_Store
/*/
!/Cellar/
!/Formula/
/Cellar/*/
!/Cellar/homebrew/
!/Library/
!/bin/brew
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions Formula/git.rb → Library/Formula/git.rb
Expand Up @@ -11,10 +11,10 @@ class Git <Formula
@homepage='http://git-scm.com'

def install
system "./configure --prefix='#{prefix}' --disable-debug"
system "make install"

# the manuals come separately, well sort of, it's easier this way though
GitManuals.new.brew { FileUtils.mv Dir['*'], man }

system "./configure --prefix='#{prefix}' --disable-debug"
system "make install"
end
end
2 changes: 1 addition & 1 deletion Formula/grc.rb → Library/Formula/grc.rb
Expand Up @@ -63,7 +63,7 @@ def caveats
grc won't work as is. One option is to add some aliases to your ~/.profile
file. Homebrew can do that for you, just execute this command:
ruby #{$0} --profile >> ~/.profile
brew grc --profile >> ~/.profile
EOS
end
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Formula/liblastfm.rb → Library/Formula/liblastfm.rb
Expand Up @@ -2,8 +2,8 @@

class Liblastfm <Formula
@homepage='http://github.com/mxcl/liblastfm/'
@url='http://github.com/mxcl/liblastfm/tarball/0.3.0'
@md5='08e90275ccd06476426a5002d1dad762'
@url='http://static.last.fm/src/liblastfm-0.3.0.tar.bz2'
@md5='3f73222ebc31635941832b01e7a494b6'

def deps
dep_test_bin 'qmake' or 'qt'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
68 changes: 38 additions & 30 deletions Cellar/homebrew/brewkit.rb → Library/Homebrew/brewkit.rb
@@ -1,7 +1,23 @@
# Copyright 2009 Max Howell <max@methylblue.com>
# Licensed as per the GPL version 3
# Copyright 2009 Max Howell <max@methylblue.com>
#
# 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 <http://www.gnu.org/licenses/>.

require 'pathname'
require 'osx/cocoa' # to get number of cores
require "#{File.dirname __FILE__}/env"

HOMEBREW_VERSION='0.1'

Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions Library/Homebrew/env.rb
@@ -0,0 +1,22 @@
# Copyright 2009 Max Howell <max@methylblue.com>
#
# 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 <http://www.gnu.org/licenses/>.

require 'pathname'

$root=Pathname.new(__FILE__).dirname.parent.parent.realpath
$formula=$root+'Library'+'Formula'
$cellar=$root+'Cellar'
7 changes: 1 addition & 6 deletions Cellar/homebrew/unittest.rb → 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 <Formula
def initialize url, md5
Expand Down
30 changes: 12 additions & 18 deletions Cellar/homebrew/brew → bin/brew
@@ -1,20 +1,17 @@
#!/usr/bin/ruby
# Copyright 2009 Max Howell <max@methylblue.com>
# 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
dirs=Array.new
$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<<path
Expand Down Expand Up @@ -90,10 +87,10 @@ def ln name
raise '#{keg} is not a keg'
end
#TODO consider using hardlinks
# yeah indeed, you have to force anything you want in the main tree into
# these directories :P
# yeah indeed, you have to force anything you need in the main tree into
# these directories :P
# NOTE that not everything needs to be in the main tree
# TODO consider using hardlinks
$n=0
lnd(keg, 'etc') {nil}
lnd(keg, 'include') {nil}
Expand All @@ -113,13 +110,8 @@ def ln name
end
lnd(keg, 'share') do |path|
path=path.to_s
if ['man','doc','locale','info'].include? path
:mkpath
else
mans=(1..9).collect {|x| "man/man#{x}"}
:mkpath if mans.include? path
end
includes=(1..9).collect {|x| "man/man#{x}"} <<'man'<<'doc'<<'locale'<<'info'
:mkpath if includes.include? path.to_s
end
return $n
Expand Down Expand Up @@ -219,6 +211,8 @@ begin
o=__obj(name)
raise "#{o.prefix} already exists!" if o.prefix.exist?
o.brew { o.install }
ohai 'Finishing up'
o.clean
ln name
puts "#{o.prefix}: "+`find #{o.prefix} -type f | wc -l`.strip+
' files, '+
Expand Down

0 comments on commit e91aeaf

Please sign in to comment.