Merge remote-tracking branch 'origin/master' into add_change_origin_command
This commit is contained in:
commit
cfe2f5bfda
33
.github/issue-close-app.yml
vendored
33
.github/issue-close-app.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
# Comment that will be sent if an issue is judged to be closed
|
|
||||||
comment: |
|
|
||||||
Whoops, it looks like you created an issue without filling out the checklist and providing all the needed information from one of the issue templates: <https://github.com/Homebrew/brew/issues/new/choose>
|
|
||||||
|
|
||||||
As we need all this information to help you we're closing this issue. If you add the necessary information to this issue (**don't create a new or duplicate issue, please**) and comment to let us know, a Homebrew maintainer will check it out when they get the chance. If it's deemed to be a valid issue then this issue may be reopened.
|
|
||||||
|
|
||||||
Sorry!
|
|
||||||
issueConfigs:
|
|
||||||
# There can be several configs for different kind of issues.
|
|
||||||
- content:
|
|
||||||
# new feature suggestion
|
|
||||||
- "A detailed description of the proposed feature"
|
|
||||||
- "The motivation for the feature"
|
|
||||||
- "How the feature would be relevant to at least 90% of Homebrew users"
|
|
||||||
- "What alternatives to the feature have been considered"
|
|
||||||
- content:
|
|
||||||
# reproducible bug report
|
|
||||||
- "are reporting a bug others will be able to reproduce"
|
|
||||||
- "reproduced the problem with multiple formulae"
|
|
||||||
- "brew update"
|
|
||||||
- "brew doctor"
|
|
||||||
- "brew config"
|
|
||||||
- "What you were trying to do (and why)"
|
|
||||||
- "What happened (include command output)"
|
|
||||||
- "What you expected to happen"
|
|
||||||
- "Step-by-step reproduction instructions (by running `brew` commands)"
|
|
||||||
# Optional configuration:
|
|
||||||
#
|
|
||||||
# whether the keywords are case-insensitive
|
|
||||||
# default value is false, which means keywords are case-sensitive
|
|
||||||
caseInsensitive: false
|
|
||||||
# The issue is judged to be legal if it includes all keywords from any of these two configs.
|
|
||||||
# Or it will be closed by the app.
|
|
||||||
43
.github/workflows/tests.yml
vendored
43
.github/workflows/tests.yml
vendored
@ -11,15 +11,25 @@ jobs:
|
|||||||
os: [ubuntu-latest, macOS-latest]
|
os: [ubuntu-latest, macOS-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Git repository
|
- name: Set up Git repository
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Set up Homebrew
|
- name: Set up Homebrew
|
||||||
run: |
|
run: |
|
||||||
if [ "$RUNNER_OS" = "Linux" ]; then
|
if [ "$RUNNER_OS" = "Linux" ]; then
|
||||||
HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew
|
HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew
|
||||||
sudo mkdir -p /home/linuxbrew
|
sudo mkdir -p /home/linuxbrew/.linuxbrew
|
||||||
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"
|
cd ..
|
||||||
|
sudo mv "brew" "$HOMEBREW_REPOSITORY"
|
||||||
|
sudo ln -s "$HOMEBREW_REPOSITORY" "brew"
|
||||||
|
cd /home/linuxbrew/.linuxbrew
|
||||||
|
sudo mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar
|
||||||
|
sudo ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/
|
||||||
sudo chown -R "$USER" /home/linuxbrew
|
sudo chown -R "$USER" /home/linuxbrew
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
|
|
||||||
|
# Install taps needed for 'brew tests'
|
||||||
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
|
brew tap homebrew/bundle
|
||||||
else
|
else
|
||||||
HOMEBREW_REPOSITORY="$(brew --repo)"
|
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||||
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
||||||
@ -28,11 +38,30 @@ jobs:
|
|||||||
brew update-reset Library/Taps/homebrew/homebrew-core
|
brew update-reset Library/Taps/homebrew/homebrew-core
|
||||||
|
|
||||||
# Install taps needed for 'brew tests'
|
# Install taps needed for 'brew tests'
|
||||||
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
brew tap homebrew/cask
|
brew tap homebrew/cask
|
||||||
brew tap homebrew/bundle
|
brew tap homebrew/bundle
|
||||||
brew tap homebrew/services
|
brew tap homebrew/services
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Run brew config
|
||||||
|
run: |
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
|
brew config
|
||||||
|
|
||||||
|
- name: Run brew doctor
|
||||||
|
run: |
|
||||||
|
if [ "$RUNNER_OS" = "Linux" ]; then
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin"
|
||||||
|
|
||||||
|
# Cleanup some Linux `brew doctor` failures
|
||||||
|
sudo rm -rf /usr/local/include/node/
|
||||||
|
else
|
||||||
|
# Allow Xcode to be outdated
|
||||||
|
export HOMEBREW_GITHUB_ACTIONS=1
|
||||||
|
fi
|
||||||
|
brew doctor
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: |
|
run: |
|
||||||
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
@ -101,6 +130,12 @@ jobs:
|
|||||||
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
brew readall --aliases
|
brew readall --aliases
|
||||||
|
|
||||||
|
- name: Run vale for docs linting
|
||||||
|
run: |
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:/usr/local/bin:/usr/bin:/bin"
|
||||||
|
brew install vale
|
||||||
|
vale $(brew --repo)/docs/
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
docker pull homebrew/brew
|
docker pull homebrew/brew
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -154,6 +154,7 @@
|
|||||||
!/.editorconfig
|
!/.editorconfig
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
!/.yardopts
|
!/.yardopts
|
||||||
|
!/.vale.ini
|
||||||
!/CHANGELOG.md
|
!/CHANGELOG.md
|
||||||
!/CONTRIBUTING.md
|
!/CONTRIBUTING.md
|
||||||
!/Dockerfile
|
!/Dockerfile
|
||||||
|
|||||||
4
.vale.ini
Normal file
4
.vale.ini
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
StylesPath = ./docs/vale-styles
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
BasedOnStyles = Homebrew
|
||||||
@ -79,7 +79,7 @@ Metrics/PerceivedComplexity:
|
|||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
|
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
|
||||||
Metrics/LineLength:
|
Layout/LineLength:
|
||||||
Max: 170
|
Max: 170
|
||||||
# ignore manpage comments and long single-line strings
|
# ignore manpage comments and long single-line strings
|
||||||
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
|
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Layout/FirstHashElementIndentation:
|
|||||||
EnforcedStyle: align_braces
|
EnforcedStyle: align_braces
|
||||||
|
|
||||||
# Casks often contain long URLs and file paths.
|
# Casks often contain long URLs and file paths.
|
||||||
Metrics/LineLength:
|
Layout/LineLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Casks don't need documentation.
|
# Casks don't need documentation.
|
||||||
|
|||||||
@ -62,7 +62,7 @@ Metrics/PerceivedComplexity:
|
|||||||
Max: 100
|
Max: 100
|
||||||
|
|
||||||
# GitHub diff UI wraps beyond 118 characters
|
# GitHub diff UI wraps beyond 118 characters
|
||||||
Metrics/LineLength:
|
Layout/LineLength:
|
||||||
Max: 118
|
Max: 118
|
||||||
# ignore manpage comments
|
# ignore manpage comments
|
||||||
IgnoredPatterns: ['#: ']
|
IgnoredPatterns: ['#: ']
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
activesupport (6.0.1)
|
activesupport (6.0.2.1)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
@ -26,7 +26,7 @@ GEM
|
|||||||
i18n (1.7.0)
|
i18n (1.7.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
jaro_winkler (1.5.4)
|
jaro_winkler (1.5.4)
|
||||||
json (2.2.0)
|
json (2.3.0)
|
||||||
mechanize (2.7.6)
|
mechanize (2.7.6)
|
||||||
domain_name (~> 0.5, >= 0.5.1)
|
domain_name (~> 0.5, >= 0.5.1)
|
||||||
http-cookie (~> 1.0)
|
http-cookie (~> 1.0)
|
||||||
@ -36,22 +36,22 @@ GEM
|
|||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
ntlm-http (~> 0.1, >= 0.1.1)
|
ntlm-http (~> 0.1, >= 0.1.1)
|
||||||
webrobots (>= 0.0.9, < 0.2)
|
webrobots (>= 0.0.9, < 0.2)
|
||||||
mime-types (3.3)
|
mime-types (3.3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.1009)
|
mime-types-data (3.2019.1009)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.13.0)
|
minitest (5.13.0)
|
||||||
mustache (1.1.0)
|
mustache (1.1.1)
|
||||||
net-http-digest_auth (1.4.1)
|
net-http-digest_auth (1.4.1)
|
||||||
net-http-persistent (3.1.0)
|
net-http-persistent (3.1.0)
|
||||||
connection_pool (~> 2.2)
|
connection_pool (~> 2.2)
|
||||||
nokogiri (1.10.5)
|
nokogiri (1.10.7)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
ntlm-http (0.1.1)
|
ntlm-http (0.1.1)
|
||||||
parallel (1.19.1)
|
parallel (1.19.1)
|
||||||
parallel_tests (2.29.2)
|
parallel_tests (2.30.0)
|
||||||
parallel
|
parallel
|
||||||
parser (2.6.5.0)
|
parser (2.7.0.0)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
plist (3.5.0)
|
plist (3.5.0)
|
||||||
rainbow (3.0.0)
|
rainbow (3.0.0)
|
||||||
@ -64,8 +64,8 @@ GEM
|
|||||||
rspec-core (~> 3.9.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.9.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.9.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.9.0)
|
rspec-core (3.9.1)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.1)
|
||||||
rspec-expectations (3.9.0)
|
rspec-expectations (3.9.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
@ -77,19 +77,19 @@ GEM
|
|||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-retry (0.6.2)
|
rspec-retry (0.6.2)
|
||||||
rspec-core (> 3.3)
|
rspec-core (> 3.3)
|
||||||
rspec-support (3.9.0)
|
rspec-support (3.9.1)
|
||||||
rspec-wait (0.0.9)
|
rspec-wait (0.0.9)
|
||||||
rspec (>= 3, < 4)
|
rspec (>= 3, < 4)
|
||||||
rubocop (0.77.0)
|
rubocop (0.78.0)
|
||||||
jaro_winkler (~> 1.5.1)
|
jaro_winkler (~> 1.5.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.6)
|
parser (>= 2.6)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 1.7)
|
unicode-display_width (>= 1.4.0, < 1.7)
|
||||||
rubocop-performance (1.5.1)
|
rubocop-performance (1.5.2)
|
||||||
rubocop (>= 0.71.0)
|
rubocop (>= 0.71.0)
|
||||||
rubocop-rspec (1.37.0)
|
rubocop-rspec (1.37.1)
|
||||||
rubocop (>= 0.68.1)
|
rubocop (>= 0.68.1)
|
||||||
ruby-macho (2.2.0)
|
ruby-macho (2.2.0)
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.10.1)
|
||||||
@ -100,10 +100,10 @@ GEM
|
|||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
term-ansicolor (1.7.1)
|
term-ansicolor (1.7.1)
|
||||||
tins (~> 1.0)
|
tins (~> 1.0)
|
||||||
thor (0.20.3)
|
thor (1.0.1)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tins (1.22.2)
|
tins (1.22.2)
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.6)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
|
|||||||
@ -77,8 +77,8 @@ HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbr
|
|||||||
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
|
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
|
||||||
if [[ -z "$HOMEBREW_VERSION" ]]
|
if [[ -z "$HOMEBREW_VERSION" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_VERSION=">=1.7.1 (shallow or no git repository)"
|
HOMEBREW_VERSION=">=2.2.0 (shallow or no git repository)"
|
||||||
HOMEBREW_USER_AGENT_VERSION="1.X.Y"
|
HOMEBREW_USER_AGENT_VERSION="2.X.Y"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]]
|
if [[ "$HOMEBREW_PREFIX" = "/" || "$HOMEBREW_PREFIX" = "/usr" ]]
|
||||||
@ -410,8 +410,8 @@ fi
|
|||||||
check-run-command-as-root() {
|
check-run-command-as-root() {
|
||||||
[[ "$(id -u)" = 0 ]] || return
|
[[ "$(id -u)" = 0 ]] || return
|
||||||
|
|
||||||
# Allow Azure Pipelines/Docker/Kubernetes to do everything as root (as it's normal there)
|
# Allow Azure Pipelines/Docker/Concourse/Kubernetes to do everything as root (as it's normal there)
|
||||||
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|docker|kubepods" -q /proc/1/cgroup && return
|
[[ -f /proc/1/cgroup ]] && grep -E "azpl_job|docker|garden|kubepods" -q /proc/1/cgroup && return
|
||||||
|
|
||||||
# Homebrew Services may need `sudo` for system-wide daemons.
|
# Homebrew Services may need `sudo` for system-wide daemons.
|
||||||
[[ "$HOMEBREW_COMMAND" = "services" ]] && return
|
[[ "$HOMEBREW_COMMAND" = "services" ]] && return
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class Build
|
|||||||
end
|
end
|
||||||
if ARGV.interactive?
|
if ARGV.interactive?
|
||||||
ohai "Entering interactive mode"
|
ohai "Entering interactive mode"
|
||||||
puts "Type `exit` to return and finalize the installation"
|
puts "Type `exit` to return and finalize the installation."
|
||||||
puts "Install to this prefix: #{formula.prefix}"
|
puts "Install to this prefix: #{formula.prefix}"
|
||||||
|
|
||||||
if ARGV.git?
|
if ARGV.git?
|
||||||
|
|||||||
@ -11,7 +11,7 @@ module Cask
|
|||||||
|
|
||||||
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
|
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
|
||||||
|
|
||||||
MAJOR_MINOR_PATCH_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/.freeze
|
MAJOR_MINOR_PATCH_REGEX = /^([^.,:]+)(?:\.([^.,:]+)(?:\.([^.,:]+))?)?/.freeze
|
||||||
|
|
||||||
INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze
|
INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class Cleaner
|
|||||||
end
|
end
|
||||||
if ARGV.debug?
|
if ARGV.debug?
|
||||||
old_perms = path.stat.mode & 0777
|
old_perms = path.stat.mode & 0777
|
||||||
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
|
odebug "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
|
||||||
end
|
end
|
||||||
path.chmod perms
|
path.chmod perms
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,16 +5,23 @@ require "ostruct"
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module CLI
|
module CLI
|
||||||
class Args < OpenStruct
|
class Args < OpenStruct
|
||||||
attr_accessor :processed_options
|
attr_reader :processed_options, :args_parsed
|
||||||
# undefine tap to allow --tap argument
|
# undefine tap to allow --tap argument
|
||||||
undef tap
|
undef tap
|
||||||
|
|
||||||
def initialize(argv:)
|
def initialize(argv:)
|
||||||
super
|
super
|
||||||
@argv = argv
|
@argv = argv
|
||||||
|
@args_parsed = false
|
||||||
@processed_options = []
|
@processed_options = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def freeze_processed_options!(processed_options)
|
||||||
|
@processed_options += processed_options
|
||||||
|
@processed_options.freeze
|
||||||
|
@args_parsed = true
|
||||||
|
end
|
||||||
|
|
||||||
def option_to_name(option)
|
def option_to_name(option)
|
||||||
option.sub(/\A--?/, "")
|
option.sub(/\A--?/, "")
|
||||||
.tr("-", "_")
|
.tr("-", "_")
|
||||||
@ -51,22 +58,38 @@ module Homebrew
|
|||||||
options_only - CLI::Parser.global_options.values.map(&:first).flatten
|
options_only - CLI::Parser.global_options.values.map(&:first).flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
def downcased_unique_named
|
def named
|
||||||
# Only lowercase names, not paths, bottle filenames or URLs
|
return [] if remaining.nil?
|
||||||
@downcased_unique_named ||= remaining.map do |arg|
|
|
||||||
if arg.include?("/") || arg.end_with?(".tar.gz") || File.exist?(arg)
|
remaining
|
||||||
arg
|
|
||||||
else
|
|
||||||
arg.downcase
|
|
||||||
end
|
end
|
||||||
end.uniq
|
|
||||||
|
def formulae
|
||||||
|
require "formula"
|
||||||
|
@formulae ||= (downcased_unique_named - casks).map do |name|
|
||||||
|
if name.include?("/") || File.exist?(name)
|
||||||
|
Formulary.factory(name, spec)
|
||||||
|
else
|
||||||
|
Formulary.find_with_priority(name, spec)
|
||||||
|
end
|
||||||
|
end.uniq(&:name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def resolved_formulae
|
||||||
|
require "formula"
|
||||||
|
@resolved_formulae ||= (downcased_unique_named - casks).map do |name|
|
||||||
|
Formulary.resolve(name, spec: spec(nil))
|
||||||
|
end.uniq(&:name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def casks
|
||||||
|
@casks ||= downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX
|
||||||
end
|
end
|
||||||
|
|
||||||
def kegs
|
def kegs
|
||||||
require "keg"
|
require "keg"
|
||||||
require "formula"
|
require "formula"
|
||||||
require "missing_formula"
|
require "missing_formula"
|
||||||
|
|
||||||
@kegs ||= downcased_unique_named.map do |name|
|
@kegs ||= downcased_unique_named.map do |name|
|
||||||
raise UsageError if name.empty?
|
raise UsageError if name.empty?
|
||||||
|
|
||||||
@ -113,6 +136,42 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def downcased_unique_named
|
||||||
|
# Only lowercase names, not paths, bottle filenames or URLs
|
||||||
|
arguments = if args_parsed
|
||||||
|
remaining
|
||||||
|
else
|
||||||
|
cmdline_args.reject { |arg| arg.start_with?("-") }
|
||||||
|
end
|
||||||
|
arguments.map do |arg|
|
||||||
|
if arg.include?("/") || arg.end_with?(".tar.gz") || File.exist?(arg)
|
||||||
|
arg
|
||||||
|
else
|
||||||
|
arg.downcase
|
||||||
|
end
|
||||||
|
end.uniq
|
||||||
|
end
|
||||||
|
|
||||||
|
def head
|
||||||
|
(args_parsed && HEAD?) || cmdline_args.include?("--HEAD")
|
||||||
|
end
|
||||||
|
|
||||||
|
def devel
|
||||||
|
(args_parsed && devel?) || cmdline_args.include?("--devel")
|
||||||
|
end
|
||||||
|
|
||||||
|
def spec(default = :stable)
|
||||||
|
if head
|
||||||
|
:head
|
||||||
|
elsif devel
|
||||||
|
:devel
|
||||||
|
else
|
||||||
|
default
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,7 +13,7 @@ module Homebrew
|
|||||||
attr_reader :processed_options, :hide_from_man_page
|
attr_reader :processed_options, :hide_from_man_page
|
||||||
|
|
||||||
def self.parse(args = ARGV, &block)
|
def self.parse(args = ARGV, &block)
|
||||||
new(&block).parse(args)
|
new(args, &block).parse(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.global_options
|
def self.global_options
|
||||||
@ -25,13 +25,16 @@ module Homebrew
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(&block)
|
def initialize(args = ARGV, &block)
|
||||||
@parser = OptionParser.new
|
@parser = OptionParser.new
|
||||||
@args = Homebrew::CLI::Args.new(argv: ARGV_WITHOUT_MONKEY_PATCHING)
|
@args = Homebrew::CLI::Args.new(argv: ARGV_WITHOUT_MONKEY_PATCHING)
|
||||||
|
@args[:remaining] = []
|
||||||
|
@args[:cmdline_args] = args.dup
|
||||||
@constraints = []
|
@constraints = []
|
||||||
@conflicts = []
|
@conflicts = []
|
||||||
@switch_sources = {}
|
@switch_sources = {}
|
||||||
@processed_options = []
|
@processed_options = []
|
||||||
|
@max_named_args = nil
|
||||||
@hide_from_man_page = false
|
@hide_from_man_page = false
|
||||||
instance_eval(&block)
|
instance_eval(&block)
|
||||||
post_initialize
|
post_initialize
|
||||||
@ -137,11 +140,12 @@ module Homebrew
|
|||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
check_constraint_violations
|
check_constraint_violations
|
||||||
|
check_named_args(remaining_args)
|
||||||
@args[:remaining] = remaining_args
|
@args[:remaining] = remaining_args
|
||||||
@args_parsed = true
|
@args.freeze_processed_options!(@processed_options)
|
||||||
@args.processed_options = @processed_options
|
|
||||||
Homebrew.args = @args
|
Homebrew.args = @args
|
||||||
cmdline_args.freeze
|
cmdline_args.freeze
|
||||||
|
@args_parsed = true
|
||||||
@parser
|
@parser
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -159,7 +163,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def formula_options
|
def formula_options
|
||||||
ARGV.formulae.each do |f|
|
@args.formulae.each do |f|
|
||||||
next if f.options.empty?
|
next if f.options.empty?
|
||||||
|
|
||||||
f.options.each do |o|
|
f.options.each do |o|
|
||||||
@ -176,6 +180,10 @@ module Homebrew
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def max_named(count)
|
||||||
|
@max_named_args = count
|
||||||
|
end
|
||||||
|
|
||||||
def hide_from_man_page!
|
def hide_from_man_page!
|
||||||
@hide_from_man_page = true
|
@hide_from_man_page = true
|
||||||
end
|
end
|
||||||
@ -267,6 +275,10 @@ module Homebrew
|
|||||||
check_constraints
|
check_constraints
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_named_args(args)
|
||||||
|
raise NamedArgumentsError, @max_named_args if !@max_named_args.nil? && args.size > @max_named_args
|
||||||
|
end
|
||||||
|
|
||||||
def process_option(*args)
|
def process_option(*args)
|
||||||
option, = @parser.make_switch(args)
|
option, = @parser.make_switch(args)
|
||||||
@processed_options << [option.short.first, option.long.first, option.arg, option.desc.first]
|
@processed_options << [option.short.first, option.long.first, option.arg, option.desc.first]
|
||||||
@ -275,14 +287,10 @@ module Homebrew
|
|||||||
|
|
||||||
class OptionConstraintError < RuntimeError
|
class OptionConstraintError < RuntimeError
|
||||||
def initialize(arg1, arg2, missing: false)
|
def initialize(arg1, arg2, missing: false)
|
||||||
if !missing
|
message = if !missing
|
||||||
message = <<~EOS
|
"`#{arg1}` and `#{arg2}` should be passed together."
|
||||||
`#{arg1}` and `#{arg2}` should be passed together.
|
|
||||||
EOS
|
|
||||||
else
|
else
|
||||||
message = <<~EOS
|
"`#{arg2}` cannot be passed without `#{arg1}`."
|
||||||
`#{arg2}` cannot be passed without `#{arg1}`.
|
|
||||||
EOS
|
|
||||||
end
|
end
|
||||||
super message
|
super message
|
||||||
end
|
end
|
||||||
@ -292,17 +300,27 @@ module Homebrew
|
|||||||
def initialize(args)
|
def initialize(args)
|
||||||
args_list = args.map(&Formatter.public_method(:option))
|
args_list = args.map(&Formatter.public_method(:option))
|
||||||
.join(" and ")
|
.join(" and ")
|
||||||
super <<~EOS
|
super "Options #{args_list} are mutually exclusive."
|
||||||
Options #{args_list} are mutually exclusive.
|
|
||||||
EOS
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class InvalidConstraintError < RuntimeError
|
class InvalidConstraintError < RuntimeError
|
||||||
def initialize(arg1, arg2)
|
def initialize(arg1, arg2)
|
||||||
super <<~EOS
|
super "`#{arg1}` and `#{arg2}` cannot be mutually exclusive and mutually dependent simultaneously."
|
||||||
`#{arg1}` and `#{arg2}` cannot be mutually exclusive and mutually dependent simultaneously.
|
end
|
||||||
EOS
|
end
|
||||||
|
|
||||||
|
class NamedArgumentsError < UsageError
|
||||||
|
def initialize(maximum)
|
||||||
|
message = case maximum
|
||||||
|
when 0
|
||||||
|
"This command does not take named arguments."
|
||||||
|
when 1
|
||||||
|
"This command does not take multiple named arguments."
|
||||||
|
else
|
||||||
|
"This command does not take more than #{maximum} named arguments."
|
||||||
|
end
|
||||||
|
super message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -29,7 +29,7 @@ module Homebrew
|
|||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
puts HOMEBREW_CACHE
|
puts HOMEBREW_CACHE
|
||||||
else
|
else
|
||||||
ARGV.formulae.each do |f|
|
Homebrew.args.formulae.each do |f|
|
||||||
if Fetch.fetch_bottle?(f)
|
if Fetch.fetch_bottle?(f)
|
||||||
puts f.bottle.cached_download
|
puts f.bottle.cached_download
|
||||||
else
|
else
|
||||||
|
|||||||
@ -22,7 +22,7 @@ module Homebrew
|
|||||||
def __cellar
|
def __cellar
|
||||||
__cellar_args.parse
|
__cellar_args.parse
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if Homebrew.args.named.blank?
|
||||||
puts HOMEBREW_CELLAR
|
puts HOMEBREW_CELLAR
|
||||||
else
|
else
|
||||||
puts ARGV.resolved_formulae.map(&:rack)
|
puts ARGV.resolved_formulae.map(&:rack)
|
||||||
|
|||||||
@ -11,7 +11,7 @@ module Homebrew
|
|||||||
def __env_args
|
def __env_args
|
||||||
Homebrew::CLI::Parser.new do
|
Homebrew::CLI::Parser.new do
|
||||||
usage_banner <<~EOS
|
usage_banner <<~EOS
|
||||||
`--env` [<options>]
|
`--env` [<options>] [<formula>]
|
||||||
|
|
||||||
Summarise Homebrew's build environment as a plain list.
|
Summarise Homebrew's build environment as a plain list.
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ module Homebrew
|
|||||||
__env_args.parse
|
__env_args.parse
|
||||||
|
|
||||||
ENV.activate_extensions!
|
ENV.activate_extensions!
|
||||||
ENV.deps = ARGV.formulae if superenv?
|
ENV.deps = Homebrew.args.formulae if superenv?
|
||||||
ENV.setup_build_environment
|
ENV.setup_build_environment
|
||||||
ENV.universal_binary if ARGV.build_universal?
|
ENV.universal_binary if ARGV.build_universal?
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ module Homebrew
|
|||||||
def __prefix
|
def __prefix
|
||||||
__prefix_args.parse
|
__prefix_args.parse
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if Homebrew.args.named.blank?
|
||||||
puts HOMEBREW_PREFIX
|
puts HOMEBREW_PREFIX
|
||||||
else
|
else
|
||||||
puts ARGV.resolved_formulae.map { |f|
|
puts ARGV.resolved_formulae.map { |f|
|
||||||
|
|||||||
@ -13,14 +13,13 @@ module Homebrew
|
|||||||
Print the version numbers of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask
|
Print the version numbers of Homebrew, Homebrew/homebrew-core and Homebrew/homebrew-cask
|
||||||
(if tapped) to standard output.
|
(if tapped) to standard output.
|
||||||
EOS
|
EOS
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def __version
|
def __version
|
||||||
__version_args.parse
|
__version_args.parse
|
||||||
|
|
||||||
odie "This command does not take arguments." if ARGV.any?
|
|
||||||
|
|
||||||
puts "Homebrew #{HOMEBREW_VERSION}"
|
puts "Homebrew #{HOMEBREW_VERSION}"
|
||||||
puts "#{CoreTap.instance.full_name} #{CoreTap.instance.version_string}"
|
puts "#{CoreTap.instance.full_name} #{CoreTap.instance.version_string}"
|
||||||
puts "#{Tap.default_cask_tap.full_name} #{Tap.default_cask_tap.version_string}" if Tap.default_cask_tap.installed?
|
puts "#{Tap.default_cask_tap.full_name} #{Tap.default_cask_tap.version_string}" if Tap.default_cask_tap.installed?
|
||||||
|
|||||||
@ -19,14 +19,13 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def analytics
|
def analytics
|
||||||
analytics_args.parse
|
analytics_args.parse
|
||||||
|
|
||||||
raise UsageError if args.remaining.size > 1
|
|
||||||
|
|
||||||
case args.remaining.first
|
case args.remaining.first
|
||||||
when nil, "state"
|
when nil, "state"
|
||||||
if Utils::Analytics.disabled?
|
if Utils::Analytics.disabled?
|
||||||
@ -42,7 +41,7 @@ module Homebrew
|
|||||||
when "regenerate-uuid"
|
when "regenerate-uuid"
|
||||||
Utils::Analytics.regenerate_uuid!
|
Utils::Analytics.regenerate_uuid!
|
||||||
else
|
else
|
||||||
raise UsageError
|
raise UsageError, "Unknown subcommand."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,17 +12,17 @@ module Homebrew
|
|||||||
|
|
||||||
Display the source of <formula>.
|
Display the source of <formula>.
|
||||||
EOS
|
EOS
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cat
|
def cat
|
||||||
cat_args.parse
|
cat_args.parse
|
||||||
# do not "fix" this to support multiple arguments, the output would be
|
# do not "fix" this to support multiple arguments, the output would be
|
||||||
# unparsable, if the user wants to cat multiple formula they can call
|
# unparsable; if the user wants to cat multiple formula they can call
|
||||||
# brew cat multiple times.
|
# `brew cat` multiple times.
|
||||||
formulae = ARGV.formulae
|
formulae = Homebrew.args.formulae
|
||||||
raise FormulaUnspecifiedError if formulae.empty?
|
raise FormulaUnspecifiedError if formulae.empty?
|
||||||
raise "`brew cat` doesn't support multiple arguments" if args.remaining.size > 1
|
|
||||||
|
|
||||||
cd HOMEBREW_REPOSITORY
|
cd HOMEBREW_REPOSITORY
|
||||||
pager = if ENV["HOMEBREW_BAT"].nil?
|
pager = if ENV["HOMEBREW_BAT"].nil?
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Homebrew
|
|||||||
description: "Show what would be removed, but do not actually remove anything."
|
description: "Show what would be removed, but do not actually remove anything."
|
||||||
switch "-s",
|
switch "-s",
|
||||||
description: "Scrub the cache, including downloads for even the latest versions. "\
|
description: "Scrub the cache, including downloads for even the latest versions. "\
|
||||||
"Note downloads for any installed formula or cask will still not be deleted. "\
|
"Note downloads for any installed formulae or casks will still not be deleted. "\
|
||||||
"If you want to delete those too: `rm -rf \"$(brew --cache)\"`"
|
"If you want to delete those too: `rm -rf \"$(brew --cache)\"`"
|
||||||
switch "--prune-prefix",
|
switch "--prune-prefix",
|
||||||
description: "Only prune the symlinks and directories from the prefix and remove no other files."
|
description: "Only prune the symlinks and directories from the prefix and remove no other files."
|
||||||
|
|||||||
@ -20,12 +20,12 @@ module Homebrew
|
|||||||
|
|
||||||
def command
|
def command
|
||||||
command_args.parse
|
command_args.parse
|
||||||
abort "This command requires a command argument" if args.remaining.empty?
|
|
||||||
|
|
||||||
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(args.remaining.first, args.remaining.first)
|
raise UsageError, "This command requires a command argument" if args.remaining.empty?
|
||||||
|
|
||||||
|
args.remaining.each do |c|
|
||||||
|
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(c, c)
|
||||||
path = Commands.path(cmd)
|
path = Commands.path(cmd)
|
||||||
|
|
||||||
cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
|
cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path
|
||||||
path ||= which("brew-#{cmd}", cmd_paths)
|
path ||= which("brew-#{cmd}", cmd_paths)
|
||||||
path ||= which("brew-#{cmd}.rb", cmd_paths)
|
path ||= which("brew-#{cmd}.rb", cmd_paths)
|
||||||
@ -33,4 +33,5 @@ module Homebrew
|
|||||||
odie "Unknown command: #{cmd}" unless path
|
odie "Unknown command: #{cmd}" unless path
|
||||||
puts path
|
puts path
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -19,6 +19,7 @@ module Homebrew
|
|||||||
description: "Include aliases of internal commands."
|
description: "Include aliases of internal commands."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -35,21 +36,18 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Find commands in Homebrew/cmd
|
# Find commands in Homebrew/cmd
|
||||||
puts "Built-in commands"
|
ohai "Built-in commands", Formatter.columns(internal_commands.sort)
|
||||||
puts Formatter.columns(internal_commands.sort)
|
|
||||||
|
|
||||||
# Find commands in Homebrew/dev-cmd
|
# Find commands in Homebrew/dev-cmd
|
||||||
puts
|
puts
|
||||||
puts "Built-in developer commands"
|
ohai "Built-in developer commands", Formatter.columns(internal_developer_commands.sort)
|
||||||
puts Formatter.columns(internal_developer_commands.sort)
|
|
||||||
|
|
||||||
exts = external_commands
|
exts = external_commands
|
||||||
return if exts.empty?
|
return if exts.empty?
|
||||||
|
|
||||||
# Find commands in the PATH
|
# Find commands in the PATH
|
||||||
puts
|
puts
|
||||||
puts "External commands"
|
ohai "External commands", Formatter.columns(exts)
|
||||||
puts Formatter.columns(exts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def internal_commands
|
def internal_commands
|
||||||
|
|||||||
@ -16,12 +16,12 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def config
|
def config
|
||||||
config_args.parse
|
config_args.parse
|
||||||
raise UsageError unless args.remaining.empty?
|
|
||||||
|
|
||||||
SystemConfig.dump_verbose_config
|
SystemConfig.dump_verbose_config
|
||||||
end
|
end
|
||||||
|
|||||||
@ -67,16 +67,16 @@ module Homebrew
|
|||||||
if args.installed?
|
if args.installed?
|
||||||
puts_deps_tree Formula.installed.sort, recursive
|
puts_deps_tree Formula.installed.sort, recursive
|
||||||
else
|
else
|
||||||
raise FormulaUnspecifiedError if args.remaining.empty?
|
raise FormulaUnspecifiedError if Homebrew.args.remaining.empty?
|
||||||
|
|
||||||
puts_deps_tree ARGV.formulae, recursive
|
puts_deps_tree Homebrew.args.formulae, recursive
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
elsif args.all?
|
elsif args.all?
|
||||||
puts_deps Formula.sort, recursive
|
puts_deps Formula.sort, recursive
|
||||||
return
|
return
|
||||||
elsif !args.remaining.empty? && args.for_each?
|
elsif !Homebrew.args.remaining.empty? && args.for_each?
|
||||||
puts_deps ARGV.formulae, recursive
|
puts_deps Homebrew.args.formulae, recursive
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,14 +88,14 @@ module Homebrew
|
|||||||
!args.include_optional? &&
|
!args.include_optional? &&
|
||||||
!args.skip_recommended?
|
!args.skip_recommended?
|
||||||
|
|
||||||
if args.remaining.empty?
|
if Homebrew.args.remaining.empty?
|
||||||
raise FormulaUnspecifiedError unless args.installed?
|
raise FormulaUnspecifiedError unless args.installed?
|
||||||
|
|
||||||
puts_deps Formula.installed.sort, recursive
|
puts_deps Formula.installed.sort, recursive
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
all_deps = deps_for_formulae(ARGV.formulae, recursive, &(args.union? ? :| : :&))
|
all_deps = deps_for_formulae(Homebrew.args.formulae, recursive, &(args.union? ? :| : :&))
|
||||||
all_deps = condense_requirements(all_deps)
|
all_deps = condense_requirements(all_deps)
|
||||||
all_deps.select!(&:installed?) if args.installed?
|
all_deps.select!(&:installed?) if args.installed?
|
||||||
all_deps.map!(&method(:dep_display_name))
|
all_deps.map!(&method(:dep_display_name))
|
||||||
@ -175,13 +175,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def recursive_deps_tree(f, prefix, recursive)
|
def recursive_deps_tree(f, prefix, recursive)
|
||||||
reqs = f.requirements
|
includes, ignores = argv_includes_ignores(ARGV)
|
||||||
deps = f.deps
|
deps = reject_ignores(f.deps, ignores, includes)
|
||||||
|
reqs = reject_ignores(f.requirements, ignores, includes)
|
||||||
dependables = reqs + deps
|
dependables = reqs + deps
|
||||||
dependables.reject!(&:optional?) unless args.include_optional?
|
|
||||||
dependables.reject!(&:build?) unless args.include_build?
|
|
||||||
dependables.reject!(&:test?) unless args.include_test?
|
|
||||||
dependables.reject!(&:recommended?) if args.skip_recommended?
|
|
||||||
max = dependables.length - 1
|
max = dependables.length - 1
|
||||||
@dep_stack.push f.name
|
@dep_stack.push f.name
|
||||||
dependables.each_with_index do |dep, i|
|
dependables.each_with_index do |dep, i|
|
||||||
|
|||||||
@ -40,17 +40,13 @@ module Homebrew
|
|||||||
search_type << :either if args.search
|
search_type << :either if args.search
|
||||||
search_type << :name if args.name
|
search_type << :name if args.name
|
||||||
search_type << :desc if args.description
|
search_type << :desc if args.description
|
||||||
if search_type.size > 1
|
odie "You must provide a search term." if search_type.present? && ARGV.named.empty?
|
||||||
odie "Pick one, and only one, of -s/--search, -n/--name, or -d/--description."
|
|
||||||
elsif search_type.present? && ARGV.named.empty?
|
|
||||||
odie "You must provide a search term."
|
|
||||||
end
|
|
||||||
|
|
||||||
results = if search_type.empty?
|
results = if search_type.empty?
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
desc = {}
|
desc = {}
|
||||||
ARGV.formulae.each { |f| desc[f.full_name] = f.desc }
|
Homebrew.args.formulae.each { |f| desc[f.full_name] = f.desc }
|
||||||
Descriptions.new(desc)
|
Descriptions.new(desc)
|
||||||
else
|
else
|
||||||
arg = ARGV.named.join(" ")
|
arg = ARGV.named.join(" ")
|
||||||
|
|||||||
@ -21,6 +21,7 @@ module Homebrew
|
|||||||
description: "Explicitly set the <version> of the package being installed."
|
description: "Explicitly set the <version> of the package being installed."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -47,7 +48,6 @@ module Homebrew
|
|||||||
|
|
||||||
def detect_version(path)
|
def detect_version(path)
|
||||||
version = path.version.to_s
|
version = path.version.to_s
|
||||||
|
|
||||||
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
||||||
|
|
||||||
version
|
version
|
||||||
|
|||||||
@ -18,7 +18,8 @@ module Homebrew
|
|||||||
an issue; just ignore this.
|
an issue; just ignore this.
|
||||||
EOS
|
EOS
|
||||||
switch "--list-checks",
|
switch "--list-checks",
|
||||||
description: "List all audit methods."
|
description: "List all audit methods, which can be run individually "\
|
||||||
|
"if provided as arguments."
|
||||||
switch "-D", "--audit-debug",
|
switch "-D", "--audit-debug",
|
||||||
description: "Enable debugging and profiling of audit methods."
|
description: "Enable debugging and profiling of audit methods."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
@ -50,7 +51,7 @@ module Homebrew
|
|||||||
|
|
||||||
first_warning = true
|
first_warning = true
|
||||||
methods.each do |method|
|
methods.each do |method|
|
||||||
$stderr.puts "Checking #{method}" if args.debug?
|
$stderr.puts Formatter.headline("Checking #{method}", color: :magenta) if args.debug?
|
||||||
unless checks.respond_to?(method)
|
unless checks.respond_to?(method)
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
puts "No check available by the name: #{method}"
|
puts "No check available by the name: #{method}"
|
||||||
|
|||||||
@ -49,13 +49,13 @@ module Homebrew
|
|||||||
|
|
||||||
if args.deps?
|
if args.deps?
|
||||||
bucket = []
|
bucket = []
|
||||||
ARGV.formulae.each do |f|
|
Homebrew.args.formulae.each do |f|
|
||||||
bucket << f
|
bucket << f
|
||||||
bucket.concat f.recursive_dependencies.map(&:to_formula)
|
bucket.concat f.recursive_dependencies.map(&:to_formula)
|
||||||
end
|
end
|
||||||
bucket.uniq!
|
bucket.uniq!
|
||||||
else
|
else
|
||||||
bucket = ARGV.formulae
|
bucket = Homebrew.args.formulae
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "Fetching: #{bucket * ", "}" if bucket.size > 1
|
puts "Fetching: #{bucket * ", "}" if bucket.size > 1
|
||||||
|
|||||||
@ -28,6 +28,7 @@ module Homebrew
|
|||||||
"be accessible with its link."
|
"be accessible with its link."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ module Homebrew
|
|||||||
if args.remaining.empty?
|
if args.remaining.empty?
|
||||||
exec_browser HOMEBREW_WWW
|
exec_browser HOMEBREW_WWW
|
||||||
else
|
else
|
||||||
exec_browser(*ARGV.formulae.map(&:homepage))
|
exec_browser(*Homebrew.args.formulae.map(&:homepage))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -61,33 +61,39 @@ module Homebrew
|
|||||||
|
|
||||||
def info
|
def info
|
||||||
info_args.parse
|
info_args.parse
|
||||||
|
|
||||||
if args.days.present?
|
if args.days.present?
|
||||||
raise UsageError, "days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days)
|
raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days)
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.category.present?
|
if args.category.present?
|
||||||
if ARGV.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
|
if Homebrew.args.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category)
|
||||||
raise UsageError, "category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
|
raise UsageError, "--category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae"
|
||||||
end
|
end
|
||||||
|
|
||||||
unless VALID_CATEGORIES.include?(args.category)
|
unless VALID_CATEGORIES.include?(args.category)
|
||||||
raise UsageError, "category must be one of #{VALID_CATEGORIES.join(", ")}"
|
raise UsageError, "--category must be one of #{VALID_CATEGORIES.join(", ")}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
if !(args.all? || args.installed?) && Homebrew.args.named.blank?
|
||||||
|
raise UsageError, "This command's option requires a formula argument"
|
||||||
|
end
|
||||||
|
|
||||||
print_json
|
print_json
|
||||||
elsif args.github?
|
elsif args.github?
|
||||||
exec_browser(*ARGV.formulae.map { |f| github_info(f) })
|
raise UsageError, "This command's option requires a formula argument" if Homebrew.args.named.blank?
|
||||||
|
|
||||||
|
exec_browser(*Homebrew.args.formulae.map { |f| github_info(f) })
|
||||||
else
|
else
|
||||||
print_info
|
print_info
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_info
|
def print_info
|
||||||
if ARGV.named.empty?
|
if Homebrew.args.named.blank?
|
||||||
if args.analytics?
|
if args.analytics?
|
||||||
Utils::Analytics.output
|
Utils::Analytics.output
|
||||||
elsif HOMEBREW_CELLAR.exist?
|
elsif HOMEBREW_CELLAR.exist?
|
||||||
@ -95,7 +101,7 @@ module Homebrew
|
|||||||
puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}"
|
puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ARGV.named.each_with_index do |f, i|
|
Homebrew.args.named.each_with_index do |f, i|
|
||||||
puts unless i.zero?
|
puts unless i.zero?
|
||||||
begin
|
begin
|
||||||
formula = if f.include?("/") || File.exist?(f)
|
formula = if f.include?("/") || File.exist?(f)
|
||||||
@ -129,7 +135,7 @@ module Homebrew
|
|||||||
elsif args.installed?
|
elsif args.installed?
|
||||||
Formula.installed.sort
|
Formula.installed.sort
|
||||||
else
|
else
|
||||||
ARGV.formulae
|
Homebrew.args.formulae
|
||||||
end
|
end
|
||||||
json = ff.map(&:to_hash)
|
json = ff.map(&:to_hash)
|
||||||
puts JSON.generate(json)
|
puts JSON.generate(json)
|
||||||
|
|||||||
@ -92,7 +92,9 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
ARGV.named.each do |name|
|
install_args.parse
|
||||||
|
|
||||||
|
Homebrew.args.named.each do |name|
|
||||||
next if File.exist?(name)
|
next if File.exist?(name)
|
||||||
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
||||||
|
|
||||||
@ -100,7 +102,6 @@ module Homebrew
|
|||||||
tap.install unless tap.installed?
|
tap.install unless tap.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
install_args.parse
|
|
||||||
raise FormulaUnspecifiedError if args.remaining.empty?
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
if args.ignore_dependencies?
|
if args.ignore_dependencies?
|
||||||
@ -130,7 +131,7 @@ module Homebrew
|
|||||||
# developer tools are available, we need to stop them early on
|
# developer tools are available, we need to stop them early on
|
||||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||||
|
|
||||||
ARGV.formulae.each do |f|
|
Homebrew.args.formulae.each do |f|
|
||||||
# head-only without --HEAD is an error
|
# head-only without --HEAD is an error
|
||||||
if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil?
|
if !Homebrew.args.HEAD? && f.stable.nil? && f.devel.nil?
|
||||||
raise <<~EOS
|
raise <<~EOS
|
||||||
|
|||||||
@ -15,6 +15,7 @@ module Homebrew
|
|||||||
List installed formulae that are not dependencies of another installed formula.
|
List installed formulae that are not dependencies of another installed formula.
|
||||||
EOS
|
EOS
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,16 +23,8 @@ module Homebrew
|
|||||||
leaves_args.parse
|
leaves_args.parse
|
||||||
|
|
||||||
installed = Formula.installed.sort
|
installed = Formula.installed.sort
|
||||||
|
deps_of_installed = installed.flat_map(&:runtime_formula_dependencies)
|
||||||
deps_of_installed = installed.flat_map do |f|
|
leaves = installed.map(&:full_name) - deps_of_installed.map(&:full_name)
|
||||||
f.runtime_dependencies.map do |dep|
|
|
||||||
dep.to_formula.full_name
|
|
||||||
rescue FormulaUnavailableError
|
|
||||||
dep.name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
leaves = installed.map(&:full_name) - deps_of_installed
|
|
||||||
leaves.each(&method(:puts))
|
leaves.each(&method(:puts))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -48,7 +48,10 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
keg.name
|
keg.name
|
||||||
end
|
end
|
||||||
puts "To relink: brew unlink #{keg.name} && brew link #{name_and_flag}"
|
puts <<~EOS
|
||||||
|
To relink:
|
||||||
|
brew unlink #{keg.name} && brew link #{name_and_flag}
|
||||||
|
EOS
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -55,14 +55,14 @@ module Homebrew
|
|||||||
# Unbrewed uses the PREFIX, which will exist
|
# Unbrewed uses the PREFIX, which will exist
|
||||||
# Things below use the CELLAR, which doesn't until the first formula is installed.
|
# Things below use the CELLAR, which doesn't until the first formula is installed.
|
||||||
unless HOMEBREW_CELLAR.exist?
|
unless HOMEBREW_CELLAR.exist?
|
||||||
raise NoSuchKegError, ARGV.named.first unless ARGV.named.empty?
|
raise NoSuchKegError, Hombrew.args.named.first if Homebrew.args.named.present?
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.pinned? || args.versions?
|
if args.pinned? || args.versions?
|
||||||
filtered_list
|
filtered_list
|
||||||
elsif ARGV.named.empty?
|
elsif Homebrew.args.named.blank?
|
||||||
if args.full_name?
|
if args.full_name?
|
||||||
full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
|
full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
|
||||||
return if full_names.empty?
|
return if full_names.empty?
|
||||||
@ -123,10 +123,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filtered_list
|
def filtered_list
|
||||||
names = if ARGV.named.empty?
|
names = if Homebrew.args.named.blank?
|
||||||
Formula.racks
|
Formula.racks
|
||||||
else
|
else
|
||||||
racks = ARGV.named.map { |n| Formulary.to_rack(n) }
|
racks = Homebrew.args.named.map { |n| Formulary.to_rack(n) }
|
||||||
racks.select do |rack|
|
racks.select do |rack|
|
||||||
Homebrew.failed = true unless rack.exist?
|
Homebrew.failed = true unless rack.exist?
|
||||||
rack.exist?
|
rack.exist?
|
||||||
|
|||||||
@ -22,6 +22,7 @@ module Homebrew
|
|||||||
description: "Print only one line per commit."
|
description: "Print only one line per commit."
|
||||||
flag "-1", "--max-count",
|
flag "-1", "--max-count",
|
||||||
description: "Print only one or a specified number of commits."
|
description: "Print only one or a specified number of commits."
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ module Homebrew
|
|||||||
def migrate
|
def migrate
|
||||||
migrate_args.parse
|
migrate_args.parse
|
||||||
|
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if Homebrew.args.named.blank?
|
||||||
|
|
||||||
ARGV.resolved_formulae.each do |f|
|
ARGV.resolved_formulae.each do |f|
|
||||||
if f.oldname
|
if f.oldname
|
||||||
|
|||||||
@ -27,9 +27,10 @@ module Homebrew
|
|||||||
|
|
||||||
def missing
|
def missing
|
||||||
missing_args.parse
|
missing_args.parse
|
||||||
|
|
||||||
return unless HOMEBREW_CELLAR.exist?
|
return unless HOMEBREW_CELLAR.exist?
|
||||||
|
|
||||||
ff = if ARGV.named.empty?
|
ff = if Homebrew.args.named.blank?
|
||||||
Formula.installed.sort
|
Formula.installed.sort
|
||||||
else
|
else
|
||||||
ARGV.resolved_formulae.sort
|
ARGV.resolved_formulae.sort
|
||||||
|
|||||||
@ -35,7 +35,7 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
raise FormulaUnspecifiedError if args.remaining.empty?
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
puts_options ARGV.formulae
|
puts_options Homebrew.args.formulae
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ module Homebrew
|
|||||||
def outdated_args
|
def outdated_args
|
||||||
Homebrew::CLI::Parser.new do
|
Homebrew::CLI::Parser.new do
|
||||||
usage_banner <<~EOS
|
usage_banner <<~EOS
|
||||||
`outdated` [<options>]
|
`outdated` [<options>] [<formula>]
|
||||||
|
|
||||||
List installed formulae that have an updated version available. By default, version
|
List installed formulae that have an updated version available. By default, version
|
||||||
information is displayed in interactive shells, and suppressed otherwise.
|
information is displayed in interactive shells, and suppressed otherwise.
|
||||||
@ -41,7 +41,7 @@ module Homebrew
|
|||||||
ARGV.resolved_formulae
|
ARGV.resolved_formulae
|
||||||
end
|
end
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
|
||||||
outdated = print_outdated_json(formulae)
|
outdated = print_outdated_json(formulae)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -23,6 +23,8 @@ module Homebrew
|
|||||||
def postinstall
|
def postinstall
|
||||||
postinstall_args.parse
|
postinstall_args.parse
|
||||||
|
|
||||||
|
raise KegUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
ARGV.resolved_formulae.each do |f|
|
ARGV.resolved_formulae.each do |f|
|
||||||
ohai "Postinstalling #{f}"
|
ohai "Postinstalling #{f}"
|
||||||
fi = FormulaInstaller.new(f)
|
fi = FormulaInstaller.new(f)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ module Homebrew
|
|||||||
Import all formulae from the specified <tap>, or from all installed taps if none is provided.
|
Import all formulae from the specified <tap>, or from all installed taps if none is provided.
|
||||||
This can be useful for debugging issues across all formulae when making
|
This can be useful for debugging issues across all formulae when making
|
||||||
significant changes to `formula.rb`, testing the performance of loading
|
significant changes to `formula.rb`, testing the performance of loading
|
||||||
all formulae or to determine if any current formulae have Ruby issues.
|
all formulae or checking if any current formulae have Ruby issues.
|
||||||
EOS
|
EOS
|
||||||
switch "--aliases",
|
switch "--aliases",
|
||||||
description: "Verify any alias symlinks in each tap."
|
description: "Verify any alias symlinks in each tap."
|
||||||
|
|||||||
@ -47,6 +47,8 @@ module Homebrew
|
|||||||
def reinstall
|
def reinstall
|
||||||
reinstall_args.parse
|
reinstall_args.parse
|
||||||
|
|
||||||
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed?
|
||||||
|
|
||||||
Install.perform_preinstall_checks
|
Install.perform_preinstall_checks
|
||||||
|
|||||||
@ -22,11 +22,13 @@ module Homebrew
|
|||||||
description: "Use the standard `PATH` instead of superenv's when `std` is passed."
|
description: "Use the standard `PATH` instead of superenv's when `std` is passed."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def sh
|
def sh
|
||||||
sh_args.parse
|
sh_args.parse
|
||||||
|
|
||||||
ENV.activate_extensions!
|
ENV.activate_extensions!
|
||||||
|
|
||||||
if superenv?
|
if superenv?
|
||||||
|
|||||||
@ -38,14 +38,14 @@ module Homebrew
|
|||||||
def style
|
def style
|
||||||
style_args.parse
|
style_args.parse
|
||||||
|
|
||||||
target = if ARGV.named.empty?
|
target = if Homebrew.args.named.blank?
|
||||||
nil
|
nil
|
||||||
elsif ARGV.named.any? { |file| File.exist? file }
|
elsif Homebrew.args.named.any? { |file| File.exist? file }
|
||||||
ARGV.named
|
Homebrew.args.named
|
||||||
elsif ARGV.named.any? { |tap| tap.count("/") == 1 }
|
elsif Homebrew.args.named.any? { |tap| tap.count("/") == 1 }
|
||||||
ARGV.named.map { |tap| Tap.fetch(tap).path }
|
Homebrew.args.named.map { |tap| Tap.fetch(tap).path }
|
||||||
else
|
else
|
||||||
ARGV.formulae.map(&:path)
|
Homebrew.args.formulae.map(&:path)
|
||||||
end
|
end
|
||||||
|
|
||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
|
|||||||
@ -14,46 +14,33 @@ module Homebrew
|
|||||||
|
|
||||||
Symlink all of the specified <version> of <formula>'s installation into Homebrew's prefix.
|
Symlink all of the specified <version> of <formula>'s installation into Homebrew's prefix.
|
||||||
EOS
|
EOS
|
||||||
switch_option :verbose
|
switch :verbose
|
||||||
switch_option :debug
|
switch :debug
|
||||||
|
max_named 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def switch
|
def switch
|
||||||
switch_args.parse
|
switch_args.parse
|
||||||
|
|
||||||
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
name = args.remaining.first
|
name = args.remaining.first
|
||||||
|
|
||||||
usage = "Usage: brew switch <formula> <version>"
|
|
||||||
|
|
||||||
unless name
|
|
||||||
onoe usage
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
rack = Formulary.to_rack(name)
|
rack = Formulary.to_rack(name)
|
||||||
|
|
||||||
unless rack.directory?
|
odie "#{name} not found in the Cellar." unless rack.directory?
|
||||||
onoe "#{name} not found in the Cellar."
|
|
||||||
exit 2
|
|
||||||
end
|
|
||||||
|
|
||||||
versions = rack.subdirs
|
versions = rack.subdirs
|
||||||
.map { |d| Keg.new(d).version }
|
.map { |d| Keg.new(d).version }
|
||||||
.sort
|
.sort
|
||||||
.join(", ")
|
.join(", ")
|
||||||
version = args.remaining.second
|
version = args.remaining.second
|
||||||
|
raise UsageError, "Specify one of #{name}'s installed versions: #{versions}" unless version
|
||||||
|
|
||||||
if !version || args.remaining.length > 2
|
odie <<~EOS unless (rack/version).directory?
|
||||||
onoe usage
|
#{name} does not have a version \"#{version}\" in the Cellar.
|
||||||
puts "#{name} installed versions: #{versions}"
|
#{name}'s installed versions: #{versions}
|
||||||
exit 1
|
EOS
|
||||||
end
|
|
||||||
|
|
||||||
unless (rack/version).directory?
|
|
||||||
onoe "#{name} does not have a version \"#{version}\" in the Cellar."
|
|
||||||
puts "#{name} installed versions: #{versions}"
|
|
||||||
exit 3
|
|
||||||
end
|
|
||||||
|
|
||||||
# Unlink all existing versions
|
# Unlink all existing versions
|
||||||
rack.subdirs.each do |v|
|
rack.subdirs.each do |v|
|
||||||
|
|||||||
@ -30,13 +30,13 @@ module Homebrew
|
|||||||
if args.installed?
|
if args.installed?
|
||||||
taps = Tap
|
taps = Tap
|
||||||
else
|
else
|
||||||
taps = ARGV.named.sort.map do |name|
|
taps = Homebrew.args.named.sort.map do |name|
|
||||||
Tap.fetch(name)
|
Tap.fetch(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.json
|
if args.json
|
||||||
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
|
||||||
|
|
||||||
print_tap_json(taps.sort_by(&:to_s))
|
print_tap_json(taps.sort_by(&:to_s))
|
||||||
else
|
else
|
||||||
|
|||||||
@ -38,6 +38,7 @@ module Homebrew
|
|||||||
switch "-q", "--quieter",
|
switch "-q", "--quieter",
|
||||||
description: "Suppress any warnings."
|
description: "Suppress any warnings."
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ module Homebrew
|
|||||||
if rack.directory?
|
if rack.directory?
|
||||||
versions = rack.subdirs.map(&:basename)
|
versions = rack.subdirs.map(&:basename)
|
||||||
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
|
puts "#{keg.name} #{versions.to_sentence} #{"is".pluralize(versions.count)} still installed."
|
||||||
puts "Remove all versions with `brew uninstall --force #{keg.name}`."
|
puts "Run `brew uninstall --force #{keg.name}` to remove all versions."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -87,7 +87,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
rescue MultipleVersionsInstalledError => e
|
rescue MultipleVersionsInstalledError => e
|
||||||
ofail e
|
ofail e
|
||||||
puts "Use `brew uninstall --force #{e.name}` to remove all versions."
|
puts "Run `brew uninstall --force #{e.name}` to remove all versions."
|
||||||
ensure
|
ensure
|
||||||
# If we delete Cellar/newname, then Cellar/oldname symlink
|
# If we delete Cellar/newname, then Cellar/oldname symlink
|
||||||
# can become broken and we have to remove it.
|
# can become broken and we have to remove it.
|
||||||
|
|||||||
@ -32,7 +32,7 @@ module Homebrew
|
|||||||
def unpack
|
def unpack
|
||||||
unpack_args.parse
|
unpack_args.parse
|
||||||
|
|
||||||
formulae = ARGV.formulae
|
formulae = Homebrew.args.formulae
|
||||||
raise FormulaUnspecifiedError if formulae.empty?
|
raise FormulaUnspecifiedError if formulae.empty?
|
||||||
|
|
||||||
if dir = args.destdir
|
if dir = args.destdir
|
||||||
|
|||||||
@ -19,11 +19,11 @@ module Homebrew
|
|||||||
def untap
|
def untap
|
||||||
untap_args.parse
|
untap_args.parse
|
||||||
|
|
||||||
raise "Usage is `brew untap <tap-name>`" if args.remaining.empty?
|
raise UsageError, "This command requires a tap argument from `brew tap`'s list" if args.remaining.empty?
|
||||||
|
|
||||||
ARGV.named.each do |tapname|
|
ARGV.named.each do |tapname|
|
||||||
tap = Tap.fetch(tapname)
|
tap = Tap.fetch(tapname)
|
||||||
raise "untapping #{tap} is not allowed" if tap.core_tap?
|
odie "Untapping #{tap} is not allowed" if tap.core_tap?
|
||||||
|
|
||||||
tap.uninstall
|
tap.uninstall
|
||||||
end
|
end
|
||||||
|
|||||||
@ -306,7 +306,7 @@ homebrew-update() {
|
|||||||
*)
|
*)
|
||||||
odie <<EOS
|
odie <<EOS
|
||||||
This command updates brew itself, and does not take formula names.
|
This command updates brew itself, and does not take formula names.
|
||||||
Use 'brew upgrade $@' instead.
|
Use \`brew upgrade $@\` instead.
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -521,7 +521,7 @@ EOS
|
|||||||
if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]
|
if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]
|
||||||
then
|
then
|
||||||
TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"
|
TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"
|
||||||
echo "$TAP does not exist! Run 'brew untap $TAP'" >>"$update_failed_file"
|
echo "$TAP does not exist! Run \`brew untap $TAP\` to remove it." >>"$update_failed_file"
|
||||||
else
|
else
|
||||||
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
echo "Fetching $DIR failed!" >>"$update_failed_file"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -61,7 +61,7 @@ module Homebrew
|
|||||||
|
|
||||||
Install.perform_preinstall_checks
|
Install.perform_preinstall_checks
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if Homebrew.args.named.blank?
|
||||||
outdated = Formula.installed.select do |f|
|
outdated = Formula.installed.select do |f|
|
||||||
f.outdated?(fetch_head: args.fetch_HEAD?)
|
f.outdated?(fetch_head: args.fetch_HEAD?)
|
||||||
end
|
end
|
||||||
@ -170,7 +170,7 @@ module Homebrew
|
|||||||
fi = FormulaInstaller.new(f)
|
fi = FormulaInstaller.new(f)
|
||||||
fi.options = options
|
fi.options = options
|
||||||
fi.build_bottle = args.build_bottle?
|
fi.build_bottle = args.build_bottle?
|
||||||
fi.installed_on_request = !ARGV.named.empty?
|
fi.installed_on_request = Homebrew.args.named.present?
|
||||||
fi.link_keg ||= keg_was_linked if keg_had_linked_opt
|
fi.link_keg ||= keg_was_linked if keg_had_linked_opt
|
||||||
if tab
|
if tab
|
||||||
fi.build_bottle ||= tab.built_bottle?
|
fi.build_bottle ||= tab.built_bottle?
|
||||||
@ -239,9 +239,9 @@ module Homebrew
|
|||||||
if pinned_dependents.present?
|
if pinned_dependents.present?
|
||||||
plural = "dependent".pluralize(pinned_dependents.count)
|
plural = "dependent".pluralize(pinned_dependents.count)
|
||||||
ohai "Not upgrading #{pinned_dependents.count} pinned #{plural}:"
|
ohai "Not upgrading #{pinned_dependents.count} pinned #{plural}:"
|
||||||
puts pinned_dependents.map do |f|
|
puts(pinned_dependents.map do |f|
|
||||||
"#{f.full_specified_name} #{f.pkg_version}"
|
"#{f.full_specified_name} #{f.pkg_version}"
|
||||||
end.join(", ")
|
end.join(", "))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print the upgradable dependents.
|
# Print the upgradable dependents.
|
||||||
@ -292,9 +292,9 @@ module Homebrew
|
|||||||
count = pinned_broken_dependents.count
|
count = pinned_broken_dependents.count
|
||||||
plural = "dependent".pluralize(pinned_broken_dependents.count)
|
plural = "dependent".pluralize(pinned_broken_dependents.count)
|
||||||
onoe "Not reinstalling #{count} broken and outdated, but pinned #{plural}:"
|
onoe "Not reinstalling #{count} broken and outdated, but pinned #{plural}:"
|
||||||
$stderr.puts pinned_broken_dependents.map do |f|
|
$stderr.puts(pinned_broken_dependents.map do |f|
|
||||||
"#{f.full_specified_name} #{f.pkg_version}"
|
"#{f.full_specified_name} #{f.pkg_version}"
|
||||||
end.join(", ")
|
end.join(", "))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print the broken dependents.
|
# Print the broken dependents.
|
||||||
|
|||||||
@ -50,12 +50,12 @@ module Homebrew
|
|||||||
|
|
||||||
used_formulae_missing = false
|
used_formulae_missing = false
|
||||||
used_formulae = begin
|
used_formulae = begin
|
||||||
ARGV.formulae
|
Homebrew.args.formulae
|
||||||
rescue FormulaUnavailableError => e
|
rescue FormulaUnavailableError => e
|
||||||
opoo e
|
opoo e
|
||||||
used_formulae_missing = true
|
used_formulae_missing = true
|
||||||
# If the formula doesn't exist: fake the needed formula object name.
|
# If the formula doesn't exist: fake the needed formula object name.
|
||||||
ARGV.named.map { |name| OpenStruct.new name: name, full_name: name }
|
Homebrew.args.named.map { |name| OpenStruct.new name: name, full_name: name }
|
||||||
end
|
end
|
||||||
|
|
||||||
use_runtime_dependents = args.installed? &&
|
use_runtime_dependents = args.installed? &&
|
||||||
|
|||||||
@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
require "compat/cask/dsl/version"
|
require "compat/cask/dsl/version"
|
||||||
require "compat/requirements/macos_requirement"
|
require "compat/requirements/macos_requirement"
|
||||||
|
require "compat/formula"
|
||||||
|
|||||||
13
Library/Homebrew/compat/formula.rb
Normal file
13
Library/Homebrew/compat/formula.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Formula
|
||||||
|
module Compat
|
||||||
|
def installed?
|
||||||
|
# odeprecated "Formula#installed?",
|
||||||
|
# "Formula#latest_version_installed? (or Formula#any_version_installed? )"
|
||||||
|
latest_version_installed?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
|
end
|
||||||
@ -98,19 +98,21 @@ module Homebrew
|
|||||||
formula.send("recursive_#{type}") do |dependent, dep|
|
formula.send("recursive_#{type}") do |dependent, dep|
|
||||||
if dep.recommended?
|
if dep.recommended?
|
||||||
klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
||||||
|
elsif dep.optional?
|
||||||
|
klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
||||||
elsif dep.test?
|
elsif dep.test?
|
||||||
if includes.include?("test?")
|
if includes.include?("test?")
|
||||||
Dependency.keep_but_prune_recursive_deps if type == :dependencies
|
Dependency.keep_but_prune_recursive_deps if type == :dependencies
|
||||||
|
elsif dep.build?
|
||||||
|
klass.prune unless includes.include?("build?")
|
||||||
else
|
else
|
||||||
klass.prune
|
klass.prune
|
||||||
end
|
end
|
||||||
elsif dep.optional?
|
|
||||||
klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
|
|
||||||
elsif dep.build?
|
elsif dep.build?
|
||||||
klass.prune unless includes.include?("build?")
|
klass.prune unless includes.include?("build?")
|
||||||
end
|
end
|
||||||
|
|
||||||
# If a tap isn't installed, we can't find the dependencies of one
|
# If a tap isn't installed, we can't find the dependencies of one of
|
||||||
# its formulae, and an exception will be thrown if we try.
|
# its formulae, and an exception will be thrown if we try.
|
||||||
if type == :dependencies &&
|
if type == :dependencies &&
|
||||||
dep.is_a?(TapDependency) &&
|
dep.is_a?(TapDependency) &&
|
||||||
|
|||||||
@ -39,7 +39,9 @@ class Dependency
|
|||||||
formula
|
formula
|
||||||
end
|
end
|
||||||
|
|
||||||
delegate installed?: :to_formula
|
def installed?
|
||||||
|
to_formula.latest_version_installed?
|
||||||
|
end
|
||||||
|
|
||||||
def satisfied?(inherited_options)
|
def satisfied?(inherited_options)
|
||||||
installed? && missing_options(inherited_options).empty?
|
installed? && missing_options(inherited_options).empty?
|
||||||
|
|||||||
@ -57,7 +57,8 @@ module Homebrew
|
|||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
conflicts "--only", "--except"
|
conflicts "--only", "--except"
|
||||||
conflicts "--only-cops", "--except-cops"
|
conflicts "--only-cops", "--except-cops", "--strict"
|
||||||
|
conflicts "--only-cops", "--except-cops", "--only"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ module Homebrew
|
|||||||
ENV.activate_extensions!
|
ENV.activate_extensions!
|
||||||
ENV.setup_build_environment
|
ENV.setup_build_environment
|
||||||
|
|
||||||
if ARGV.named.empty?
|
if Homebrew.args.named.blank?
|
||||||
ff = Formula
|
ff = Formula
|
||||||
files = Tap.map(&:formula_dir)
|
files = Tap.map(&:formula_dir)
|
||||||
else
|
else
|
||||||
@ -88,13 +89,6 @@ module Homebrew
|
|||||||
|
|
||||||
only_cops = args.only_cops
|
only_cops = args.only_cops
|
||||||
except_cops = args.except_cops
|
except_cops = args.except_cops
|
||||||
|
|
||||||
if only_cops && except_cops
|
|
||||||
odie "--only-cops and --except-cops cannot be used simultaneously!"
|
|
||||||
elsif (only_cops || except_cops) && (strict || args.only)
|
|
||||||
odie "--only-cops/--except-cops and --strict/--only cannot be used simultaneously!"
|
|
||||||
end
|
|
||||||
|
|
||||||
options = { fix: args.fix? }
|
options = { fix: args.fix? }
|
||||||
|
|
||||||
if only_cops
|
if only_cops
|
||||||
@ -995,7 +989,6 @@ module Homebrew
|
|||||||
def audit
|
def audit
|
||||||
only_audits = @only
|
only_audits = @only
|
||||||
except_audits = @except
|
except_audits = @except
|
||||||
odie "--only and --except cannot be used simultaneously!" if only_audits && except_audits
|
|
||||||
|
|
||||||
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
|
methods.map(&:to_s).grep(/^audit_/).each do |audit_method_name|
|
||||||
name = audit_method_name.gsub(/^audit_/, "")
|
name = audit_method_name.gsub(/^audit_/, "")
|
||||||
|
|||||||
@ -86,6 +86,7 @@ module Homebrew
|
|||||||
bottle_args.parse
|
bottle_args.parse
|
||||||
|
|
||||||
return merge if args.merge?
|
return merge if args.merge?
|
||||||
|
raise KegUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
ensure_relocation_formulae_installed! unless args.skip_relocation?
|
ensure_relocation_formulae_installed! unless args.skip_relocation?
|
||||||
ARGV.resolved_formulae.each do |f|
|
ARGV.resolved_formulae.each do |f|
|
||||||
@ -95,7 +96,7 @@ module Homebrew
|
|||||||
|
|
||||||
def ensure_relocation_formulae_installed!
|
def ensure_relocation_formulae_installed!
|
||||||
Keg.relocation_formulae.each do |f|
|
Keg.relocation_formulae.each do |f|
|
||||||
next if Formula[f].installed?
|
next if Formula[f].latest_version_installed?
|
||||||
|
|
||||||
ohai "Installing #{f}..."
|
ohai "Installing #{f}..."
|
||||||
safe_system HOMEBREW_BREW_FILE, "install", f
|
safe_system HOMEBREW_BREW_FILE, "install", f
|
||||||
@ -172,7 +173,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if text_matches.size > MAXIMUM_STRING_MATCHES
|
if text_matches.size > MAXIMUM_STRING_MATCHES
|
||||||
puts "Only the first #{MAXIMUM_STRING_MATCHES} matches were output"
|
puts "Only the first #{MAXIMUM_STRING_MATCHES} matches were output."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def bottle_formula(f)
|
def bottle_formula(f)
|
||||||
return ofail "Formula not installed or up-to-date: #{f.full_name}" unless f.installed?
|
return ofail "Formula not installed or up-to-date: #{f.full_name}" unless f.latest_version_installed?
|
||||||
|
|
||||||
unless tap = f.tap
|
unless tap = f.tap
|
||||||
return ofail "Formula not from core or any installed taps: #{f.full_name}" unless args.force_core_tap?
|
return ofail "Formula not from core or any installed taps: #{f.full_name}" unless args.force_core_tap?
|
||||||
@ -219,7 +220,7 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
return ofail "Formula not installed with '--build-bottle': #{f.full_name}" unless Utils::Bottles.built_as? f
|
return ofail "Formula was not installed with --build-bottle: #{f.full_name}" unless Utils::Bottles.built_as? f
|
||||||
|
|
||||||
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
||||||
|
|
||||||
@ -426,8 +427,9 @@ module Homebrew
|
|||||||
|
|
||||||
def merge
|
def merge
|
||||||
write = args.write?
|
write = args.write?
|
||||||
|
raise UsageError, "--merge requires a JSON file path argument" if Homebrew.args.named.blank?
|
||||||
|
|
||||||
bottles_hash = ARGV.named.reduce({}) do |hash, json_file|
|
bottles_hash = Homebrew.args.named.reduce({}) do |hash, json_file|
|
||||||
hash.deep_merge(JSON.parse(IO.read(json_file)))
|
hash.deep_merge(JSON.parse(IO.read(json_file)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,7 @@ module Homebrew
|
|||||||
switch :debug
|
switch :debug
|
||||||
conflicts "--no-audit", "--strict"
|
conflicts "--no-audit", "--strict"
|
||||||
conflicts "--url", "--tag"
|
conflicts "--url", "--tag"
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
[formula.tap.full_name, "origin/master", "-"]
|
[formula.tap&.full_name, "origin/master", "-"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def bump_formula_pr
|
def bump_formula_pr
|
||||||
@ -114,7 +115,7 @@ module Homebrew
|
|||||||
# Use the user's browser, too.
|
# Use the user's browser, too.
|
||||||
ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"]
|
ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"]
|
||||||
|
|
||||||
formula = ARGV.formulae.first
|
formula = Homebrew.args.formulae.first
|
||||||
|
|
||||||
if formula
|
if formula
|
||||||
tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula)
|
tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula)
|
||||||
@ -504,6 +505,6 @@ module Homebrew
|
|||||||
|
|
||||||
formula.path.atomic_write(backup_file)
|
formula.path.atomic_write(backup_file)
|
||||||
FileUtils.mv alias_rename.last, alias_rename.first if alias_rename.present?
|
FileUtils.mv alias_rename.last, alias_rename.first if alias_rename.present?
|
||||||
odie "brew audit failed!"
|
odie "`brew audit` failed!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -22,6 +22,7 @@ module Homebrew
|
|||||||
switch :quiet
|
switch :quiet
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,10 +33,10 @@ module Homebrew
|
|||||||
# user path, too.
|
# user path, too.
|
||||||
ENV["PATH"] = ENV["HOMEBREW_PATH"]
|
ENV["PATH"] = ENV["HOMEBREW_PATH"]
|
||||||
|
|
||||||
raise FormulaUnspecifiedError if ARGV.formulae.empty?
|
formulae = Homebrew.args.formulae
|
||||||
raise "Multiple formulae given, only one is allowed." if ARGV.formulae.length > 1
|
raise FormulaUnspecifiedError if formulae.empty?
|
||||||
|
|
||||||
formula = ARGV.formulae.first
|
formula = formulae.first
|
||||||
current_revision = formula.revision
|
current_revision = formula.revision
|
||||||
|
|
||||||
if current_revision.zero?
|
if current_revision.zero?
|
||||||
|
|||||||
@ -49,6 +49,7 @@ module Homebrew
|
|||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
conflicts "--autotools", "--cmake", "--go", "--meson", "--perl", "--python", "--rust"
|
conflicts "--autotools", "--cmake", "--go", "--meson", "--perl", "--python", "--rust"
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ module Homebrew
|
|||||||
|
|
||||||
fc.generate!
|
fc.generate!
|
||||||
|
|
||||||
puts "Please `brew audit --new-formula #{fc.name}` before submitting, thanks."
|
puts "Please run `brew audit --new-formula #{fc.name}` before submitting, thanks."
|
||||||
exec_editor fc.path
|
exec_editor fc.path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,7 @@ module Homebrew
|
|||||||
description: "Extract the specified <version> of <formula> instead of the most recent."
|
description: "Extract the specified <version> of <formula> instead of the most recent."
|
||||||
switch :force
|
switch :force
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ module Homebrew
|
|||||||
extract_args.parse
|
extract_args.parse
|
||||||
|
|
||||||
# Expect exactly two named arguments: formula and tap
|
# Expect exactly two named arguments: formula and tap
|
||||||
raise UsageError if args.remaining.length != 2
|
raise UsageError, "This command requires formula and tap arguments" if args.remaining.length != 2
|
||||||
|
|
||||||
if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX
|
if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX
|
||||||
name = args.remaining.first.downcase
|
name = args.remaining.first.downcase
|
||||||
@ -125,24 +126,34 @@ module Homebrew
|
|||||||
if args.version
|
if args.version
|
||||||
ohai "Searching repository history"
|
ohai "Searching repository history"
|
||||||
version = args.version
|
version = args.version
|
||||||
rev = "HEAD"
|
version_segments = Gem::Version.new(version).segments if Gem::Version.correct?(version)
|
||||||
|
rev = nil
|
||||||
test_formula = nil
|
test_formula = nil
|
||||||
result = ""
|
result = ""
|
||||||
loop do
|
loop do
|
||||||
rev, (path,) = Git.last_revision_commit_of_files(repo, pattern, before_commit: "#{rev}~1")
|
rev = rev.nil? ? "HEAD" : "#{rev}~1"
|
||||||
|
rev, (path,) = Git.last_revision_commit_of_files(repo, pattern, before_commit: rev)
|
||||||
odie "Could not find #{name}! The formula or version may not have existed." if rev.nil?
|
odie "Could not find #{name}! The formula or version may not have existed." if rev.nil?
|
||||||
|
|
||||||
file = repo/path
|
file = repo/path
|
||||||
result = Git.last_revision_of_file(repo, file, before_commit: rev)
|
result = Git.last_revision_of_file(repo, file, before_commit: rev)
|
||||||
if result.empty?
|
if result.empty?
|
||||||
ohai "Skipping revision #{rev} - file is empty at this revision" if ARGV.debug?
|
odebug "Skipping revision #{rev} - file is empty at this revision"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
test_formula = formula_at_revision(repo, name, file, rev)
|
test_formula = formula_at_revision(repo, name, file, rev)
|
||||||
break if test_formula.nil? || test_formula.version == version
|
break if test_formula.nil? || test_formula.version == version
|
||||||
|
|
||||||
ohai "Trying #{test_formula.version} from revision #{rev} against desired #{version}" if ARGV.debug?
|
if version_segments && Gem::Version.correct?(test_formula.version)
|
||||||
|
test_formula_version_segments = Gem::Version.new(test_formula.version).segments
|
||||||
|
if version_segments.length < test_formula_version_segments.length
|
||||||
|
odebug "Apply semantic versioning with #{test_formual_version_segments}"
|
||||||
|
break if version_segments == test_formula_version_segments.first(version_segments.length)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
odebug "Trying #{test_formula.version} from revision #{rev} against desired #{version}"
|
||||||
end
|
end
|
||||||
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
|
odie "Could not find #{name}! The formula or version may not have existed." if test_formula.nil?
|
||||||
else
|
else
|
||||||
@ -181,7 +192,7 @@ module Homebrew
|
|||||||
brew extract --force --version=#{version} #{name} #{destination_tap.name}
|
brew extract --force --version=#{version} #{name} #{destination_tap.name}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
ohai "Overwriting existing formula at #{path}" if ARGV.debug?
|
odebug "Overwriting existing formula at #{path}"
|
||||||
path.delete
|
path.delete
|
||||||
end
|
end
|
||||||
ohai "Writing formula for #{name} from revision #{rev} to #{path}"
|
ohai "Writing formula for #{name} from revision #{rev} to #{path}"
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Homebrew
|
|||||||
def formula
|
def formula
|
||||||
formula_args.parse
|
formula_args.parse
|
||||||
|
|
||||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
raise FormulaUnspecifiedError if Homebrew.args.named.blank?
|
||||||
|
|
||||||
ARGV.resolved_formulae.each { |f| puts f.path }
|
ARGV.resolved_formulae.each { |f| puts f.path }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -14,6 +14,7 @@ module Homebrew
|
|||||||
Install Homebrew's Bundler gems.
|
Install Homebrew's Bundler gems.
|
||||||
EOS
|
EOS
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ require "erb"
|
|||||||
require "ostruct"
|
require "ostruct"
|
||||||
require "cli/parser"
|
require "cli/parser"
|
||||||
# Require all commands
|
# Require all commands
|
||||||
Dir.glob("#{HOMEBREW_LIBRARY_PATH}/{dev-,}cmd/*.rb").each { |cmd| require cmd }
|
Dir.glob("#{HOMEBREW_LIBRARY_PATH}/{dev-,}cmd/*.rb").sort.each { |cmd| require cmd }
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
@ -28,14 +28,13 @@ module Homebrew
|
|||||||
"comparison without factoring in the date)."
|
"comparison without factoring in the date)."
|
||||||
switch "--link",
|
switch "--link",
|
||||||
description: "This is now done automatically by `brew update`."
|
description: "This is now done automatically by `brew update`."
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def man
|
def man
|
||||||
man_args.parse
|
man_args.parse
|
||||||
|
|
||||||
raise UsageError unless ARGV.named.empty?
|
|
||||||
|
|
||||||
odie "`brew man --link` is now done automatically by `brew update`." if args.link?
|
odie "`brew man --link` is now done automatically by `brew update`." if args.link?
|
||||||
|
|
||||||
regenerate_man_pages
|
regenerate_man_pages
|
||||||
|
|||||||
@ -21,13 +21,13 @@ module Homebrew
|
|||||||
def mirror
|
def mirror
|
||||||
mirror_args.parse
|
mirror_args.parse
|
||||||
|
|
||||||
odie "This command requires at least one formula argument!" if ARGV.named.empty?
|
raise FormulaUnspecifiedError if args.remaining.empty?
|
||||||
|
|
||||||
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
||||||
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||||
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key
|
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key
|
||||||
|
|
||||||
ARGV.formulae.each do |f|
|
Homebrew.args.formulae.each do |f|
|
||||||
bintray_package = Utils::Bottles::Bintray.package f.name
|
bintray_package = Utils::Bottles::Bintray.package f.name
|
||||||
bintray_repo_url = "https://api.bintray.com/packages/homebrew/mirror"
|
bintray_repo_url = "https://api.bintray.com/packages/homebrew/mirror"
|
||||||
package_url = "#{bintray_repo_url}/#{bintray_package}"
|
package_url = "#{bintray_repo_url}/#{bintray_package}"
|
||||||
|
|||||||
@ -70,7 +70,9 @@ module Homebrew
|
|||||||
|
|
||||||
pull_args.parse
|
pull_args.parse
|
||||||
|
|
||||||
odie "This command requires at least one argument containing a URL or pull request number" if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
|
raise UsageError, "This command requires at least one argument containing a URL or pull request number"
|
||||||
|
end
|
||||||
|
|
||||||
# Passthrough Git environment variables for e.g. git am
|
# Passthrough Git environment variables for e.g. git am
|
||||||
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
|
||||||
@ -107,7 +109,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
_, testing_job = *testing_match
|
_, testing_job = *testing_match
|
||||||
url = "https://github.com/Homebrew/homebrew-#{tap.repo}/compare/master...BrewTestBot:testing-#{testing_job}"
|
url = "https://github.com/Homebrew/homebrew-#{tap.repo}/compare/master...BrewTestBot:testing-#{testing_job}"
|
||||||
odie "Testing URLs require `--bottle`!" unless args.bottle?
|
odie "--bottle is required for testing job URLs!" unless args.bottle?
|
||||||
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||||
_, user, repo, issue = *api_match
|
_, user, repo, issue = *api_match
|
||||||
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||||
@ -277,7 +279,7 @@ module Homebrew
|
|||||||
elsif patch_changes[:formulae].length > 1
|
elsif patch_changes[:formulae].length > 1
|
||||||
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
odie "Can only bump one changed formula; bumped #{patch_changes[:formulae]}"
|
||||||
elsif !patch_changes[:others].empty?
|
elsif !patch_changes[:others].empty?
|
||||||
odie "Can not bump if non-formula files are changed"
|
odie "Cannot bump if non-formula files are changed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
switch "--markdown",
|
switch "--markdown",
|
||||||
description: "Print as a Markdown list."
|
description: "Print as a Markdown list."
|
||||||
|
max_named 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -15,13 +15,14 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def tap_new
|
def tap_new
|
||||||
tap_new_args.parse
|
tap_new_args.parse
|
||||||
|
|
||||||
raise "A tap argument is required" if ARGV.named.empty?
|
raise UsageError, "This command requires a tap argument" if ARGV.named.empty?
|
||||||
|
|
||||||
tap = Tap.fetch(ARGV.named.first)
|
tap = Tap.fetch(ARGV.named.first)
|
||||||
titleized_user = tap.user.dup
|
titleized_user = tap.user.dup
|
||||||
|
|||||||
@ -40,7 +40,7 @@ module Homebrew
|
|||||||
|
|
||||||
ARGV.resolved_formulae.each do |f|
|
ARGV.resolved_formulae.each do |f|
|
||||||
# Cannot test uninstalled formulae
|
# Cannot test uninstalled formulae
|
||||||
unless f.installed?
|
unless f.latest_version_installed?
|
||||||
ofail "Testing requires the latest version of #{f.full_name}"
|
ofail "Testing requires the latest version of #{f.full_name}"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
@ -29,6 +29,7 @@ module Homebrew
|
|||||||
description: "Randomise tests with the specified <value> instead of a random seed."
|
description: "Randomise tests with the specified <value> instead of a random seed."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,7 @@ module Homebrew
|
|||||||
description: "Use the commit at the specified <date> as the start commit."
|
description: "Use the commit at the specified <date> as the start commit."
|
||||||
switch :verbose
|
switch :verbose
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ module Homebrew
|
|||||||
chdir "update-test" do
|
chdir "update-test" do
|
||||||
curdir = Pathname.new(Dir.pwd)
|
curdir = Pathname.new(Dir.pwd)
|
||||||
|
|
||||||
oh1 "Setup test environment..."
|
oh1 "Preparing test environment..."
|
||||||
# copy Homebrew installation
|
# copy Homebrew installation
|
||||||
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
||||||
"--branch", "master", "--single-branch"
|
"--branch", "master", "--single-branch"
|
||||||
|
|||||||
@ -14,6 +14,7 @@ module Homebrew
|
|||||||
Install and commit Homebrew's vendored gems.
|
Install and commit Homebrew's vendored gems.
|
||||||
EOS
|
EOS
|
||||||
switch :debug
|
switch :debug
|
||||||
|
max_named 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ module Homebrew
|
|||||||
ohai "git add vendor/bundle"
|
ohai "git add vendor/bundle"
|
||||||
system "git", "add", "vendor/bundle"
|
system "git", "add", "vendor/bundle"
|
||||||
|
|
||||||
if Formula["gpg"].installed?
|
if Formula["gpg"].optlinked?
|
||||||
ENV["PATH"] = PATH.new(ENV["PATH"])
|
ENV["PATH"] = PATH.new(ENV["PATH"])
|
||||||
.prepend(Formula["gpg"].opt_bin)
|
.prepend(Formula["gpg"].opt_bin)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1122,7 +1122,7 @@ class DownloadStrategyDetector
|
|||||||
when :post then CurlPostDownloadStrategy
|
when :post then CurlPostDownloadStrategy
|
||||||
when :fossil then FossilDownloadStrategy
|
when :fossil then FossilDownloadStrategy
|
||||||
else
|
else
|
||||||
raise "Unknown download strategy #{symbol} was requested."
|
raise TypeError, "Unknown download strategy #{symbol} was requested."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class LinkageChecker
|
|||||||
libpthread.so.0
|
libpthread.so.0
|
||||||
libresolv.so.2
|
libresolv.so.2
|
||||||
librt.so.1
|
librt.so.1
|
||||||
|
libthread_db.so.1
|
||||||
libutil.so.1
|
libutil.so.1
|
||||||
|
|
||||||
libgcc_s.so.1
|
libgcc_s.so.1
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class OsxfuseRequirement < Requirement
|
|||||||
download "https://github.com/libfuse/libfuse"
|
download "https://github.com/libfuse/libfuse"
|
||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
next true if libfuse_formula_exists? && Formula["libfuse"].installed?
|
next true if libfuse_formula_exists? && Formula["libfuse"].latest_version_installed?
|
||||||
|
|
||||||
includedirs = %w[
|
includedirs = %w[
|
||||||
/usr/include
|
/usr/include
|
||||||
|
|||||||
@ -3,30 +3,8 @@
|
|||||||
class SoftwareSpec
|
class SoftwareSpec
|
||||||
undef uses_from_macos
|
undef uses_from_macos
|
||||||
|
|
||||||
def uses_from_macos(deps, **args)
|
def uses_from_macos(deps)
|
||||||
@uses_from_macos_elements ||= []
|
@uses_from_macos_elements ||= []
|
||||||
|
|
||||||
if deps.is_a?(Hash)
|
|
||||||
args = deps
|
|
||||||
deps = Hash[*args.shift]
|
|
||||||
end
|
|
||||||
|
|
||||||
if add_mac_dependency?(args)
|
|
||||||
depends_on(deps)
|
|
||||||
else
|
|
||||||
@uses_from_macos_elements << deps
|
@uses_from_macos_elements << deps
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def add_mac_dependency?(args)
|
|
||||||
args.each { |key, version| args[key] = OS::Mac::Version.from_symbol(version) }
|
|
||||||
|
|
||||||
return false if args[:after] && OS::Mac.version >= args[:after]
|
|
||||||
|
|
||||||
return false if args[:before] && OS::Mac.version < args[:before]
|
|
||||||
|
|
||||||
args.present?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,10 +41,6 @@ class SystemConfig
|
|||||||
@clt ||= MacOS::CLT.version if MacOS::CLT.installed?
|
@clt ||= MacOS::CLT.version if MacOS::CLT.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def clt_headers
|
|
||||||
@clt_headers ||= MacOS::CLT.headers_version if MacOS::CLT.headers_installed?
|
|
||||||
end
|
|
||||||
|
|
||||||
def xquartz
|
def xquartz
|
||||||
@xquartz ||= "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" if MacOS::XQuartz.installed?
|
@xquartz ||= "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" if MacOS::XQuartz.installed?
|
||||||
end
|
end
|
||||||
@ -54,7 +50,6 @@ class SystemConfig
|
|||||||
f.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
f.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
||||||
f.puts "CLT: #{clt || "N/A"}"
|
f.puts "CLT: #{clt || "N/A"}"
|
||||||
f.puts "Xcode: #{xcode || "N/A"}"
|
f.puts "Xcode: #{xcode || "N/A"}"
|
||||||
f.puts "CLT headers: #{clt_headers}" if MacOS::CLT.separate_header_package? && clt_headers
|
|
||||||
f.puts "XQuartz: #{xquartz}" if xquartz
|
f.puts "XQuartz: #{xquartz}" if xquartz
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -463,7 +463,7 @@ class Formula
|
|||||||
# This is actually just a check for if the {#installed_prefix} directory
|
# This is actually just a check for if the {#installed_prefix} directory
|
||||||
# exists and is not empty.
|
# exists and is not empty.
|
||||||
# @private
|
# @private
|
||||||
def installed?
|
def latest_version_installed?
|
||||||
(dir = installed_prefix).directory? && !dir.children.empty?
|
(dir = installed_prefix).directory? && !dir.children.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1211,7 +1211,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new_formula_available?
|
def new_formula_available?
|
||||||
installed_alias_target_changed? && !latest_formula.installed?
|
installed_alias_target_changed? && !latest_formula.latest_version_installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_installed_alias_target
|
def current_installed_alias_target
|
||||||
@ -1546,8 +1546,13 @@ class Formula
|
|||||||
Dependency.new full_name
|
Dependency.new full_name
|
||||||
end.compact
|
end.compact
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
deps ||= declared_runtime_dependencies unless undeclared
|
deps ||= declared_runtime_dependencies unless undeclared
|
||||||
deps ||= (declared_runtime_dependencies | undeclared_runtime_dependencies)
|
deps ||= (declared_runtime_dependencies | undeclared_runtime_dependencies)
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
onoe "could not get runtime dependencies from #{path}!"
|
||||||
|
deps ||= []
|
||||||
|
end
|
||||||
deps
|
deps
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1932,7 +1937,7 @@ class Formula
|
|||||||
# @private
|
# @private
|
||||||
def eligible_kegs_for_cleanup(quiet: false)
|
def eligible_kegs_for_cleanup(quiet: false)
|
||||||
eligible_for_cleanup = []
|
eligible_for_cleanup = []
|
||||||
if installed?
|
if latest_version_installed?
|
||||||
eligible_kegs = if head? && (head_prefix = latest_head_prefix)
|
eligible_kegs = if head? && (head_prefix = latest_head_prefix)
|
||||||
installed_kegs - [Keg.new(head_prefix)]
|
installed_kegs - [Keg.new(head_prefix)]
|
||||||
else
|
else
|
||||||
@ -2370,8 +2375,8 @@ class Formula
|
|||||||
specs.each { |spec| spec.depends_on(dep) }
|
specs.each { |spec| spec.depends_on(dep) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def uses_from_macos(dep, **args)
|
def uses_from_macos(dep)
|
||||||
specs.each { |spec| spec.uses_from_macos(dep, args) }
|
specs.each { |spec| spec.uses_from_macos(dep) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @!attribute [w] option
|
# @!attribute [w] option
|
||||||
|
|||||||
@ -100,7 +100,7 @@ module FormulaCellarChecks
|
|||||||
def check_generic_executables(bin)
|
def check_generic_executables(bin)
|
||||||
return unless bin.directory?
|
return unless bin.directory?
|
||||||
|
|
||||||
generic_names = %w[run service start stop]
|
generic_names = %w[service start stop]
|
||||||
generics = bin.children.select { |g| generic_names.include? g.basename.to_s }
|
generics = bin.children.select { |g| generic_names.include? g.basename.to_s }
|
||||||
return if generics.empty?
|
return if generics.empty?
|
||||||
|
|
||||||
|
|||||||
@ -343,7 +343,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
build_bottle_postinstall if build_bottle?
|
build_bottle_postinstall if build_bottle?
|
||||||
|
|
||||||
opoo "Nothing was installed to #{formula.prefix}" unless formula.installed?
|
opoo "Nothing was installed to #{formula.prefix}" unless formula.latest_version_installed?
|
||||||
end_time = Time.now
|
end_time = Time.now
|
||||||
Homebrew.messages.formula_installed(formula, end_time - start_time)
|
Homebrew.messages.formula_installed(formula, end_time - start_time)
|
||||||
end
|
end
|
||||||
@ -598,6 +598,10 @@ class FormulaInstaller
|
|||||||
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
|
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
|
||||||
fi.install
|
fi.install
|
||||||
fi.finish
|
fi.finish
|
||||||
|
rescue FormulaInstallationAlreadyAttemptedError
|
||||||
|
# We already attempted to install f as part of the dependency tree of
|
||||||
|
# another formula. In that case, don't generate an error, just move on.
|
||||||
|
nil
|
||||||
rescue Exception # rubocop:disable Lint/RescueException
|
rescue Exception # rubocop:disable Lint/RescueException
|
||||||
ignore_interrupts do
|
ignore_interrupts do
|
||||||
tmp_keg.rename(installed_keg) if tmp_keg && !installed_keg.directory?
|
tmp_keg.rename(installed_keg) if tmp_keg && !installed_keg.directory?
|
||||||
@ -910,13 +914,7 @@ class FormulaInstaller
|
|||||||
--
|
--
|
||||||
#{HOMEBREW_LIBRARY_PATH}/postinstall.rb
|
#{HOMEBREW_LIBRARY_PATH}/postinstall.rb
|
||||||
#{formula.path}
|
#{formula.path}
|
||||||
].concat(ARGV.options_only) - ["--HEAD", "--devel"]
|
]
|
||||||
|
|
||||||
if formula.head?
|
|
||||||
args << "--HEAD"
|
|
||||||
elsif formula.devel?
|
|
||||||
args << "--devel"
|
|
||||||
end
|
|
||||||
|
|
||||||
Utils.safe_fork do
|
Utils.safe_fork do
|
||||||
if Sandbox.formula?(formula)
|
if Sandbox.formula?(formula)
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class FormulaVersions
|
|||||||
rescue *IGNORED_EXCEPTIONS => e
|
rescue *IGNORED_EXCEPTIONS => e
|
||||||
# We rescue these so that we can skip bad versions and
|
# We rescue these so that we can skip bad versions and
|
||||||
# continue walking the history
|
# continue walking the history
|
||||||
ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug?
|
odebug "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug?
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
nil
|
nil
|
||||||
ensure
|
ensure
|
||||||
|
|||||||
@ -153,7 +153,8 @@ module Language
|
|||||||
def virtualenv_install_with_resources(options = {})
|
def virtualenv_install_with_resources(options = {})
|
||||||
python = options[:using]
|
python = options[:using]
|
||||||
if python.nil?
|
if python.nil?
|
||||||
wanted = %w[python python@2 python2 python3 python@3 pypy pypy3].select { |py| needs_python?(py) }
|
pythons = %w[python python@2 python2 python3 python@3 python@3.8 pypy pypy3]
|
||||||
|
wanted = pythons.select { |py| needs_python?(py) }
|
||||||
raise FormulaAmbiguousPythonError, self if wanted.size > 1
|
raise FormulaAmbiguousPythonError, self if wanted.size > 1
|
||||||
|
|
||||||
python = wanted.first || "python2.7"
|
python = wanted.first || "python2.7"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# When done, regenerate the man page and its HTML version by running `brew man`.
|
# When done, regenerate the man page and its HTML version by running `brew man`.
|
||||||
%>
|
%>
|
||||||
brew(1) -- The missing package manager for macOS
|
brew(1) -- The Missing Package Manager for macOS
|
||||||
================================================
|
================================================
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class Keg
|
|||||||
return if file.dylib_id == id
|
return if file.dylib_id == id
|
||||||
|
|
||||||
@require_relocation = true
|
@require_relocation = true
|
||||||
puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug?
|
odebug "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug?
|
||||||
MachO::Tools.change_dylib_id(file, id, strict: false)
|
MachO::Tools.change_dylib_id(file, id, strict: false)
|
||||||
rescue MachO::MachOError
|
rescue MachO::MachOError
|
||||||
onoe <<~EOS
|
onoe <<~EOS
|
||||||
@ -20,7 +20,7 @@ class Keg
|
|||||||
return if old == new
|
return if old == new
|
||||||
|
|
||||||
@require_relocation = true
|
@require_relocation = true
|
||||||
puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug?
|
odebug "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug?
|
||||||
MachO::Tools.change_install_name(file, old, new, strict: false)
|
MachO::Tools.change_install_name(file, old, new, strict: false)
|
||||||
rescue MachO::MachOError
|
rescue MachO::MachOError
|
||||||
onoe <<~EOS
|
onoe <<~EOS
|
||||||
|
|||||||
@ -16,13 +16,13 @@ module OS
|
|||||||
when "10.11" then "8.2.1"
|
when "10.11" then "8.2.1"
|
||||||
when "10.12" then "9.2"
|
when "10.12" then "9.2"
|
||||||
when "10.13" then "10.1"
|
when "10.13" then "10.1"
|
||||||
when "10.14" then "10.2.1"
|
when "10.14" then "11.3"
|
||||||
when "10.15" then "11.2.1"
|
when "10.15" then "11.3"
|
||||||
else
|
else
|
||||||
raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease?
|
raise "macOS '#{MacOS.version}' is invalid" unless OS::Mac.prerelease?
|
||||||
|
|
||||||
# Default to newest known version of Xcode for unreleased macOS versions.
|
# Default to newest known version of Xcode for unreleased macOS versions.
|
||||||
"11.2.1"
|
"11.3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -176,8 +176,8 @@ module OS
|
|||||||
when 90 then "9.2"
|
when 90 then "9.2"
|
||||||
when 91 then "9.4"
|
when 91 then "9.4"
|
||||||
when 100 then "10.2.1"
|
when 100 then "10.2.1"
|
||||||
when 110 then "11.2.1"
|
when 110 then "11.3"
|
||||||
else "11.2.1"
|
else "11.3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -193,9 +193,6 @@ module OS
|
|||||||
EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables"
|
EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables"
|
||||||
MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base" # obsolete
|
MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base" # obsolete
|
||||||
PKG_PATH = "/Library/Developer/CommandLineTools"
|
PKG_PATH = "/Library/Developer/CommandLineTools"
|
||||||
HEADER_PKG_PATH =
|
|
||||||
"/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg"
|
|
||||||
HEADER_PKG_ID = "com.apple.pkg.macOS_SDK_headers_for_macOS_10.14"
|
|
||||||
|
|
||||||
# Returns true even if outdated tools are installed
|
# Returns true even if outdated tools are installed
|
||||||
def installed?
|
def installed?
|
||||||
@ -210,14 +207,6 @@ module OS
|
|||||||
version >= "8"
|
version >= "8"
|
||||||
end
|
end
|
||||||
|
|
||||||
def headers_installed?
|
|
||||||
if !separate_header_package?
|
|
||||||
installed?
|
|
||||||
else
|
|
||||||
headers_version == version
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def sdk(v = nil)
|
def sdk(v = nil)
|
||||||
@locator ||= CLTSDKLocator.new
|
@locator ||= CLTSDKLocator.new
|
||||||
|
|
||||||
@ -236,18 +225,18 @@ module OS
|
|||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Update them from Software Update in the App Store
|
Update them from Software Update in the App Store or
|
||||||
#{Formatter.url("https://developer.apple.com/download/more/")}.
|
#{Formatter.url("https://developer.apple.com/download/more/")}.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_version
|
def latest_clang_version
|
||||||
# As of Xcode 8 CLT releases are no longer in sync with Xcode releases
|
# As of Xcode 8 CLT releases are no longer in sync with Xcode releases
|
||||||
# on the older supported platform for that Xcode release, i.e there's no
|
# on the older supported platform for that Xcode release, i.e there's no
|
||||||
# CLT package for 10.11 that contains the Clang version from Xcode 8.
|
# CLT package for 10.11 that contains the Clang version from Xcode 8.
|
||||||
case MacOS.version
|
case MacOS.version
|
||||||
when "10.15" then "1100.0.33.12"
|
when "10.15" then "1100.0.33.16"
|
||||||
when "10.14" then "1001.0.46.4"
|
when "10.14" then "1001.0.46.4"
|
||||||
when "10.13" then "1000.10.44.2"
|
when "10.13" then "1000.10.44.2"
|
||||||
when "10.12" then "900.0.39.2"
|
when "10.12" then "900.0.39.2"
|
||||||
@ -277,7 +266,7 @@ module OS
|
|||||||
clang_version = detect_clang_version
|
clang_version = detect_clang_version
|
||||||
return false unless clang_version
|
return false unless clang_version
|
||||||
|
|
||||||
::Version.new(clang_version) < latest_version
|
::Version.new(clang_version) < latest_clang_version
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_clang_version
|
def detect_clang_version
|
||||||
@ -291,6 +280,10 @@ module OS
|
|||||||
version_output[/clang-(\d+\.\d+\.\d+(\.\d+)?)/, 1]
|
version_output[/clang-(\d+\.\d+\.\d+(\.\d+)?)/, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def detect_version_from_clang_version
|
||||||
|
detect_clang_version&.sub(/^(\d+)00\./, "\\1.")
|
||||||
|
end
|
||||||
|
|
||||||
# Version string (a pretty long one) of the CLT package.
|
# Version string (a pretty long one) of the CLT package.
|
||||||
# Note, that different ways to install the CLTs lead to different
|
# Note, that different ways to install the CLTs lead to different
|
||||||
# version numbers.
|
# version numbers.
|
||||||
@ -302,19 +295,6 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Version string of the header package, which is a
|
|
||||||
# separate package as of macOS 10.14.
|
|
||||||
def headers_version
|
|
||||||
if !separate_header_package?
|
|
||||||
version
|
|
||||||
else
|
|
||||||
@header_version ||= MacOS.pkgutil_info(HEADER_PKG_ID)[/version: (.+)$/, 1]
|
|
||||||
return ::Version::NULL unless @header_version
|
|
||||||
|
|
||||||
::Version.new(@header_version)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def detect_version
|
def detect_version
|
||||||
version = nil
|
version = nil
|
||||||
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id|
|
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id|
|
||||||
@ -324,7 +304,7 @@ module OS
|
|||||||
return version if version
|
return version if version
|
||||||
end
|
end
|
||||||
|
|
||||||
detect_clang_version
|
detect_version_from_clang_version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,15 +6,24 @@ require "global"
|
|||||||
require "debrew"
|
require "debrew"
|
||||||
require "fcntl"
|
require "fcntl"
|
||||||
require "socket"
|
require "socket"
|
||||||
|
require "cli/parser"
|
||||||
|
|
||||||
|
def postinstall_args
|
||||||
|
Homebrew::CLI::Parser.new do
|
||||||
|
switch :force
|
||||||
|
switch :verbose
|
||||||
|
switch :debug
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
postinstall_args.parse
|
||||||
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
||||||
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
trap("INT", old_trap)
|
trap("INT", old_trap)
|
||||||
|
|
||||||
formula = ARGV.resolved_formulae.first
|
formula = Homebrew.args.resolved_formulae.first
|
||||||
formula.extend(Debrew::Formula) if ARGV.debug?
|
|
||||||
formula.run_post_install
|
formula.run_post_install
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
error_pipe.puts e.to_json
|
error_pipe.puts e.to_json
|
||||||
|
|||||||
@ -132,7 +132,7 @@ class Resource
|
|||||||
end
|
end
|
||||||
rescue ChecksumMissingError
|
rescue ChecksumMissingError
|
||||||
opoo "Cannot verify integrity of #{fn.basename}"
|
opoo "Cannot verify integrity of #{fn.basename}"
|
||||||
puts "A checksum was not provided for this resource"
|
puts "A checksum was not provided for this resource."
|
||||||
puts "For your reference the SHA-256 is: #{fn.sha256}"
|
puts "For your reference the SHA-256 is: #{fn.sha256}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -171,10 +171,8 @@ class SoftwareSpec
|
|||||||
add_dep_option(dep) if dep
|
add_dep_option(dep) if dep
|
||||||
end
|
end
|
||||||
|
|
||||||
def uses_from_macos(deps, **_args)
|
def uses_from_macos(spec)
|
||||||
deps = Hash[*deps.shift] if deps.is_a?(Hash)
|
depends_on(spec)
|
||||||
|
|
||||||
depends_on(deps)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def deps
|
def deps
|
||||||
|
|||||||
@ -88,7 +88,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "1",
|
"1" => "1",
|
||||||
"1.2" => "1",
|
"1.2" => "1",
|
||||||
"1.2.3" => "1",
|
"1.2.3" => "1",
|
||||||
"1.2.3_4-5" => "1"
|
"1.2.3-4,5:6" => "1"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#minor" do
|
describe "#minor" do
|
||||||
@ -96,7 +96,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "",
|
"1" => "",
|
||||||
"1.2" => "2",
|
"1.2" => "2",
|
||||||
"1.2.3" => "2",
|
"1.2.3" => "2",
|
||||||
"1.2.3_4-5" => "2"
|
"1.2.3-4,5:6" => "2"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#patch" do
|
describe "#patch" do
|
||||||
@ -104,7 +104,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "",
|
"1" => "",
|
||||||
"1.2" => "",
|
"1.2" => "",
|
||||||
"1.2.3" => "3",
|
"1.2.3" => "3",
|
||||||
"1.2.3_4-5" => "3"
|
"1.2.3-4,5:6" => "3-4"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#major_minor" do
|
describe "#major_minor" do
|
||||||
@ -112,7 +112,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "1",
|
"1" => "1",
|
||||||
"1.2" => "1.2",
|
"1.2" => "1.2",
|
||||||
"1.2.3" => "1.2",
|
"1.2.3" => "1.2",
|
||||||
"1.2.3_4-5" => "1.2"
|
"1.2.3-4,5:6" => "1.2"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#major_minor_patch" do
|
describe "#major_minor_patch" do
|
||||||
@ -120,7 +120,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "1",
|
"1" => "1",
|
||||||
"1.2" => "1.2",
|
"1.2" => "1.2",
|
||||||
"1.2.3" => "1.2.3",
|
"1.2.3" => "1.2.3",
|
||||||
"1.2.3_4-5" => "1.2.3"
|
"1.2.3-4,5:6" => "1.2.3-4"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#minor_patch" do
|
describe "#minor_patch" do
|
||||||
@ -128,7 +128,7 @@ describe Cask::DSL::Version, :cask do
|
|||||||
"1" => "",
|
"1" => "",
|
||||||
"1.2" => "2",
|
"1.2" => "2",
|
||||||
"1.2.3" => "2.3",
|
"1.2.3" => "2.3",
|
||||||
"1.2.3_4-5" => "2.3"
|
"1.2.3-4,5:6" => "2.3-4"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#before_comma" do
|
describe "#before_comma" do
|
||||||
|
|||||||
@ -124,17 +124,17 @@ describe Homebrew::Cleanup do
|
|||||||
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(f1).to be_installed
|
expect(f1).to be_latest_version_installed
|
||||||
expect(f2).to be_installed
|
expect(f2).to be_latest_version_installed
|
||||||
expect(f3).to be_installed
|
expect(f3).to be_latest_version_installed
|
||||||
expect(f4).to be_installed
|
expect(f4).to be_latest_version_installed
|
||||||
|
|
||||||
subject.cleanup_formula f3
|
subject.cleanup_formula f3
|
||||||
|
|
||||||
expect(f1).not_to be_installed
|
expect(f1).not_to be_latest_version_installed
|
||||||
expect(f2).not_to be_installed
|
expect(f2).not_to be_latest_version_installed
|
||||||
expect(f3).to be_installed
|
expect(f3).to be_latest_version_installed
|
||||||
expect(f4).to be_installed
|
expect(f4).to be_latest_version_installed
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#cleanup_cask", :cask do
|
describe "#cleanup_cask", :cask do
|
||||||
|
|||||||
@ -236,6 +236,21 @@ describe Homebrew::CLI::Parser do
|
|||||||
expect(Homebrew.args.passthrough).to eq %w[--foo --bar=value -s]
|
expect(Homebrew.args.passthrough).to eq %w[--foo --bar=value -s]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "#formulae raises an error when a Formula is unavailable" do
|
||||||
|
parser.parse(["mxcl"])
|
||||||
|
expect { Homebrew.args.formulae }.to raise_error FormulaUnavailableError
|
||||||
|
end
|
||||||
|
|
||||||
|
it "#formulae returns an empty array when there are no Formulae" do
|
||||||
|
parser.parse([])
|
||||||
|
expect(Homebrew.args.formulae).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
it "#casks returns an empty array when there are no matching casks" do
|
||||||
|
parser.parse([])
|
||||||
|
expect(Homebrew.args.casks).to eq []
|
||||||
|
end
|
||||||
|
|
||||||
context "kegs" do
|
context "kegs" do
|
||||||
before do
|
before do
|
||||||
keg = HOMEBREW_CELLAR + "mxcl/10.0"
|
keg = HOMEBREW_CELLAR + "mxcl/10.0"
|
||||||
@ -252,5 +267,15 @@ describe Homebrew::CLI::Parser do
|
|||||||
expect(Homebrew.args.kegs).to be_empty
|
expect(Homebrew.args.kegs).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "#named returns an array of non-option arguments" do
|
||||||
|
parser.parse(["foo", "-v", "-s"])
|
||||||
|
expect(Homebrew.args.named).to eq ["foo"]
|
||||||
|
end
|
||||||
|
|
||||||
|
it "#named returns an empty array when there are no named arguments" do
|
||||||
|
parser.parse([])
|
||||||
|
expect(Homebrew.args.named).to be_empty
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -7,7 +7,7 @@ describe "Homebrew.extract_args" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "brew extract", :integration_test do
|
describe "brew extract", :integration_test do
|
||||||
it "retrieves the specified version of formula, defaulting to most recent" do
|
let!(:target) do
|
||||||
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||||
(path/"Formula").mkpath
|
(path/"Formula").mkpath
|
||||||
target = Tap.from_path(path)
|
target = Tap.from_path(path)
|
||||||
@ -23,12 +23,27 @@ describe "brew extract", :integration_test do
|
|||||||
system "git", "add", "--all"
|
system "git", "add", "--all"
|
||||||
system "git", "commit", "-m", "testball 0.2"
|
system "git", "commit", "-m", "testball 0.2"
|
||||||
end
|
end
|
||||||
|
{ name: target.name, path: path }
|
||||||
|
end
|
||||||
|
|
||||||
expect { brew "extract", "testball", target.name, "--version=0.1" }
|
it "retrieves the most recent version of formula" do
|
||||||
|
expect { brew "extract", "testball", target[:name] }
|
||||||
.to be_a_success
|
.to be_a_success
|
||||||
|
expect(target[:path]/"Formula/testball@0.2.rb").to exist
|
||||||
|
expect(Formulary.factory(target[:path]/"Formula/testball@0.2.rb").version).to be == "0.2"
|
||||||
|
end
|
||||||
|
|
||||||
expect(path/"Formula/testball@0.1.rb").to exist
|
it "retrieves the specified version of formula" do
|
||||||
|
expect { brew "extract", "testball", target[:name], "--version=0.1" }
|
||||||
|
.to be_a_success
|
||||||
|
expect(target[:path]/"Formula/testball@0.1.rb").to exist
|
||||||
|
expect(Formulary.factory(target[:path]/"Formula/testball@0.1.rb").version).to be == "0.1"
|
||||||
|
end
|
||||||
|
|
||||||
expect(Formulary.factory(path/"Formula/testball@0.1.rb").version).to be == "0.1"
|
it "retrieves the compatible version of formula" do
|
||||||
|
expect { brew "extract", "testball", target[:name], "--version=0", "--debug" }
|
||||||
|
.to be_a_success
|
||||||
|
expect(target[:path]/"Formula/testball@0.rb").to exist
|
||||||
|
expect(Formulary.factory(target[:path]/"Formula/testball@0.rb").version).to be == "0.2"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,7 +6,8 @@ describe "Homebrew.test_args" do
|
|||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "brew test", :integration_test do
|
# randomly segfaults on Linux with portable-ruby.
|
||||||
|
describe "brew test", :integration_test, :needs_macos do
|
||||||
it "tests a given Formula" do
|
it "tests a given Formula" do
|
||||||
install_test_formula "testball", <<~'RUBY'
|
install_test_formula "testball", <<~'RUBY'
|
||||||
test do
|
test do
|
||||||
|
|||||||
@ -15,19 +15,19 @@ describe FormulaInstaller do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def temporarily_install_bottle(formula)
|
def temporarily_install_bottle(formula)
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
expect(formula).to be_bottled
|
expect(formula).to be_bottled
|
||||||
expect(formula).to pour_bottle
|
expect(formula).to pour_bottle
|
||||||
|
|
||||||
stub_formula_loader formula
|
stub_formula_loader formula
|
||||||
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
||||||
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
||||||
allow(Formula["patchelf"]).to receive(:installed?).and_return(true)
|
allow(Formula["patchelf"]).to receive(:latest_version_installed?).and_return(true)
|
||||||
described_class.new(formula).install
|
described_class.new(formula).install
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
|
|
||||||
expect(formula).to be_installed
|
expect(formula).to be_latest_version_installed
|
||||||
|
|
||||||
begin
|
begin
|
||||||
expect(Tab.for_keg(keg)).to be_poured_from_bottle
|
expect(Tab.for_keg(keg)).to be_poured_from_bottle
|
||||||
@ -41,7 +41,7 @@ describe FormulaInstaller do
|
|||||||
end
|
end
|
||||||
|
|
||||||
expect(keg).not_to exist
|
expect(keg).not_to exist
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "basic bottle install" do
|
specify "basic bottle install" do
|
||||||
@ -73,13 +73,13 @@ describe FormulaInstaller do
|
|||||||
# Testball doesn't have a bottle block, so use it to test this behavior
|
# Testball doesn't have a bottle block, so use it to test this behavior
|
||||||
formula = Testball.new
|
formula = Testball.new
|
||||||
|
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
expect(formula).not_to be_bottled
|
expect(formula).not_to be_bottled
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
described_class.new(formula).install
|
described_class.new(formula).install
|
||||||
}.to raise_error(BuildToolsError)
|
}.to raise_error(BuildToolsError)
|
||||||
|
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -17,7 +17,7 @@ describe FormulaInstaller do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def temporary_install(formula)
|
def temporary_install(formula)
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
|
|
||||||
installer = described_class.new(formula)
|
installer = described_class.new(formula)
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ describe FormulaInstaller do
|
|||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
|
|
||||||
expect(formula).to be_installed
|
expect(formula).to be_latest_version_installed
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Tab.clear_cache
|
Tab.clear_cache
|
||||||
@ -42,7 +42,7 @@ describe FormulaInstaller do
|
|||||||
end
|
end
|
||||||
|
|
||||||
expect(keg).not_to exist
|
expect(keg).not_to exist
|
||||||
expect(formula).not_to be_installed
|
expect(formula).not_to be_latest_version_installed
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "basic installation" do
|
specify "basic installation" do
|
||||||
@ -84,7 +84,7 @@ describe FormulaInstaller do
|
|||||||
expect(formula).to have_disabled_bottle
|
expect(formula).to have_disabled_bottle
|
||||||
|
|
||||||
temporary_install(formula) do |f|
|
temporary_install(formula) do |f|
|
||||||
expect(f).to be_installed
|
expect(f).to be_latest_version_installed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user