Cleanup use of some global constants.
This commit is contained in:
parent
d6ffd493a6
commit
d9d2443d5d
@ -19,7 +19,6 @@ require 'rexml/xmldecl'
|
||||
require 'rexml/cdata'
|
||||
|
||||
EMAIL_SUBJECT_FILE = "brew-test-bot.#{MacOS.cat}.email.txt"
|
||||
HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmd/"
|
||||
|
||||
class Step
|
||||
attr_reader :command, :name, :status, :output, :time
|
||||
|
||||
@ -118,7 +118,7 @@ class FormulaCreator
|
||||
require 'formula'
|
||||
|
||||
# Documentation: https://github.com/mxcl/homebrew/wiki/Formula-Cookbook
|
||||
# #{HOMEBREW_PREFIX}/Library/Contributions/example-formula.rb
|
||||
# #{HOMEBREW_CONTRIB}/example-formula.rb
|
||||
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
|
||||
|
||||
class #{Formula.class_s name} < Formula
|
||||
|
||||
@ -926,7 +926,7 @@ def check_git_status
|
||||
If this a surprise to you, then you should stash these modifications.
|
||||
Stashing returns Homebrew to a pristine state but can be undone
|
||||
should you later need to do so for some reason.
|
||||
cd #{HOMEBREW_REPOSITORY}/Library && git stash && git clean -d -f
|
||||
cd #{HOMEBREW_LIBRARY} && git stash && git clean -d -f
|
||||
EOS
|
||||
end
|
||||
end
|
||||
@ -1032,7 +1032,7 @@ def check_for_outdated_homebrew
|
||||
timestamp = if File.directory? ".git"
|
||||
`git log -1 --format="%ct" HEAD`.to_i
|
||||
else
|
||||
(HOMEBREW_REPOSITORY/"Library").mtime.to_i
|
||||
HOMEBREW_LIBRARY.mtime.to_i
|
||||
end
|
||||
|
||||
if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
|
||||
|
||||
@ -43,7 +43,7 @@ module Homebrew extend self
|
||||
end
|
||||
|
||||
def library_folders
|
||||
Dir["#{HOMEBREW_REPOSITORY}/Library/*"].reject do |d|
|
||||
Dir["#{HOMEBREW_LIBRARY}/*"].reject do |d|
|
||||
case File.basename(d) when 'LinkedKegs', 'Aliases' then true end
|
||||
end
|
||||
end
|
||||
|
||||
@ -83,7 +83,7 @@ module Homebrew extend self
|
||||
def repair_taps
|
||||
count = 0
|
||||
# prune dead symlinks in Formula
|
||||
Dir["#{HOMEBREW_REPOSITORY}/Library/Formula/*.rb"].each do |fn|
|
||||
Dir["#{HOMEBREW_LIBRARY}/Formula/*.rb"].each do |fn|
|
||||
if not File.exist? fn
|
||||
File.delete fn
|
||||
count += 1
|
||||
|
||||
@ -185,7 +185,7 @@ module Superenv
|
||||
end
|
||||
|
||||
def determine_pkg_config_libdir
|
||||
paths = %W{/usr/lib/pkgconfig #{HOMEBREW_REPOSITORY}/Library/ENV/pkgconfig/#{MacOS.version}}
|
||||
paths = %W{/usr/lib/pkgconfig #{HOMEBREW_LIBRARY}/ENV/pkgconfig/#{MacOS.version}}
|
||||
paths << "#{MacOS::X11.lib}/pkgconfig" << "#{MacOS::X11.share}/pkgconfig" if x11?
|
||||
paths.to_path_s
|
||||
end
|
||||
|
||||
@ -362,7 +362,7 @@ class Formula
|
||||
|
||||
# an array of all Formula names
|
||||
def self.names
|
||||
Dir["#{HOMEBREW_REPOSITORY}/Library/Formula/*.rb"].map{ |f| File.basename f, '.rb' }.sort
|
||||
Dir["#{HOMEBREW_LIBRARY}/Formula/*.rb"].map{ |f| File.basename f, '.rb' }.sort
|
||||
end
|
||||
|
||||
def self.each
|
||||
@ -393,7 +393,7 @@ class Formula
|
||||
end
|
||||
|
||||
def self.aliases
|
||||
Dir["#{HOMEBREW_REPOSITORY}/Library/Aliases/*"].map{ |f| File.basename f }.sort
|
||||
Dir["#{HOMEBREW_LIBRARY}/Aliases/*"].map{ |f| File.basename f }.sort
|
||||
end
|
||||
|
||||
# TODO - document what this returns and why
|
||||
@ -402,7 +402,7 @@ class Formula
|
||||
if name.include? "/"
|
||||
if name =~ %r{(.+)/(.+)/(.+)}
|
||||
tap_name = "#$1-#$2".downcase
|
||||
tapd = Pathname.new("#{HOMEBREW_REPOSITORY}/Library/Taps/#{tap_name}")
|
||||
tapd = Pathname.new("#{HOMEBREW_LIBRARY}/Taps/#{tap_name}")
|
||||
tapd.find_formula do |relative_pathname|
|
||||
return "#{tapd}/#{relative_pathname}" if relative_pathname.stem.to_s == $3
|
||||
end if tapd.directory?
|
||||
@ -412,13 +412,13 @@ class Formula
|
||||
end
|
||||
|
||||
# test if the name is a core formula
|
||||
formula_with_that_name = Pathname.new("#{HOMEBREW_REPOSITORY}/Library/Formula/#{name}.rb")
|
||||
formula_with_that_name = Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb")
|
||||
if formula_with_that_name.file? and formula_with_that_name.readable?
|
||||
return name
|
||||
end
|
||||
|
||||
# test if the name is a formula alias
|
||||
possible_alias = Pathname.new("#{HOMEBREW_REPOSITORY}/Library/Aliases/#{name}")
|
||||
possible_alias = Pathname.new("#{HOMEBREW_LIBRARY}/Aliases/#{name}")
|
||||
if possible_alias.file?
|
||||
return possible_alias.realpath.basename('.rb').to_s
|
||||
end
|
||||
@ -457,7 +457,7 @@ class Formula
|
||||
end
|
||||
|
||||
def self.path name
|
||||
Pathname.new("#{HOMEBREW_REPOSITORY}/Library/Formula/#{name.downcase}.rb")
|
||||
Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name.downcase}.rb")
|
||||
end
|
||||
|
||||
def env
|
||||
|
||||
@ -84,7 +84,7 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY
|
||||
HOMEBREW_CURL_ARGS = '-f#LA'
|
||||
|
||||
HOMEBREW_TAP_FORMULA_REGEX = %r{^(\w+)/(\w+)/([^/]+)$}
|
||||
HOMEBREW_TAP_DIR_REGEX = %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)}
|
||||
HOMEBREW_TAP_DIR_REGEX = %r{#{HOMEBREW_LIBRARY}/Taps/(\w+)-(\w+)}
|
||||
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source \
|
||||
+ %r{/(.*)}.source)
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ class FormulaTests < Test::Unit::TestCase
|
||||
|
||||
def test_path
|
||||
name = 'foo-bar'
|
||||
assert_equal Pathname.new("#{HOMEBREW_REPOSITORY}/Library/Formula/#{name}.rb"), Formula.path(name)
|
||||
assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formula.path(name)
|
||||
end
|
||||
|
||||
def test_factory
|
||||
|
||||
@ -90,7 +90,7 @@ begin
|
||||
end
|
||||
|
||||
# Add contributed commands to PATH before checking.
|
||||
ENV['PATH'] += ":#{HOMEBREW_REPOSITORY}/Library/Contributions/cmd"
|
||||
ENV['PATH'] += ":#{HOMEBREW_CONTRIB}/cmd"
|
||||
if require? HOMEBREW_REPOSITORY/"Library/Homebrew/cmd"/cmd
|
||||
Homebrew.send cmd.to_s.gsub('-', '_').downcase
|
||||
elsif which "brew-#{cmd}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user