diff options
| author | Max Howell | 2009-07-31 02:51:17 +0100 |
|---|---|---|
| committer | Max Howell | 2009-07-31 04:59:02 +0100 |
| commit | 9b19f194cc964222b47d0ef66bb7d08fdbc67e4f (patch) | |
| tree | 6bc267fd5af3776bfc14b474abdd2184a478204a /Library/Homebrew/keg.rb | |
| parent | 7f3e8bc36a8591e118abfe451c63e6e5dd9155bd (diff) | |
| download | brew-9b19f194cc964222b47d0ef66bb7d08fdbc67e4f.tar.bz2 | |
Refactor $foo into HOMEBREW_FOO
CONSTANTS are the far saner choice for these important parameters.
Split env up so I can redefine the CONSTANTS in unittest.rb.
Diffstat (limited to 'Library/Homebrew/keg.rb')
| -rw-r--r-- | Library/Homebrew/keg.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 72768ee02..f5c856a95 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with Homebrew. If not, see <http://www.gnu.org/licenses/>. -require 'env' require 'formula' class Keg @@ -29,7 +28,7 @@ class Keg elsif formula.is_a? Pathname # TODO elsif formula.is_a? String - path=$cellar+formula + path=HOMEBREW_CELLAR+formula kids=path.children raise "Empty installation: #{path}" if kids.length < 1 raise "Multiple versions installed" if kids.length > 1 @@ -83,12 +82,12 @@ class Keg def rm # don't rmtree shit if we aren't positive about our location! - raise "Bad stuff!" unless path.parent.parent == $cellar + raise "Bad stuff!" unless path.parent.parent == HOMEBREW_CELLAR if path.directory? FileUtils.chmod_R 0777, path # ensure we have permission to delete - path.rmtree # $cellar/foo/1.2.0 - path.parent.rmdir if path.parent.children.length == 0 # $cellar/foo + path.rmtree # HOMEBREW_CELLAR/foo/1.2.0 + path.parent.rmdir if path.parent.children.length == 0 # HOMEBREW_CELLAR/foo end end @@ -109,13 +108,14 @@ private start=path+start return unless start.directory? + root=Pathname.new HOMEBREW_PREFIX start.find do |from| next if from == start prune=false relative_path=from.relative_path_from path - to=$root+relative_path + to=root+relative_path if from.file? __symlink_relative_to from, to |
