Merge branch 'master' of https://github.com/Homebrew/brew into brew-info-display-casks

This commit is contained in:
Zach Auten 2019-03-06 17:56:22 -05:00
commit dd4daa247f
667 changed files with 1146 additions and 1074 deletions

View File

@ -12,7 +12,7 @@ insert_final_newline = true
[{Library/Homebrew/**.rb,.simplecov}] [{Library/Homebrew/**.rb,.simplecov}]
trim_trailing_whitespace = true trim_trailing_whitespace = true
[Library/Taps/homebrew/**.rb] [Library/Taps/**.rb]
# trailing whitespace is crucial for patches # trailing whitespace is crucial for patches
trim_trailing_whitespace = false trim_trailing_whitespace = false

211
.gitignore vendored
View File

@ -22,105 +22,132 @@
# Ignore Bundler files # Ignore Bundler files
**/.bundle/bin **/.bundle/bin
**/.bundle/cache **/.bundle/cache
**/vendor/bundle **/vendor/bundle/ruby/*/bin
**/vendor/ruby **/vendor/bundle/ruby/*/build_info/
**/vendor/bundle-standalone/ruby/*/bin **/vendor/bundle/ruby/*/cache
**/vendor/bundle-standalone/ruby/*/build_info/ **/vendor/bundle/ruby/*/extensions
**/vendor/bundle-standalone/ruby/*/cache **/vendor/bundle/ruby/*/gems/*/*
**/vendor/bundle-standalone/ruby/*/extensions **/vendor/bundle/ruby/*/specifications
**/vendor/bundle-standalone/ruby/*/gems/*/*
**/vendor/bundle-standalone/ruby/*/specifications
# Unignore vendored gems # Unignore vendored gems
!**/vendor/bundle-standalone/ruby/*/gems/*/lib !**/vendor/bundle/ruby/*/gems/*/lib
!**/vendor/bundle-standalone/ruby/*/gems/rubocop-rspec-*/config !**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/config
# Ignore partially included gems where we don't need all files # Ignore partially included gems where we don't need all files
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/all.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/all.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/concurrency/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/concurrency/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/duration/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/duration/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/json.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/json.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/json/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/json/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/log_subscriber.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/log_subscriber.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/log_subscriber/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/log_subscriber/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/messages/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/messages/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/multibyte/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/multibyte/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/number_helper.rb **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/number_helper.rb
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/number_helper/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/number_helper/
**/vendor/bundle-standalone/ruby/2.3.0/gems/activesupport-*/lib/active_support/testing/ **/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/testing/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/latest.rb **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/latest.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails.rb **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/rails.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/version.rb **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/version.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/1.* **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/1.*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.0* **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.0*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.1* **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.1*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.2* **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.2*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.3* **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.3*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.*.rb **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.6*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/force/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.*.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/force/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/random/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/rails/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/array/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/random/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/comparable/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/array/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/dir/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/comparable/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/enumerable/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/dir/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/false_class/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/enumerable/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/fixnum/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/false_class/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/float/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/fixnum/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/hash/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/float/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/integer/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/hash/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/kernel/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/integer/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/module/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/kernel/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/nil_class/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/module/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/regexp/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/nil_class/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/struct/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/regexp/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/struct/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/true_class/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/atomic/ **/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/true_class/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/atomic_reference/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/collection/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic_reference/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/concern/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/collection/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/executor/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/concern/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/synchronization/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/executor/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/thread_safe/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/synchronization/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/utility/ **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/thread_safe/
**/vendor/bundle-standalone/ruby/*/gems/i18n-*/lib/i18n/tests* **/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/utility/
**/vendor/bundle-standalone/ruby/*/gems/thread_safe-*/lib/thread_safe/util **/vendor/bundle/ruby/*/gems/i18n-*/lib/i18n/tests*
**/vendor/bundle/ruby/*/gems/thread_safe-*/lib/thread_safe/util
# Ignore rubocop's (and other) dependencies we don't wish to vendor # Ignore dependencies we don't wish to vendor
**/vendor/bundle-standalone/ruby/*/gems/ast-*/ **/vendor/bundle/ruby/*/gems/ast-*/
**/vendor/bundle-standalone/ruby/*/gems/connection_pool-*/lib **/vendor/bundle/ruby/*/gems/bundler-*/
**/vendor/bundle-standalone/ruby/*/gems/domain_name-*/lib **/vendor/bundle/ruby/*/gems/coderay-*/
**/vendor/bundle-standalone/ruby/*/gems/http-cookie-*/lib **/vendor/bundle/ruby/*/gems/connection_pool-*/
**/vendor/bundle-standalone/ruby/*/gems/jaro_winkler-*/ **/vendor/bundle/ruby/*/gems/coveralls-*/
**/vendor/bundle-standalone/ruby/*/gems/mime-types-data-*/lib **/vendor/bundle/ruby/*/gems/diff-lcs-*/
**/vendor/bundle-standalone/ruby/*/gems/mime-types-*/lib **/vendor/bundle/ruby/*/gems/docile-*/
**/vendor/bundle-standalone/ruby/*/gems/mini_portile2-*/lib **/vendor/bundle/ruby/*/gems/domain_name-*/
**/vendor/bundle-standalone/ruby/*/gems/minitest-*/lib **/vendor/bundle/ruby/*/gems/http-cookie-*/
**/vendor/bundle-standalone/ruby/*/gems/net-http-digest_auth-*/lib **/vendor/bundle/ruby/*/gems/hpricot-*/
**/vendor/bundle-standalone/ruby/*/gems/net-http-persistent-*/lib **/vendor/bundle/ruby/*/gems/jaro_winkler-*/
**/vendor/bundle-standalone/ruby/*/gems/nokogiri-*/lib **/vendor/bundle/ruby/*/gems/json-*/
**/vendor/bundle-standalone/ruby/*/gems/ntlm-http-*/lib **/vendor/bundle/ruby/*/gems/method_source-*/
**/vendor/bundle-standalone/ruby/*/gems/parallel-*/ **/vendor/bundle/ruby/*/gems/mime-types-data-*/
**/vendor/bundle-standalone/ruby/*/gems/parser-*/ **/vendor/bundle/ruby/*/gems/mime-types-*/
**/vendor/bundle-standalone/ruby/*/gems/powerpack-*/ **/vendor/bundle/ruby/*/gems/mini_portile2-*/
**/vendor/bundle-standalone/ruby/*/gems/rainbow-*/ **/vendor/bundle/ruby/*/gems/minitest-*/
**/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/ **/vendor/bundle/ruby/*/gems/mustache-*/
**/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/ **/vendor/bundle/ruby/*/gems/net-http-digest_auth-*/
**/vendor/bundle-standalone/ruby/*/gems/unf_ext-*/lib **/vendor/bundle/ruby/*/gems/net-http-persistent-*/
**/vendor/bundle-standalone/ruby/*/gems/unf-*/lib **/vendor/bundle/ruby/*/gems/nokogiri-*/
**/vendor/bundle-standalone/ruby/*/gems/unicode-display_width-*/ **/vendor/bundle/ruby/*/gems/ntlm-http-*/
**/vendor/bundle-standalone/ruby/*/gems/webrobots-*/lib **/vendor/bundle/ruby/*/gems/parallel-*/
**/vendor/bundle/ruby/*/gems/parallel_tests-*/
**/vendor/bundle/ruby/*/gems/parser-*/
**/vendor/bundle/ruby/*/gems/powerpack-*/
**/vendor/bundle/ruby/*/gems/psych-*/
**/vendor/bundle/ruby/*/gems/pry-*/
**/vendor/bundle/ruby/*/gems/rainbow-*/
**/vendor/bundle/ruby/*/gems/rdiscount-*/
**/vendor/bundle/ruby/*/gems/ronn-*/
**/vendor/bundle/ruby/*/gems/rspec-*/
**/vendor/bundle/ruby/*/gems/rspec-core-*/
**/vendor/bundle/ruby/*/gems/rspec-expectations-*/
**/vendor/bundle/ruby/*/gems/rspec-its-*/
**/vendor/bundle/ruby/*/gems/rspec-mocks-*/
**/vendor/bundle/ruby/*/gems/rspec-retry-*/
**/vendor/bundle/ruby/*/gems/rspec-support-*/
**/vendor/bundle/ruby/*/gems/rspec-wait-*/
**/vendor/bundle/ruby/*/gems/rubocop-0*/
**/vendor/bundle/ruby/*/gems/ruby-progressbar-*/
**/vendor/bundle/ruby/*/gems/simplecov-*/
**/vendor/bundle/ruby/*/gems/simplecov-cobertura-*/
**/vendor/bundle/ruby/*/gems/simplecov-html-*/
**/vendor/bundle/ruby/*/gems/term-ansicolor-*/
**/vendor/bundle/ruby/*/gems/thor-*/
**/vendor/bundle/ruby/*/gems/tins-*/
**/vendor/bundle/ruby/*/gems/unf_ext-*/
**/vendor/bundle/ruby/*/gems/unf-*/
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/
**/vendor/bundle/ruby/*/gems/webrobots-*/
# Only include the `Mechanize::HTTP::ContentDispositionParser`. # Only include the `Mechanize::HTTP::ContentDispositionParser`.
**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib **/vendor/bundle/ruby/*/gems/mechanize-*/lib
!**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib/mechanize/http/content_disposition_parser.rb !**/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/http/content_disposition_parser.rb
!**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib/mechanize/version.rb !**/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/version.rb
# Ignore `bin` contents (again). # Ignore `bin` contents (again).
/bin /bin

View File

@ -13,6 +13,7 @@ RUN apt-get update \
fonts-dejavu-core \ fonts-dejavu-core \
g++ \ g++ \
git \ git \
libz-dev \
locales \ locales \
make \ make \
openssh-client \ openssh-client \

View File

@ -1,3 +1,19 @@
sut: sut:
build: . build: .
command: "sudo -i -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot" command:
- sh
- -xc
- |
sudo -E -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot
status=$$?
cp brew-test-bot.xml /tmp/test-bot/
exit $$status
environment:
- HOME=/home/linuxbrew
- BUILD_REASON
- BUILD_REPOSITORY_URI
- BUILD_SOURCEVERSION
- HOMEBREW_GITHUB_API_TOKEN
- SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
- SYSTEM_PULLREQUEST_TARGETBRANCH
- TF_BUILD

View File

@ -37,10 +37,6 @@ Layout/EndAlignment:
Layout/SpaceAroundOperators: Layout/SpaceAroundOperators:
Enabled: false Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
Layout/EmptyLineAfterGuardClause:
Enabled: false
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258) # Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6258)
# and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254). # and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254).
Layout/RescueEnsureAlignment: Layout/RescueEnsureAlignment:

View File

@ -49,8 +49,7 @@ Style/CollectionMethods:
Style/FormatStringToken: Style/FormatStringToken:
EnforcedStyle: template EnforcedStyle: template
# This often leads to lines longer than the maximum line length. # This shouldn't be enabled until LineLength is lower.
# https://github.com/rubocop-hq/rubocop/issues/6149
Style/IfUnlessModifier: Style/IfUnlessModifier:
Enabled: false Enabled: false

View File

@ -1,5 +1,7 @@
--- ---
BUNDLE_PATH: "bundle-standalone"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_BIN: "false" BUNDLE_BIN: "false"
BUNDLE_CLEAN: "true" BUNDLE_CLEAN: "true"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_JOBS: "4"
BUNDLE_PATH: "vendor/bundle"
BUNDLE_RETRY: "3"

View File

@ -125,6 +125,10 @@ Style/GuardClause:
Style/HashSyntax: Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys EnforcedStyle: ruby19_no_mixed_keys
# LineLength is low enough here to re-enable it.
Style/IfUnlessModifier:
Enabled: true
# so many of these in formulae but none in here # so many of these in formulae but none in here
Style/TrailingBodyOnMethodDefinition: Style/TrailingBodyOnMethodDefinition:
Enabled: true Enabled: true

22
Library/Homebrew/Gemfile Normal file
View File

@ -0,0 +1,22 @@
source "https://rubygems.org"
# installed gems
gem "coveralls", require: false
gem "parallel_tests"
gem "ronn", require: false
gem "rspec"
gem "rspec-its", require: false
gem "rspec-retry", require: false
gem "rspec-wait", require: false
gem "rubocop"
gem "simplecov", require: false
gem "simplecov-cobertura", require: false
# vendored gems
gem "activesupport"
gem "backports"
gem "concurrent-ruby"
gem "mechanize"
gem "plist"
gem "rubocop-rspec"
gem "ruby-macho"

View File

@ -1,7 +1,15 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.4.0) ast (2.4.0)
backports (3.12.0)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
coveralls (0.8.22) coveralls (0.8.22)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov (~> 0.16.1) simplecov (~> 0.16.1)
@ -10,16 +18,44 @@ GEM
tins (~> 1.6) tins (~> 1.6)
diff-lcs (1.3) diff-lcs (1.3)
docile (1.3.1) docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
hpricot (0.8.6) hpricot (0.8.6)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.2) jaro_winkler (1.5.2)
json (2.1.0) json (2.2.0)
mechanize (2.7.6)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (>= 1.17.2)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (>= 2.5.2)
nokogiri (~> 1.6)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mini_portile2 (2.4.0)
minitest (5.11.3)
mustache (1.1.0) mustache (1.1.0)
parallel (1.13.0) net-http-digest_auth (1.4.1)
net-http-persistent (3.0.0)
connection_pool (~> 2.2)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
ntlm-http (0.1.1)
parallel (1.14.0)
parallel_tests (2.28.0) parallel_tests (2.28.0)
parallel parallel
parser (2.6.0.0) parser (2.6.0.0)
ast (~> 2.4.0) ast (~> 2.4.0)
plist (3.5.0)
powerpack (0.1.2) powerpack (0.1.2)
psych (3.1.0)
rainbow (3.0.0) rainbow (3.0.0)
rdiscount (2.2.0.1) rdiscount (2.2.0.1)
ronn (0.7.3) ronn (0.7.3)
@ -46,14 +82,18 @@ GEM
rspec-support (3.8.0) rspec-support (3.8.0)
rspec-wait (0.0.9) rspec-wait (0.0.9)
rspec (>= 3, < 4) rspec (>= 3, < 4)
rubocop (0.64.0) rubocop (0.65.0)
jaro_winkler (~> 1.5.1) jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1) parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1) powerpack (~> 0.1)
psych (>= 3.1.0)
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) unicode-display_width (~> 1.4.0)
rubocop-rspec (1.32.0)
rubocop (>= 0.60.0)
ruby-macho (2.2.0)
ruby-progressbar (1.10.0) ruby-progressbar (1.10.0)
simplecov (0.16.1) simplecov (0.16.1)
docile (~> 1.1) docile (~> 1.1)
@ -65,23 +105,37 @@ GEM
term-ansicolor (1.7.1) term-ansicolor (1.7.1)
tins (~> 1.0) tins (~> 1.0)
thor (0.19.4) thor (0.19.4)
thread_safe (0.3.6)
tins (1.20.2) tins (1.20.2)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.1) unicode-display_width (1.4.1)
webrobots (0.1.2)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
activesupport
backports
concurrent-ruby
coveralls coveralls
mechanize
parallel_tests parallel_tests
plist
ronn ronn
rspec rspec
rspec-its rspec-its
rspec-retry rspec-retry
rspec-wait rspec-wait
rubocop rubocop
rubocop-rspec
ruby-macho
simplecov simplecov
simplecov-cobertura simplecov-cobertura
BUNDLED WITH BUNDLED WITH
1.16.6 2.0.1

View File

@ -1,6 +1,4 @@
unless ENV["HOMEBREW_BREW_FILE"] raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
end
std_trap = trap("INT") { exit! 130 } # no backtrace thanks std_trap = trap("INT") { exit! 130 } # no backtrace thanks
@ -10,6 +8,12 @@ if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3)
raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}." raise "Homebrew must be run under Ruby 2.3! You're running #{RUBY_VERSION}."
end end
# Load Bundler first of all if it's needed to avoid Gem version conflicts.
if ENV["HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST"]
require_relative "utils/gems"
Homebrew.install_bundler_gems!
end
# Also define here so we can rescue regardless of location. # Also define here so we can rescue regardless of location.
class MissingEnvironmentVariables < RuntimeError; end class MissingEnvironmentVariables < RuntimeError; end
@ -92,9 +96,7 @@ begin
# `Homebrew.help` never returns, except for external/unknown commands. # `Homebrew.help` never returns, except for external/unknown commands.
end end
if ENV["HOMEBREW_BUILD_FROM_SOURCE"] odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
end
if internal_cmd if internal_cmd
Homebrew.send cmd.to_s.tr("-", "_").downcase Homebrew.send cmd.to_s.tr("-", "_").downcase
@ -113,9 +115,7 @@ begin
brew_uid = HOMEBREW_BREW_FILE.stat.uid brew_uid = HOMEBREW_BREW_FILE.stat.uid
tap_commands = [] tap_commands = []
if Process.uid.zero? && !brew_uid.zero? tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero?
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
end
# Unset HOMEBREW_HELP to avoid confusing the tap # Unset HOMEBREW_HELP to avoid confusing the tap
ENV.delete("HOMEBREW_HELP") if help_flag ENV.delete("HOMEBREW_HELP") if help_flag
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}] tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]

View File

@ -309,6 +309,11 @@ then
esac esac
fi fi
if [[ "$HOMEBREW_COMMAND" = "audit" || "$HOMEBREW_COMMAND" = "style" ]]
then
export HOMEBREW_INSTALL_BUNDLER_GEMS_FIRST="1"
fi
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command. # Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
# This makes them behave like HOMEBREW_DEVELOPERs for brew update. # This makes them behave like HOMEBREW_DEVELOPERs for brew update.
if [[ -z "$HOMEBREW_DEVELOPER" ]] if [[ -z "$HOMEBREW_DEVELOPER" ]]

View File

@ -39,6 +39,7 @@ class CacheStoreDatabase
# Closes the underlying database (if it is created and open). # Closes the underlying database (if it is created and open).
def close_if_open! def close_if_open!
return unless @db return unless @db
cache_path.dirname.mkpath cache_path.dirname.mkpath
cache_path.atomic_write(JSON.dump(@db)) cache_path.atomic_write(JSON.dump(@db))
end end
@ -55,6 +56,7 @@ class CacheStoreDatabase
# @return [Time] # @return [Time]
def mtime def mtime
return unless created? return unless created?
cache_path.mtime cache_path.mtime
end end

View File

@ -20,6 +20,24 @@ module Cask
@dirmethod ||= "#{dsl_key}dir".to_sym @dirmethod ||= "#{dsl_key}dir".to_sym
end end
def staged_path_join_executable(path)
path = Pathname(path)
absolute_path = if path.absolute?
path
else
cask.staged_path.join(path)
end
FileUtils.chmod "+x", absolute_path if absolute_path.exist? && !absolute_path.executable?
if absolute_path.exist?
absolute_path
else
path
end
end
def <=>(other) def <=>(other)
return unless other.class < AbstractArtifact return unless other.class < AbstractArtifact
return 0 if self.class == other.class return 0 if self.class == other.class

View File

@ -136,6 +136,7 @@ module Cask
Timeout.timeout(10) do Timeout.timeout(10) do
Kernel.loop do Kernel.loop do
next unless quit(bundle_id).success? next unless quit(bundle_id).success?
if running_processes(bundle_id).empty? if running_processes(bundle_id).empty?
puts "Application '#{bundle_id}' quit successfully." puts "Application '#{bundle_id}' quit successfully."
break break
@ -179,9 +180,7 @@ module Cask
# :signal should come after :quit so it can be used as a backup when :quit fails # :signal should come after :quit so it can be used as a backup when :quit fails
def uninstall_signal(*signals, command: nil, **_) def uninstall_signal(*signals, command: nil, **_)
signals.each do |pair| signals.each do |pair|
unless pair.size == 2 raise CaskInvalidError.new(cask, "Each #{stanza} :signal must consist of 2 elements.") unless pair.size == 2
raise CaskInvalidError.new(cask, "Each #{stanza} :signal must consist of 2 elements.")
end
signal, bundle_id = pair signal, bundle_id = pair
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'" ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
@ -244,9 +243,10 @@ module Cask
ohai "Running uninstall script #{executable}" ohai "Running uninstall script #{executable}"
raise CaskInvalidError.new(cask, "#{stanza} :#{directive_name} without :executable.") if executable.nil? raise CaskInvalidError.new(cask, "#{stanza} :#{directive_name} without :executable.") if executable.nil?
executable_path = cask.staged_path.join(executable) executable_path = staged_path_join_executable(executable)
unless executable_path.exist? if (executable_path.absolute? && !executable_path.exist?) ||
(!executable_path.absolute? && (which executable_path).nil?)
message = "uninstall script #{executable} does not exist" message = "uninstall script #{executable} does not exist"
raise CaskError, "#{message}." unless force raise CaskError, "#{message}." unless force
@ -254,7 +254,6 @@ module Cask
return return
end end
command.run("/bin/chmod", args: ["--", "+x", executable_path])
command.run(executable_path, script_arguments) command.run(executable_path, script_arguments)
sleep 1 sleep 1
end end

View File

@ -13,9 +13,7 @@ module Cask
def self.from_args(cask, *args) def self.from_args(cask, *args)
source_string, target_hash = args source_string, target_hash = args
if source_string.nil? raise CaskInvalidError.new(cask.token, "no source given for #{english_name}") if source_string.nil?
raise CaskInvalidError.new(cask.token, "no source given for #{english_name}")
end
unless target_hash.is_a?(Hash) unless target_hash.is_a?(Hash)
raise CaskInvalidError.new(cask.token, "target required for #{english_name} '#{source_string}'") raise CaskInvalidError.new(cask.token, "target required for #{english_name} '#{source_string}'")

View File

@ -26,24 +26,10 @@ module Cask
def install_phase(command: nil, **_) def install_phase(command: nil, **_)
ohai "Running #{self.class.dsl_key} script '#{path}'" ohai "Running #{self.class.dsl_key} script '#{path}'"
absolute_path = if path.absolute? executable_path = staged_path_join_executable(path)
path
else
cask.staged_path.join(path)
end
if absolute_path.exist? && !absolute_path.executable?
FileUtils.chmod "+x", absolute_path
end
executable = if absolute_path.exist?
absolute_path
else
path
end
command.run!( command.run!(
executable, executable_path,
**args, **args,
env: { "PATH" => PATH.new( env: { "PATH" => PATH.new(
HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"] HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"]

View File

@ -46,9 +46,7 @@ module Cask
"-target", "/" "-target", "/"
] ]
args << "-verboseR" if verbose args << "-verboseR" if verbose
if stanza_options.fetch(:allow_untrusted, false) args << "-allowUntrusted" if stanza_options.fetch(:allow_untrusted, false)
args << "-allowUntrusted"
end
with_choices_file do |choices_path| with_choices_file do |choices_path|
args << "-applyChoiceChangesXML" << choices_path if choices_path args << "-applyChoiceChangesXML" << choices_path if choices_path
env = { env = {

View File

@ -4,9 +4,7 @@ module Cask
module Artifact module Artifact
class StageOnly < AbstractArtifact class StageOnly < AbstractArtifact
def self.from_args(cask, *args) def self.from_args(cask, *args)
if args != [true] raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true") if args != [true]
raise CaskInvalidError.new(cask.token, "'stage_only' takes only a single argument: true")
end
new(cask) new(cask)
end end

View File

@ -106,18 +106,14 @@ module Cask
k.directives.key?(:uninstall_preflight) k.directives.key?(:uninstall_preflight)
end end
if count > 1 add_warning "only a single uninstall_preflight stanza is allowed" if count > 1
add_warning "only a single uninstall_preflight stanza is allowed"
end
count = cask.artifacts.count do |k| count = cask.artifacts.count do |k|
k.is_a?(Artifact::PostflightBlock) && k.is_a?(Artifact::PostflightBlock) &&
k.directives.key?(:uninstall_postflight) k.directives.key?(:uninstall_postflight)
end end
if count > 1 add_warning "only a single uninstall_postflight stanza is allowed" if count > 1
add_warning "only a single uninstall_postflight stanza is allowed"
end
return unless cask.artifacts.count { |k| k.is_a?(Artifact::Zap) } > 1 return unless cask.artifacts.count { |k| k.is_a?(Artifact::Zap) } > 1
@ -296,6 +292,7 @@ module Cask
def check_https_availability def check_https_availability
return unless download return unless download
if !cask.url.blank? && !cask.url.using if !cask.url.blank? && !cask.url.using
check_url_for_https_availability(cask.url, user_agents: [cask.url.user_agent]) check_url_for_https_availability(cask.url, user_agents: [cask.url.user_agent])
end end

View File

@ -58,9 +58,7 @@ module Cask
begin begin
instance_eval(content, path).tap do |cask| instance_eval(content, path).tap do |cask|
unless cask.is_a?(Cask) raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.") unless cask.is_a?(Cask)
raise CaskUnreadableError.new(token, "'#{path}' does not contain a cask.")
end
end end
rescue NameError, ArgumentError, ScriptError => e rescue NameError, ArgumentError, ScriptError => e
raise CaskUnreadableError.new(token, e.message) raise CaskUnreadableError.new(token, e.message)
@ -70,9 +68,7 @@ module Cask
private private
def cask(header_token, **options, &block) def cask(header_token, **options, &block)
if token != header_token raise CaskTokenMismatchError.new(token, header_token) if token != header_token
raise CaskTokenMismatchError.new(token, header_token)
end
super(header_token, **options, sourcefile_path: path, &block) super(header_token, **options, sourcefile_path: path, &block)
end end
@ -192,9 +188,7 @@ module Cask
return loader_class.new(ref) if loader_class.can_load?(ref) return loader_class.new(ref) if loader_class.can_load?(ref)
end end
if FromTapPathLoader.can_load?(default_path(ref)) return FromTapPathLoader.new(default_path(ref)) if FromTapPathLoader.can_load?(default_path(ref))
return FromTapPathLoader.new(default_path(ref))
end
case (possible_tap_casks = tap_paths(ref)).count case (possible_tap_casks = tap_paths(ref)).count
when 1 when 1
@ -209,9 +203,7 @@ module Cask
end end
possible_installed_cask = Cask.new(ref) possible_installed_cask = Cask.new(ref)
if possible_installed_cask.installed? return FromPathLoader.new(possible_installed_cask.installed_caskfile) if possible_installed_cask.installed?
return FromPathLoader.new(possible_installed_cask.installed_caskfile)
end
NullLoader.new(ref) NullLoader.new(ref)
end end

View File

@ -63,6 +63,7 @@ module Cask
end end
return if failed.empty? return if failed.empty?
$stderr.puts $stderr.puts
raise CaskError, "Failed merging the following PRs:\n#{failed.join("\n")}" raise CaskError, "Failed merging the following PRs:\n#{failed.join("\n")}"
end end
@ -90,8 +91,10 @@ module Cask
def diff_is_single_cask(diff) def diff_is_single_cask(diff)
return false unless diff.files.count == 1 return false unless diff.files.count == 1
file = diff.files.first file = diff.files.first
return false unless file.a_path == file.b_path return false unless file.a_path == file.b_path
file.a_path.match?(%r{\ACasks/[^/]+\.rb\Z}) file.a_path.match?(%r{\ACasks/[^/]+\.rb\Z})
end end

View File

@ -131,9 +131,7 @@ module Cask
return @language = nil if @language_blocks.nil? || @language_blocks.empty? return @language = nil if @language_blocks.nil? || @language_blocks.empty?
if @language_blocks.default.nil? raise CaskInvalidError.new(cask, "No default language specified.") if @language_blocks.default.nil?
raise CaskInvalidError.new(cask, "No default language specified.")
end
locales = MacOS.languages locales = MacOS.languages
.map do |language| .map do |language|

View File

@ -84,9 +84,7 @@ module Cask
old_config = @cask.config old_config = @cask.config
if @cask.installed? && !force? && !reinstall? && !upgrade? raise CaskAlreadyInstalledError, @cask if @cask.installed? && !force? && !reinstall? && !upgrade?
raise CaskAlreadyInstalledError, @cask
end
check_conflicts check_conflicts
@ -102,9 +100,7 @@ module Cask
install_artifacts install_artifacts
unless @cask.tap&.private? ::Utils::Analytics.report_event("cask_install", @cask.token) unless @cask.tap&.private?
::Utils::Analytics.report_event("cask_install", @cask.token)
end
puts summary puts summary
end end
@ -115,9 +111,7 @@ module Cask
@cask.conflicts_with[:cask].each do |conflicting_cask| @cask.conflicts_with[:cask].each do |conflicting_cask|
begin begin
conflicting_cask = CaskLoader.load(conflicting_cask) conflicting_cask = CaskLoader.load(conflicting_cask)
if conflicting_cask.installed? raise CaskConflictError.new(@cask, conflicting_cask) if conflicting_cask.installed?
raise CaskConflictError.new(@cask, conflicting_cask)
end
rescue CaskUnavailableError rescue CaskUnavailableError
next # Ignore conflicting Casks that do not exist. next # Ignore conflicting Casks that do not exist.
end end

View File

@ -9,17 +9,13 @@ module Cask
def metadata_versioned_path(version: self.version) def metadata_versioned_path(version: self.version)
cask_version = (version || :unknown).to_s cask_version = (version || :unknown).to_s
if cask_version.empty? raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty?
raise CaskError, "Cannot create metadata path with empty version."
end
metadata_master_container_path.join(cask_version) metadata_master_container_path.join(cask_version)
end end
def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false) def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false)
if create && timestamp == :latest raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && timestamp == :latest
raise CaskError, "Cannot create metadata path when timestamp is :latest."
end
path = if timestamp == :latest path = if timestamp == :latest
Pathname.glob(metadata_versioned_path(version: version).join("*")).max Pathname.glob(metadata_versioned_path(version: version).join("*")).max
@ -37,9 +33,7 @@ module Cask
end end
def metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false) def metadata_subdir(leaf, version: self.version, timestamp: :latest, create: false)
if create && timestamp == :latest raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && timestamp == :latest
raise CaskError, "Cannot create metadata subdir when timestamp is :latest."
end
unless leaf.respond_to?(:empty?) && !leaf.empty? unless leaf.respond_to?(:empty?) && !leaf.empty?
raise CaskError, "Cannot create metadata subdir for empty leaf." raise CaskError, "Cannot create metadata subdir for empty leaf."

View File

@ -47,12 +47,8 @@ class Caveats
If you need to have #{f.name} first in your PATH run: If you need to have #{f.name} first in your PATH run:
EOS EOS
if f.bin.directory? s << " #{Utils::Shell.prepend_path_in_profile(f.opt_bin.to_s)}\n" if f.bin.directory?
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_bin.to_s)}\n" s << " #{Utils::Shell.prepend_path_in_profile(f.opt_sbin.to_s)}\n" if f.sbin.directory?
end
if f.sbin.directory?
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_sbin.to_s)}\n"
end
end end
if f.lib.directory? || f.include.directory? if f.lib.directory? || f.include.directory?
@ -61,13 +57,9 @@ class Caveats
For compilers to find #{f.name} you may need to set: For compilers to find #{f.name} you may need to set:
EOS EOS
if f.lib.directory? s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n" if f.lib.directory?
s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n"
end
if f.include.directory? s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n" if f.include.directory?
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n"
end
if which("pkg-config", ENV["HOMEBREW_PATH"]) && if which("pkg-config", ENV["HOMEBREW_PATH"]) &&
((f.lib/"pkgconfig").directory? || (f.share/"pkgconfig").directory?) ((f.lib/"pkgconfig").directory? || (f.share/"pkgconfig").directory?)

View File

@ -25,9 +25,7 @@ class Cleaner
# Get rid of any info 'dir' files, so they don't conflict at the link stage # Get rid of any info 'dir' files, so they don't conflict at the link stage
info_dir_file = @f.info + "dir" info_dir_file = @f.info + "dir"
if info_dir_file.file? && !@f.skip_clean?(info_dir_file) observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
observe_file_removal info_dir_file
end
prune prune
end end
@ -111,9 +109,7 @@ class Cleaner
end end
if ARGV.debug? if ARGV.debug?
old_perms = path.stat.mode & 0777 old_perms = path.stat.mode & 0777
if perms != old_perms puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}"
end
end end
path.chmod perms path.chmod perms
end end

View File

@ -1,4 +1,5 @@
require "utils/bottles" require "utils/bottles"
require "utils/gems"
require "formula" require "formula"
require "cask/cask_loader" require "cask/cask_loader"
require "set" require "set"
@ -58,7 +59,11 @@ module CleanupRefinement
def stale?(scrub = false) def stale?(scrub = false)
return false unless resolved_path.file? return false unless resolved_path.file?
stale_formula?(scrub) || stale_cask?(scrub) if dirname.basename.to_s == "Cask"
stale_cask?(scrub)
else
stale_formula?(scrub)
end
end end
private private
@ -112,17 +117,13 @@ module CleanupRefinement
def stale_cask?(scrub) def stale_cask?(scrub)
return false unless name = basename.to_s[/\A(.*?)\-\-/, 1] return false unless name = basename.to_s[/\A(.*?)\-\-/, 1]
return if dirname.basename.to_s != "Cask"
cask = begin cask = begin
Cask::CaskLoader.load(name) Cask::CaskLoader.load(name)
rescue Cask::CaskUnavailableError rescue Cask::CaskUnavailableError
return false return false
end end
unless basename.to_s.match?(/\A#{Regexp.escape(name)}\-\-#{Regexp.escape(cask.version)}\b/) return true unless basename.to_s.match?(/\A#{Regexp.escape(name)}\-\-#{Regexp.escape(cask.version)}\b/)
return true
end
return true if scrub && !cask.versions.include?(cask.version) return true if scrub && !cask.versions.include?(cask.version)
@ -205,6 +206,7 @@ module Homebrew
# avoid having to try to do a `brew install` when we've just deleted # avoid having to try to do a `brew install` when we've just deleted
# the running Ruby process... # the running Ruby process...
return if periodic return if periodic
cleanup_portable_ruby cleanup_portable_ruby
else else
args.each do |arg| args.each do |arg|
@ -253,6 +255,7 @@ module Homebrew
def cleanup_logs def cleanup_logs
return unless HOMEBREW_LOGS.directory? return unless HOMEBREW_LOGS.directory?
logs_days = if days > CLEANUP_DEFAULT_DAYS logs_days = if days > CLEANUP_DEFAULT_DAYS
CLEANUP_DEFAULT_DAYS CLEANUP_DEFAULT_DAYS
else else
@ -334,9 +337,7 @@ module Homebrew
def cleanup_lockfiles(*lockfiles) def cleanup_lockfiles(*lockfiles)
return if dry_run? return if dry_run?
if lockfiles.empty? && HOMEBREW_LOCKS.directory? lockfiles = HOMEBREW_LOCKS.children.select(&:file?) if lockfiles.empty? && HOMEBREW_LOCKS.directory?
lockfiles = HOMEBREW_LOCKS.children.select(&:file?)
end
lockfiles.each do |file| lockfiles.each do |file|
next unless file.readable? next unless file.readable?
@ -368,6 +369,7 @@ module Homebrew
portable_ruby_glob = "#{portable_ruby_path}/*.*" portable_ruby_glob = "#{portable_ruby_path}/*.*"
Pathname.glob(portable_ruby_glob).each do |path| Pathname.glob(portable_ruby_glob).each do |path|
next if !use_system_ruby && portable_ruby_version == path.basename.to_s next if !use_system_ruby && portable_ruby_version == path.basename.to_s
if dry_run? if dry_run?
puts "Would remove: #{path} (#{path.abv})" puts "Would remove: #{path} (#{path.abv})"
else else

View File

@ -154,6 +154,7 @@ module Homebrew
def formula_options def formula_options
ARGV.formulae.each do |f| ARGV.formulae.each do |f|
next if f.options.empty? next if f.options.empty?
f.options.each do |o| f.options.each do |o|
name = o.flag name = o.flag
description = "`#{f.name}`: #{o.description}" description = "`#{f.name}`: #{o.description}"
@ -220,9 +221,7 @@ module Homebrew
if :mandatory.equal?(constraint_type) && primary_passed && !secondary_passed if :mandatory.equal?(constraint_type) && primary_passed && !secondary_passed
raise OptionConstraintError.new(primary, secondary) raise OptionConstraintError.new(primary, secondary)
end end
if secondary_passed && !primary_passed raise OptionConstraintError.new(primary, secondary, missing: true) if secondary_passed && !primary_passed
raise OptionConstraintError.new(primary, secondary, missing: true)
end
end end
end end
@ -235,11 +234,12 @@ module Homebrew
next if violations.count < 2 next if violations.count < 2
env_var_options = violations.select do |option| env_var_options = violations.select do |option|
@switch_sources[option_to_name(option)] == :env_var @switch_sources[option_to_name(option)] == :env
end end
select_cli_arg = violations.count - env_var_options.count == 1 select_cli_arg = violations.count - env_var_options.count == 1
raise OptionConflictError, violations.map(&method(:name_to_option)) unless select_cli_arg raise OptionConflictError, violations.map(&method(:name_to_option)) unless select_cli_arg
env_var_options.each(&method(:disable_switch)) env_var_options.each(&method(:disable_switch))
end end
end end

View File

@ -21,6 +21,7 @@ module Homebrew
def config def config
config_args.parse config_args.parse
raise UsageError unless args.remaining.empty? raise UsageError unless args.remaining.empty?
SystemConfig.dump_verbose_config SystemConfig.dump_verbose_config
end end
end end

View File

@ -200,9 +200,7 @@ module Homebrew
"" ""
end end
if dep.is_a? Dependency recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true) if dep.is_a? Dependency
recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true)
end
end end
@dep_stack.pop @dep_stack.pop

View File

@ -73,9 +73,7 @@ module Homebrew
end end
url = create_gist(files, descr) url = create_gist(files, descr)
if args.new_issue? url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url) if args.new_issue?
url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url)
end
puts url if url puts url if url
end end

View File

@ -51,6 +51,7 @@ module Homebrew
info_args.parse info_args.parse
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_json print_json
elsif args.github? elsif args.github?
exec_browser(*ARGV.formulae.map { |f| github_info(f) }) exec_browser(*ARGV.formulae.map { |f| github_info(f) })
@ -310,9 +311,7 @@ module Homebrew
def output_analytics(filter: nil) def output_analytics(filter: nil)
days = args.days || "30" days = args.days || "30"
valid_days = %w[30 90 365] valid_days = %w[30 90 365]
unless valid_days.include?(days) raise ArgumentError("Days must be one of #{valid_days.join(", ")}!") unless valid_days.include?(days)
raise ArgumentError("Days must be one of #{valid_days.join(", ")}!")
end
category = args.category || "install" category = args.category || "install"
valid_categories = %w[install install-on-request build-error os-version] valid_categories = %w[install install-on-request build-error os-version]

View File

@ -94,9 +94,7 @@ module Homebrew
unless args.force? unless args.force?
ARGV.named.each do |name| ARGV.named.each do |name|
next if File.exist?(name) next if File.exist?(name)
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
next
end
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2)) tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
tap.install unless tap.installed? tap.install unless tap.installed?
@ -143,14 +141,10 @@ module Homebrew
end end
# --HEAD, fail with no head defined # --HEAD, fail with no head defined
if args.head? && f.head.nil? raise "No head is defined for #{f.full_name}" if args.head? && f.head.nil?
raise "No head is defined for #{f.full_name}"
end
# --devel, fail with no devel defined # --devel, fail with no devel defined
if args.devel? && f.devel.nil? raise "No devel block is defined for #{f.full_name}" if args.devel? && f.devel.nil?
raise "No devel block is defined for #{f.full_name}"
end
installed_head_version = f.latest_head_version installed_head_version = f.latest_head_version
if installed_head_version && if installed_head_version &&

View File

@ -133,9 +133,7 @@ module Homebrew
pinned_versions = {} pinned_versions = {}
names.sort.each do |d| names.sort.each do |d|
keg_pin = (HOMEBREW_PINNED_KEGS/d.basename.to_s) keg_pin = (HOMEBREW_PINNED_KEGS/d.basename.to_s)
if keg_pin.exist? || keg_pin.symlink? pinned_versions[d] = keg_pin.readlink.basename.to_s if keg_pin.exist? || keg_pin.symlink?
pinned_versions[d] = keg_pin.readlink.basename.to_s
end
end end
pinned_versions.each do |d, version| pinned_versions.each do |d, version|
puts d.basename.to_s.concat(args.versions? ? " #{version}" : "") puts d.basename.to_s.concat(args.versions? ? " #{version}" : "")

View File

@ -19,15 +19,16 @@ module Homebrew
description: "List only the names of outdated brews (takes precedence over `--verbose`)." description: "List only the names of outdated brews (takes precedence over `--verbose`)."
switch :verbose, switch :verbose,
description: "Display detailed version information." description: "Display detailed version information."
flag "--json=", flag "--json",
description: "Show output in JSON format for provided <version>. Currently the only "\ description: "Print output in JSON format. Currently the default and only accepted "\
"accepted value of <version> is `v1`." "value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>"
switch "--fetch-HEAD", switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\ description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will be checked for "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\
"updates when a new stable or development version has been released." "updates when a new stable or development version has been released."
switch :debug switch :debug
conflicts "--quiet", "--verbose", "--json=" conflicts "--quiet", "--verbose", "--json"
end end
end end
@ -39,7 +40,9 @@ module Homebrew
else else
ARGV.resolved_formulae ARGV.resolved_formulae
end end
if args.json == "v1" if 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
outdated = print_outdated(formulae) outdated = print_outdated(formulae)

View File

@ -7,10 +7,30 @@
#: Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)` #: Consider adding evaluating the output in your dotfiles (e.g. `~/.profile`) with `eval $(brew shellenv)`
homebrew-shellenv() { homebrew-shellenv() {
echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\"" case "$SHELL" in
echo "export HOMEBREW_CELLAR=\"$HOMEBREW_CELLAR\"" */fish)
echo "export HOMEBREW_REPOSITORY=\"$HOMEBREW_REPOSITORY\"" echo "set -gx HOMEBREW_PREFIX \"$HOMEBREW_PREFIX\";"
echo "export PATH=\"$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH\"" echo "set -gx HOMEBREW_CELLAR \"$HOMEBREW_CELLAR\";"
echo "export MANPATH=\"$HOMEBREW_PREFIX/share/man:\$MANPATH\"" echo "set -gx HOMEBREW_REPOSITORY \"$HOMEBREW_REPOSITORY\";"
echo "export INFOPATH=\"$HOMEBREW_PREFIX/share/info:\$INFOPATH\"" echo "set -g fish_user_paths \"$HOMEBREW_PREFIX/bin\" \"$HOMEBREW_PREFIX/sbin\" \$fish_user_paths;"
echo "set -q MANPATH; or set MANPATH ''; set -gx MANPATH \"$HOMEBREW_PREFIX/share/man\" \$MANPATH;"
echo "set -q INFOPATH; or set INFOPATH ''; set -gx INFOPATH \"$HOMEBREW_PREFIX/share/info\" \$INFOPATH;"
;;
*/csh|*/tcsh)
echo "setenv HOMEBREW_PREFIX $HOMEBREW_PREFIX;"
echo "setenv HOMEBREW_CELLAR $HOMEBREW_CELLAR;"
echo "setenv HOMEBREW_REPOSITORY $HOMEBREW_REPOSITORY;"
echo "setenv PATH $HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH;"
echo "setenv MANPATH $HOMEBREW_PREFIX/share/man:\$MANPATH;"
echo "setenv INFOPATH $HOMEBREW_PREFIX/share/info:\$INFOPATH;"
;;
*)
echo "export HOMEBREW_PREFIX=\"$HOMEBREW_PREFIX\""
echo "export HOMEBREW_CELLAR=\"$HOMEBREW_CELLAR\""
echo "export HOMEBREW_REPOSITORY=\"$HOMEBREW_REPOSITORY\""
echo "export PATH=\"$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:\$PATH\""
echo "export MANPATH=\"$HOMEBREW_PREFIX/share/man:\$MANPATH\""
echo "export INFOPATH=\"$HOMEBREW_PREFIX/share/info:\$INFOPATH\""
;;
esac
} }

View File

@ -13,10 +13,10 @@ module Homebrew
EOS EOS
switch "--installed", switch "--installed",
description: "Display information on all installed taps." description: "Display information on all installed taps."
flag "--json=", flag "--json",
description: "Print a JSON representation of <taps>. Currently the only accepted value for "\ description: "Print a JSON representation of <taps>. Currently the default and only accepted "\
"<version> is `v1`. See the docs for examples of using the JSON output: "\ "value for <version> is `v1`. See the docs for examples of using the JSON "\
"<https://docs.brew.sh/Querying-Brew>" "output: <https://docs.brew.sh/Querying-Brew>"
switch :debug switch :debug
end end
end end
@ -32,7 +32,9 @@ module Homebrew
end end
end end
if args.json == "v1" if 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
print_tap_info(taps.sort_by(&:to_s)) print_tap_info(taps.sort_by(&:to_s))

View File

@ -75,9 +75,7 @@ module Homebrew
puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n" puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
# Consider the message possibly missed if not a TTY. # Consider the message possibly missed if not a TTY.
if $stdout.tty? safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true" if $stdout.tty?
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true"
end
end end
end end
@ -88,9 +86,7 @@ module Homebrew
initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].to_s initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].to_s
current_revision = ENV["HOMEBREW_UPDATE_AFTER"].to_s current_revision = ENV["HOMEBREW_UPDATE_AFTER"].to_s
if initial_revision.empty? || current_revision.empty? odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty?
odie "update-report should not be called directly!"
end
if initial_revision != current_revision if initial_revision != current_revision
update_preinstall_header update_preinstall_header
@ -121,9 +117,7 @@ module Homebrew
end end
if !updated if !updated
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"] puts "Already up-to-date." if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
puts "Already up-to-date."
end
else else
if hub.empty? if hub.empty?
puts "No changes to formulae." puts "No changes to formulae."

View File

@ -25,7 +25,7 @@ git_init_if_necessary() {
then then
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/homebrew-core" CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/homebrew-core"
else else
CORE_OFFICIAL_REMOTE="https://github.com/Linuxbrew/homebrew-core" CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/linuxbrew-core"
fi fi
safe_cd "$HOMEBREW_REPOSITORY" safe_cd "$HOMEBREW_REPOSITORY"

View File

@ -29,6 +29,11 @@ then
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.x86_64_linux.bottle.tar.gz" ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.x86_64_linux.bottle.tar.gz"
ruby_SHA="9df214085a0e566a580eea3dd9eab14a2a94930ff74fbf97fb1284e905c8921d" ruby_SHA="9df214085a0e566a580eea3dd9eab14a2a94930ff74fbf97fb1284e905c8921d"
;; ;;
aarch64)
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.aarch64_linux.bottle.tar.gz"
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.aarch64_linux.bottle.tar.gz"
ruby_SHA="e5a72a9deabe500d5d2eaed29e2eb84868ade962eda3ddc68ea169adbb7ac5a2"
;;
armv[67]*) armv[67]*)
ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz" ruby_URL="$HOMEBREW_BOTTLE_DOMAIN/bottles-portable-ruby/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz"
ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz" ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.7/portable-ruby-2.3.7.armv6_linux.bottle.tar.gz"

View File

@ -18,9 +18,7 @@ class CompilerFailure
def version(val = nil) def version(val = nil)
if val if val
@version = Version.parse(val.to_s) @version = Version.parse(val.to_s)
if name.to_s == "clang" && val.to_i < 600 odisabled "'fails_with :clang' with 'build' < 600" if name.to_s == "clang" && val.to_i < 600
odisabled "'fails_with :clang' with 'build' < 600"
end
end end
@version @version
end end

View File

@ -1,6 +1,4 @@
unless ENV["HOMEBREW_BREW_FILE"] raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
end
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX` # Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]) HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
@ -8,9 +6,8 @@ HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
class MissingEnvironmentVariables < RuntimeError; end class MissingEnvironmentVariables < RuntimeError; end
def get_env_or_raise(env) def get_env_or_raise(env)
unless ENV[env] raise MissingEnvironmentVariables, "#{env} was not exported!" unless ENV[env]
raise MissingEnvironmentVariables, "#{env} was not exported!"
end
ENV[env] ENV[env]
end end

View File

@ -13,9 +13,7 @@ class CxxStdlib
end end
def self.create(type, compiler) def self.create(type, compiler)
if type && ![:libstdcxx, :libcxx].include?(type) raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && ![:libstdcxx, :libcxx].include?(type)
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
end
klass = (compiler.to_s =~ GNU_GCC_REGEXP) ? GnuStdlib : AppleStdlib klass = (compiler.to_s =~ GNU_GCC_REGEXP) ? GnuStdlib : AppleStdlib
klass.new(type, compiler) klass.new(type, compiler)
@ -60,9 +58,7 @@ class CxxStdlib
next if dep.build? next if dep.build?
dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib dep_stdlib = Tab.for_formula(dep.to_formula).cxxstdlib
unless compatible_with? dep_stdlib raise CompatibilityError.new(formula, dep, dep_stdlib) unless compatible_with? dep_stdlib
raise CompatibilityError.new(formula, dep, dep_stdlib)
end
end end
end end

View File

@ -95,21 +95,15 @@ module Homebrew
formula.send("recursive_#{type}") do |dependent, dep| formula.send("recursive_#{type}") do |dependent, dep|
if dep.recommended? if dep.recommended?
if ignores.include?("recommended?") || dependent.build.without?(dep) klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
klass.prune
end
elsif dep.test? elsif dep.test?
if includes.include?("test?") if includes.include?("test?")
if type == :dependencies Dependency.keep_but_prune_recursive_deps if type == :dependencies
Dependency.keep_but_prune_recursive_deps
end
else else
klass.prune klass.prune
end end
elsif dep.optional? elsif dep.optional?
if !includes.include?("optional?") && !dependent.build.with?(dep) klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep)
klass.prune
end
elsif dep.build? elsif dep.build?
klass.prune unless includes.include?("build?") klass.prune unless includes.include?("build?")
end end

View File

@ -134,9 +134,7 @@ class DependencyCollector
end end
def parse_class_spec(spec, tags) def parse_class_spec(spec, tags)
unless spec < Requirement raise TypeError, "#{spec.inspect} is not a Requirement subclass" unless spec < Requirement
raise TypeError, "#{spec.inspect} is not a Requirement subclass"
end
spec.new(tags) spec.new(tags)
end end

View File

@ -136,9 +136,7 @@ module Homebrew
created_pr_comment = false created_pr_comment = false
if new_formula && !new_formula_problem_lines.empty? if new_formula && !new_formula_problem_lines.empty?
begin begin
if GitHub.create_issue_comment(new_formula_problem_lines.join("\n")) created_pr_comment = true if GitHub.create_issue_comment(new_formula_problem_lines.join("\n"))
created_pr_comment = true
end
rescue *GitHub.api_errors => e rescue *GitHub.api_errors => e
opoo "Unable to create issue comment: #{e.message}" opoo "Unable to create issue comment: #{e.message}"
end end
@ -154,9 +152,7 @@ module Homebrew
formula_plural = "#{formula_count} #{"formula".pluralize(formula_count)}" formula_plural = "#{formula_count} #{"formula".pluralize(formula_count)}"
corrected_problem_plural = "#{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)}" corrected_problem_plural = "#{corrected_problem_count} #{"problem".pluralize(corrected_problem_count)}"
errors_summary = "#{problem_plural} in #{formula_plural} detected" errors_summary = "#{problem_plural} in #{formula_plural} detected"
if corrected_problem_count.positive? errors_summary += ", #{corrected_problem_plural} corrected" if corrected_problem_count.positive?
errors_summary += ", #{corrected_problem_plural} corrected"
end
if problem_count.positive? || if problem_count.positive? ||
(new_formula_problem_count.positive? && !created_pr_comment) (new_formula_problem_count.positive? && !created_pr_comment)
@ -263,9 +259,7 @@ module Homebrew
problem "'DATA' was found, but no '__END__'" if text.data? && !text.end? problem "'DATA' was found, but no '__END__'" if text.data? && !text.end?
if text.end? && !text.data? problem "'__END__' was found, but 'DATA' is not used" if text.end? && !text.data?
problem "'__END__' was found, but 'DATA' is not used"
end
if text =~ /inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m if text =~ /inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)." problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
@ -344,9 +338,7 @@ module Homebrew
name = formula.name name = formula.name
if MissingFormula.blacklisted_reason(name) problem "'#{name}' is blacklisted." if MissingFormula.blacklisted_reason(name)
problem "'#{name}' is blacklisted."
end
if Formula.aliases.include? name if Formula.aliases.include? name
problem "Formula name conflicts with existing aliases." problem "Formula name conflicts with existing aliases."
@ -394,10 +386,10 @@ module Homebrew
problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'." problem "Dependency '#{dep.name}' is an alias; use the canonical name '#{dep.to_formula.full_name}'."
end end
if @new_formula && dep_f.keg_only_reason && if @new_formula &&
!["openssl", "apr", "apr-util"].include?(dep.name) && dep_f.keg_only_reason&.reason == :provided_by_macos &&
!["openblas"].include?(dep.name) && dep_f.keg_only_reason.valid? &&
dep_f.keg_only_reason.reason == :provided_by_macos !["apr", "apr-util", "openblas", "openssl"].include?(dep.name)
new_formula_problem( new_formula_problem(
"Dependency '#{dep.name}' may be unnecessary as it is provided " \ "Dependency '#{dep.name}' may be unnecessary as it is provided " \
"by macOS; try to build this formula without it.", "by macOS; try to build this formula without it.",
@ -418,13 +410,9 @@ module Homebrew
problem "Dependency #{dep} does not define option #{opt.name.inspect}" problem "Dependency #{dep} does not define option #{opt.name.inspect}"
end end
if dep.name == "git" problem "Don't use git as a dependency (it's always available)" if dep.name == "git"
problem "Don't use git as a dependency (it's always available)"
end
if dep.tags.include?(:run) problem "Dependency '#{dep.name}' is marked as :run. Remove :run; it is a no-op." if dep.tags.include?(:run)
problem "Dependency '#{dep.name}' is marked as :run. Remove :run; it is a no-op."
end
next unless @core_tap next unless @core_tap
@ -565,11 +553,10 @@ module Homebrew
return unless formula.bottle_disabled? return unless formula.bottle_disabled?
return if formula.bottle_unneeded? return if formula.bottle_unneeded?
unless formula.bottle_disable_reason.valid? problem "Unrecognized bottle modifier" unless formula.bottle_disable_reason.valid?
problem "Unrecognized bottle modifier"
end
return unless @core_tap return unless @core_tap
problem "Formulae should not use `bottle :disabled`" problem "Formulae should not use `bottle :disabled`"
end end
@ -635,9 +622,7 @@ module Homebrew
next unless spec = formula.send(name.downcase) next unless spec = formula.send(name.downcase)
version = spec.version version = spec.version
if version.to_s !~ /\d/ problem "#{name}: version (#{version}) is set to a string without a digit" if version.to_s !~ /\d/
problem "#{name}: version (#{version}) is set to a string without a digit"
end
if version.to_s.start_with?("HEAD") if version.to_s.start_with?("HEAD")
problem "#{name}: non-HEAD version name (#{version}) should not begin with HEAD" problem "#{name}: non-HEAD version name (#{version}) should not begin with HEAD"
end end
@ -655,18 +640,14 @@ module Homebrew
problem "Formulae should not have a `devel` spec" if formula.devel problem "Formulae should not have a `devel` spec" if formula.devel
if formula.head if formula.head && @versioned_formula
head_spec_message = "Formulae should not have a `HEAD` spec" head_spec_message = "Formulae should not have a `HEAD` spec"
if @new_formula versioned_head_spec = %w[
new_formula_problem head_spec_message bash-completion@2
elsif @versioned_formula imagemagick@6
versioned_head_spec = %w[ python@2
bash-completion@2 ]
imagemagick@6 problem head_spec_message unless versioned_head_spec.include?(formula.name)
python@2
]
problem head_spec_message unless versioned_head_spec.include?(formula.name)
end
end end
throttled = %w[ throttled = %w[
@ -733,9 +714,7 @@ module Homebrew
version = Version.parse(stable.url) version = Version.parse(stable.url)
if version >= Version.create("1.0") if version >= Version.create("1.0")
_, minor_version, = version.to_s.split(".", 3).map(&:to_i) _, minor_version, = version.to_s.split(".", 3).map(&:to_i)
if minor_version.odd? problem "#{stable.version} is a development release" if minor_version.odd?
problem "#{stable.version} is a development release"
end
end end
end end
end end
@ -875,9 +854,7 @@ module Homebrew
return unless @strict return unless @strict
if line.include?("env :userpaths") problem "`env :userpaths` in formulae is deprecated" if line.include?("env :userpaths")
problem "`env :userpaths` in formulae is deprecated"
end
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/ if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
bad_system = Regexp.last_match(1) bad_system = Regexp.last_match(1)
@ -904,6 +881,7 @@ module Homebrew
return unless @core_tap return unless @core_tap
return unless line.include?("env :std") return unless line.include?("env :std")
problem "`env :std` in `core` formulae is deprecated" problem "`env :std` in `core` formulae is deprecated"
end end
@ -954,9 +932,7 @@ module Homebrew
def audit def audit
only_audits = @only only_audits = @only
except_audits = @except except_audits = @except
if only_audits && except_audits odie "--only and --except cannot be used simultaneously!" if only_audits && except_audits
odie "--only and --except cannot be used simultaneously!"
end
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_/, "")
@ -1027,9 +1003,7 @@ module Homebrew
end end
end end
if version.to_s.start_with?("v") problem "version #{version} should not have a leading 'v'" if version.to_s.start_with?("v")
problem "version #{version} should not have a leading 'v'"
end
return unless version.to_s =~ /_\d+$/ return unless version.to_s =~ /_\d+$/
@ -1044,9 +1018,7 @@ module Homebrew
url_strategy = DownloadStrategyDetector.detect(url) url_strategy = DownloadStrategyDetector.detect(url)
if using == :git || url_strategy == GitDownloadStrategy if using == :git || url_strategy == GitDownloadStrategy
if specs[:tag] && !specs[:revision] problem "Git should specify :revision when a :tag is specified." if specs[:tag] && !specs[:revision]
problem "Git should specify :revision when a :tag is specified."
end
end end
return unless using return unless using
@ -1101,16 +1073,12 @@ module Homebrew
problem http_content_problem problem http_content_problem
end end
elsif strategy <= GitDownloadStrategy elsif strategy <= GitDownloadStrategy
unless Utils.git_remote_exists? url problem "The URL #{url} is not a valid git URL" unless Utils.git_remote_exists? url
problem "The URL #{url} is not a valid git URL"
end
elsif strategy <= SubversionDownloadStrategy elsif strategy <= SubversionDownloadStrategy
next unless DevelopmentTools.subversion_handles_most_https_certificates? next unless DevelopmentTools.subversion_handles_most_https_certificates?
next unless Utils.svn_available? next unless Utils.svn_available?
unless Utils.svn_remote_exists? url problem "The URL #{url} is not a valid svn URL" unless Utils.svn_remote_exists? url
problem "The URL #{url} is not a valid svn URL"
end
end end
end end
end end

View File

@ -205,14 +205,10 @@ module Homebrew
end end
def bottle_formula(f) def bottle_formula(f)
unless f.installed? 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}"
end
unless tap = f.tap unless tap = f.tap
unless args.force_core_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}"
end
tap = CoreTap.instance tap = CoreTap.instance
end end
@ -223,9 +219,7 @@ module Homebrew
return return
end end
unless Utils::Bottles.built_as? f return ofail "Formula not installed with '--build-bottle': #{f.full_name}" unless Utils::Bottles.built_as? f
return ofail "Formula not installed with '--build-bottle': #{f.full_name}"
end
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
@ -265,9 +259,7 @@ module Homebrew
begin begin
keg.delete_pyc_files! keg.delete_pyc_files!
unless args.skip_relocation? changed_files = keg.replace_locations_with_placeholders unless args.skip_relocation?
changed_files = keg.replace_locations_with_placeholders
end
Tab.clear_cache Tab.clear_cache
tab = Tab.for_keg(keg) tab = Tab.for_keg(keg)
@ -300,9 +292,7 @@ module Homebrew
mv "#{relocatable_tar_path}.gz", bottle_path mv "#{relocatable_tar_path}.gz", bottle_path
end end
if bottle_path.size > 1 * 1024 * 1024 ohai "Detecting if #{filename} is relocatable..." if bottle_path.size > 1 * 1024 * 1024
ohai "Detecting if #{filename} is relocatable..."
end
if Homebrew.default_prefix?(prefix) if Homebrew.default_prefix?(prefix)
prefix_check = File.join(prefix, "opt") prefix_check = File.join(prefix, "opt")
@ -344,9 +334,7 @@ module Homebrew
ensure ensure
ignore_interrupts do ignore_interrupts do
original_tab&.write original_tab&.write
unless args.skip_relocation? keg.replace_placeholders_with_locations changed_files unless args.skip_relocation?
keg.replace_placeholders_with_locations changed_files
end
end end
end end
end end
@ -510,9 +498,7 @@ module Homebrew
string = s.sub!(/ bottle do.+?end\n/m, output) string = s.sub!(/ bottle do.+?end\n/m, output)
odie "Bottle block update failed!" unless string odie "Bottle block update failed!" unless string
else else
if args.keep_old? odie "--keep-old was passed but there was no existing bottle block!" if args.keep_old?
odie "--keep-old was passed but there was no existing bottle block!"
end
puts output puts output
update_or_add = "add" update_or_add = "add"
if s.include? "stable do" if s.include? "stable do"

View File

@ -331,6 +331,7 @@ module Homebrew
username = response.fetch("owner").fetch("login") username = response.fetch("owner").fetch("login")
rescue GitHub::AuthenticationFailedError => e rescue GitHub::AuthenticationFailedError => e
raise unless e.github_message =~ /forking is disabled/ raise unless e.github_message =~ /forking is disabled/
# If the repository is private, forking might be disabled. # If the repository is private, forking might be disabled.
# Create branches in the repository itself instead. # Create branches in the repository itself instead.
remote_url = Utils.popen_read("git remote get-url --push origin").chomp remote_url = Utils.popen_read("git remote get-url --push origin").chomp
@ -380,30 +381,20 @@ module Homebrew
contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read }
contents.extend(StringInreplaceExtension) contents.extend(StringInreplaceExtension)
replacement_pairs.each do |old, new| replacement_pairs.each do |old, new|
unless Homebrew.args.quiet? ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
ohai "replace #{old.inspect} with #{new.inspect}" raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
end
unless old
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
end
contents.gsub!(old, new) contents.gsub!(old, new)
end end
unless contents.errors.empty? raise Utils::InreplaceError, path => contents.errors unless contents.errors.empty?
raise Utils::InreplaceError, path => contents.errors
end
path.atomic_write(contents) if args.write? path.atomic_write(contents) if args.write?
contents contents
else else
Utils::Inreplace.inreplace(path) do |s| Utils::Inreplace.inreplace(path) do |s|
replacement_pairs.each do |old, new| replacement_pairs.each do |old, new|
unless Homebrew.args.quiet? ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
ohai "replace #{old.inspect} with #{new.inspect}" raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
end
unless old
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
end
s.gsub!(old, new) s.gsub!(old, new)
end end

View File

@ -5,38 +5,28 @@ require "tap"
def with_monkey_patch def with_monkey_patch
BottleSpecification.class_eval do BottleSpecification.class_eval do
if method_defined?(:method_missing) alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
alias_method :old_method_missing, :method_missing
end
define_method(:method_missing) { |*| } define_method(:method_missing) { |*| }
end end
Module.class_eval do Module.class_eval do
if method_defined?(:method_missing) alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
alias_method :old_method_missing, :method_missing
end
define_method(:method_missing) { |*| } define_method(:method_missing) { |*| }
end end
Resource.class_eval do Resource.class_eval do
if method_defined?(:method_missing) alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
alias_method :old_method_missing, :method_missing
end
define_method(:method_missing) { |*| } define_method(:method_missing) { |*| }
end end
DependencyCollector.class_eval do DependencyCollector.class_eval do
if method_defined?(:parse_symbol_spec) alias_method :old_parse_symbol_spec, :parse_symbol_spec if method_defined?(:parse_symbol_spec)
alias_method :old_parse_symbol_spec, :parse_symbol_spec
end
define_method(:parse_symbol_spec) { |*| } define_method(:parse_symbol_spec) { |*| }
end end
if defined?(DependencyCollector::Compat) if defined?(DependencyCollector::Compat)
DependencyCollector::Compat.class_eval do DependencyCollector::Compat.class_eval do
if method_defined?(:parse_string_spec) alias_method :old_parse_string_spec, :parse_string_spec if method_defined?(:parse_string_spec)
alias_method :old_parse_string_spec, :parse_string_spec
end
define_method(:parse_string_spec) { |*| } define_method(:parse_string_spec) { |*| }
end end
end end

View File

@ -34,9 +34,7 @@ module Homebrew
raise UsageError unless ARGV.named.empty? raise UsageError unless ARGV.named.empty?
if args.link? 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`."
end
regenerate_man_pages regenerate_man_pages
@ -68,16 +66,16 @@ module Homebrew
readme = HOMEBREW_REPOSITORY/"README.md" readme = HOMEBREW_REPOSITORY/"README.md"
variables[:lead] = variables[:lead] =
readme.read[/(Homebrew's project lead .*\.)/, 1] readme.read[/(Homebrew's \[Project Leader.*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:plc] = variables[:plc] =
readme.read[/(Homebrew's project leadership committee .*\.)/, 1] readme.read[/(Homebrew's \[Project Leadership Committee.*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:tsc] = variables[:tsc] =
readme.read[/(Homebrew's technical steering committee .*\.)/, 1] readme.read[/(Homebrew's \[Technical Steering Committee.*\.)/, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:linux] = variables[:linux] =
readme.read[%r{(Homebrew/brew's Linux support \(and Linuxbrew\) maintainers are .*\.)}, 1] readme.read[%r{(Homebrew/brew's Linux support \(and Linuxbrew\) maintainers .*\.)}, 1]
.gsub(/\[([^\]]+)\]\([^)]+\)/, '\1') .gsub(/\[([^\]]+)\]\([^)]+\)/, '\1')
variables[:maintainers] = variables[:maintainers] =
readme.read[/(Homebrew's other current maintainers .*\.)/, 1] readme.read[/(Homebrew's other current maintainers .*\.)/, 1]
@ -157,9 +155,11 @@ module Homebrew
cmd_man_page_lines = begin cmd_man_page_lines = begin
cmd_parser = Homebrew.send(cmd_args_method_name) cmd_parser = Homebrew.send(cmd_args_method_name)
next if cmd_parser.hide_from_man_page next if cmd_parser.hide_from_man_page
cmd_parser_manpage_lines(cmd_parser).join cmd_parser_manpage_lines(cmd_parser).join
rescue NoMethodError => e rescue NoMethodError => e
raise if e.name != cmd_args_method_name raise if e.name != cmd_args_method_name
nil nil
end end
cmd_man_page_lines ||= cmd_comment_manpage_lines(cmd_path) cmd_man_page_lines ||= cmd_comment_manpage_lines(cmd_path)
@ -178,6 +178,7 @@ module Homebrew
lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines = [format_usage_banner(cmd_parser.usage_banner_text)]
lines += cmd_parser.processed_options.map do |short, long, _, desc| lines += cmd_parser.processed_options.map do |short, long, _, desc|
next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long)) next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long))
generate_option_doc(short, long, desc) generate_option_doc(short, long, desc)
end.reject(&:blank?) end.reject(&:blank?)
lines lines
@ -187,11 +188,13 @@ module Homebrew
comment_lines = cmd_path.read.lines.grep(/^#:/) comment_lines = cmd_path.read.lines.grep(/^#:/)
return if comment_lines.empty? return if comment_lines.empty?
return if comment_lines.first.include?("@hide_from_man_page") return if comment_lines.first.include?("@hide_from_man_page")
lines = [format_usage_banner(comment_lines.first).chomp] lines = [format_usage_banner(comment_lines.first).chomp]
comment_lines.slice(1..-1) comment_lines.slice(1..-1)
.each do |line| .each do |line|
line = line.slice(4..-1) line = line.slice(4..-1)
next unless line next unless line
lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ") lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ")
end end
lines lines

View File

@ -23,9 +23,7 @@ module Homebrew
bintray_user = ENV["HOMEBREW_BINTRAY_USER"] bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
if !bintray_user || !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!"
end
ARGV.formulae.each do |f| ARGV.formulae.each do |f|
bintray_package = Utils::Bottles::Bintray.package f.name bintray_package = Utils::Bottles::Bintray.package f.name

View File

@ -66,17 +66,11 @@ module Homebrew
pull_args.parse pull_args.parse
if ARGV.named.empty? odie "This command requires at least one argument containing a URL or pull request number" if ARGV.named.empty?
odie "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
if ENV["HOMEBREW_GIT_NAME"] ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"]
end
if ENV["HOMEBREW_GIT_EMAIL"]
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"]
end
# Depending on user configuration, git may try to invoke gpg. # Depending on user configuration, git may try to invoke gpg.
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true" if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
@ -115,17 +109,15 @@ module Homebrew
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}"
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-") tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX) elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
url, user, repo, issue = *url_match url, user, repo, issue = *url_match
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-") tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
else else
odie "Not a GitHub pull request or commit: #{arg}" odie "Not a GitHub pull request or commit: #{arg}"
end end
if !testing_job && args.bottle? && issue.nil? odie "No pull request detected!" if !testing_job && args.bottle? && issue.nil?
odie "No pull request detected!"
end
if tap if tap
tap.install unless tap.installed? tap.install unless tap.installed?
@ -157,9 +149,7 @@ module Homebrew
end end
odie "Can not bump if non-formula files are changed" unless patch_changes[:others].empty? odie "Can not bump if non-formula files are changed" unless patch_changes[:others].empty?
end end
if is_bumpable old_versions = current_versions_from_info_external(patch_changes[:formulae].first) if is_bumpable
old_versions = current_versions_from_info_external(patch_changes[:formulae].first)
end
patch_puller.apply_patch patch_puller.apply_patch
changed_formulae_names = [] changed_formulae_names = []
@ -288,9 +278,7 @@ module Homebrew
end end
def publish_changed_formula_bottles(tap, changed_formulae_names) def publish_changed_formula_bottles(tap, changed_formulae_names)
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Need to load formulae to publish them!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Need to load formulae to publish them!"
end
published = [] published = []
bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] } bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] }
@ -458,9 +446,7 @@ module Homebrew
repo = Utils::Bottles::Bintray.repository(f.tap) repo = Utils::Bottles::Bintray.repository(f.tap)
package = Utils::Bottles::Bintray.package(f.name) package = Utils::Bottles::Bintray.package(f.name)
info = FormulaInfoFromJson.lookup(f.full_name) info = FormulaInfoFromJson.lookup(f.full_name)
if info.nil? raise "Failed publishing bottle: failed reading formula info for #{f.full_name}" if info.nil?
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}"
end
unless info.bottle_info_any unless info.bottle_info_any
opoo "No bottle defined in formula #{package}" opoo "No bottle defined in formula #{package}"
@ -562,9 +548,7 @@ module Homebrew
def verify_bintray_published(formulae_names) def verify_bintray_published(formulae_names)
return if formulae_names.empty? return if formulae_names.empty?
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Need to load formulae to verify their publication!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Need to load formulae to verify their publication!"
end
ohai "Verifying bottles published on Bintray" ohai "Verifying bottles published on Bintray"
formulae = formulae_names.map { |n| Formula[n] } formulae = formulae_names.map { |n| Formula[n] }
@ -605,9 +589,7 @@ module Homebrew
raise "Failed to find published #{f} bottle at #{url} (#{res.code} #{res.message})!" raise "Failed to find published #{f} bottle at #{url} (#{res.code} #{res.message})!"
end end
if retry_count >= max_retries raise "Failed to find published #{f} bottle at #{url}!" if retry_count >= max_retries
raise "Failed to find published #{f} bottle at #{url}!"
end
print(wrote_dots ? "." : "Waiting on Bintray.") print(wrote_dots ? "." : "Waiting on Bintray.")
wrote_dots = true wrote_dots = true
@ -630,9 +612,7 @@ module Homebrew
curl_download url, to: filename curl_download url, to: filename
break break
rescue rescue
if retry_count >= max_curl_retries raise "Failed to download #{f} bottle from #{url}!" if retry_count >= max_curl_retries
raise "Failed to download #{f} bottle from #{url}!"
end
puts "curl download failed; retrying in #{curl_retry_delay_seconds} sec" puts "curl download failed; retrying in #{curl_retry_delay_seconds} sec"
sleep curl_retry_delay_seconds sleep curl_retry_delay_seconds

View File

@ -33,6 +33,9 @@ module Homebrew
def tests def tests
tests_args.parse tests_args.parse
Homebrew.install_bundler_gems!
gem_user_dir = Gem.user_dir
HOMEBREW_LIBRARY_PATH.cd do HOMEBREW_LIBRARY_PATH.cd do
ENV.delete("HOMEBREW_COLOR") ENV.delete("HOMEBREW_COLOR")
ENV.delete("HOMEBREW_NO_COLOR") ENV.delete("HOMEBREW_NO_COLOR")
@ -44,11 +47,14 @@ module Homebrew
ENV.delete("HOMEBREW_NO_GITHUB_API") ENV.delete("HOMEBREW_NO_GITHUB_API")
ENV.delete("HOMEBREW_NO_EMOJI") ENV.delete("HOMEBREW_NO_EMOJI")
ENV.delete("HOMEBREW_DEVELOPER") ENV.delete("HOMEBREW_DEVELOPER")
ENV.delete("HOMEBREW_PRY")
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat? ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat?
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic? ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online? ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp
# Avoid local configuration messing with tests e.g. git being configured # Avoid local configuration messing with tests e.g. git being configured
# to use GPG to sign by default # to use GPG to sign by default
ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test" ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test"
@ -66,8 +72,6 @@ module Homebrew
ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000"
end end
Homebrew.install_bundler_gems!
parallel = true parallel = true
files = if args.only files = if args.only
@ -80,10 +84,10 @@ module Homebrew
["test/#{test_name}_spec.rb:#{line}"] ["test/#{test_name}_spec.rb:#{line}"]
end end
else else
Dir.glob("test/**/*_spec.rb").reject { |p| p =~ %r{^test/vendor/bundle/} } Dir.glob("test/**/*_spec.rb")
end end
opts = if ENV["CI"] parallel_args = if ENV["CI"]
%w[ %w[
--combine-stderr --combine-stderr
--serialize-stdout --serialize-stdout
@ -120,8 +124,11 @@ module Homebrew
puts "Randomized with seed #{seed}" puts "Randomized with seed #{seed}"
# Let `bundle` in PATH find its gem.
ENV["GEM_PATH"] = "#{ENV["GEM_PATH"]}:#{gem_user_dir}"
if parallel if parallel
system "bundle", "exec", "parallel_rspec", *opts, "--", *bundle_args, "--", *files system "bundle", "exec", "parallel_rspec", *parallel_args, "--", *bundle_args, "--", *files
else else
system "bundle", "exec", "rspec", *bundle_args, "--", *files system "bundle", "exec", "rspec", *bundle_args, "--", *files
end end

View File

@ -20,13 +20,16 @@ module Homebrew
Homebrew.install_bundler! Homebrew.install_bundler!
ohai "cd #{HOMEBREW_LIBRARY_PATH}/vendor" ohai "cd #{HOMEBREW_LIBRARY_PATH}"
(HOMEBREW_LIBRARY_PATH/"vendor").cd do HOMEBREW_LIBRARY_PATH.cd do
ohai "bundle pristine"
safe_system "bundle", "pristine"
ohai "bundle install --standalone" ohai "bundle install --standalone"
safe_system "bundle", "install", "--standalone" safe_system "bundle", "install", "--standalone"
ohai "git add bundle-standalone" ohai "git add vendor/bundle"
system "git", "add", "bundle-standalone" system "git", "add", "vendor/bundle"
if Formula["gpg"].installed? if Formula["gpg"].installed?
ENV["PATH"] = PATH.new(ENV["PATH"]) ENV["PATH"] = PATH.new(ENV["PATH"])

View File

@ -106,6 +106,32 @@ module Homebrew
EOS EOS
end end
def examine_git_origin(repository_path, desired_origin)
return if !Utils.git_available? || !repository_path.git?
current_origin = repository_path.git_origin
if current_origin.nil?
<<~EOS
Missing #{desired_origin} git origin remote.
Without a correctly configured origin, Homebrew won't update
properly. You can solve this by adding the remote:
git -C "#{repository_path}" remote add origin #{Formatter.url("https://github.com/#{desired_origin}.git")}
EOS
elsif current_origin !~ %r{#{desired_origin}(\.git|/)?$}i
<<~EOS
Suspicious #{desired_origin} git origin remote found.
The current git origin is:
#{current_origin}
With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
git -C "#{repository_path}" remote set-url origin #{Formatter.url("https://github.com/#{desired_origin}.git")}
EOS
end
end
def check_for_installed_developer_tools def check_for_installed_developer_tools
return if DevelopmentTools.installed? return if DevelopmentTools.installed?
@ -278,9 +304,7 @@ module Homebrew
next unless d.directory? next unless d.directory?
d.find do |path| d.find do |path|
if path.symlink? && !path.resolved_path_exists? broken_symlinks << path if path.symlink? && !path.resolved_path_exists?
broken_symlinks << path
end
end end
end end
return if broken_symlinks.empty? return if broken_symlinks.empty?
@ -531,60 +555,16 @@ module Homebrew
end end
def check_brew_git_origin def check_brew_git_origin
return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist? examine_git_origin(HOMEBREW_REPOSITORY, "Homebrew/brew")
origin = HOMEBREW_REPOSITORY.git_origin
if origin.nil?
<<~EOS
Missing Homebrew/brew git origin remote.
Without a correctly configured origin, Homebrew won't update
properly. You can solve this by adding the Homebrew remote:
git -C "#{HOMEBREW_REPOSITORY}" remote add origin #{Formatter.url("https://github.com/Homebrew/brew.git")}
EOS
elsif origin !~ %r{Homebrew/brew(\.git|/)?$}
<<~EOS
Suspicious Homebrew/brew git origin remote found.
With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:
#{origin}
Unless you have compelling reasons, consider setting the
origin remote to point at the main repository by running:
git -C "#{HOMEBREW_REPOSITORY}" remote set-url origin #{Formatter.url("https://github.com/Homebrew/brew.git")}
EOS
end
end end
def check_coretap_git_origin def check_coretap_git_origin
coretap_path = CoreTap.instance.path examine_git_origin(CoreTap.instance.path, CoreTap.instance.full_name)
return if !Utils.git_available? || !(coretap_path/".git").exist? end
origin = coretap_path.git_origin def check_casktap_git_origin
cask = Tap.default_cask_tap
if origin.nil? examine_git_origin(cask.path, cask.full_name) if cask.installed?
<<~EOS
Missing #{CoreTap.instance} git origin remote.
Without a correctly configured origin, Homebrew won't update
properly. You can solve this by adding the Homebrew remote:
git -C "#{coretap_path}" remote add origin #{Formatter.url(CoreTap.instance.default_remote)}
EOS
elsif origin !~ %r{#{CoreTap.instance.full_name}(\.git|/)?$}i
<<~EOS
Suspicious #{CoreTap.instance} git origin remote found.
With a non-standard origin, Homebrew won't pull updates from
the main repository. The current git origin is:
#{origin}
Unless you have compelling reasons, consider setting the
origin remote to point at the main repository by running:
git -C "#{coretap_path}" remote set-url origin #{Formatter.url(CoreTap.instance.default_remote)}
EOS
end
end end
def check_coretap_git_branch def check_coretap_git_branch
@ -611,7 +591,7 @@ module Homebrew
<<~EOS <<~EOS
You have the following deprecated, official taps tapped: You have the following deprecated, official taps tapped:
Homebrew/homebrew-#{tapped_deprecated_taps.join("\n ")} Homebrew/homebrew-#{tapped_deprecated_taps.join("\n Homebrew/homebrew-")}
Untap them with `brew untap`. Untap them with `brew untap`.
EOS EOS
end end

View File

@ -375,9 +375,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
if filename_with_encoding = content_disposition.parameters["filename*"] if filename_with_encoding = content_disposition.parameters["filename*"]
encoding, encoded_filename = filename_with_encoding.split("''", 2) encoding, encoded_filename = filename_with_encoding.split("''", 2)
if encoding && encoded_filename filename = URI.decode_www_form_component(encoded_filename).encode(encoding) if encoding && encoded_filename
filename = URI.decode_www_form_component(encoded_filename).encode(encoding)
end
end end
filename || content_disposition.filename filename || content_disposition.filename

View File

@ -110,9 +110,7 @@ module Superenv
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin") path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
begin begin
if homebrew_cc =~ GNU_GCC_REGEXP path.append(gcc_version_formula($&).opt_bin) if homebrew_cc =~ GNU_GCC_REGEXP
path.append(gcc_version_formula($&).opt_bin)
end
rescue FormulaUnavailableError rescue FormulaUnavailableError
# Don't fail and don't add these formulae to the path if they don't exist. # Don't fail and don't add these formulae to the path if they don't exist.
nil nil

View File

@ -5,6 +5,7 @@ class DependencyCollector
dep = Dependency.new("openjdk", tags) dep = Dependency.new("openjdk", tags)
return dep if dep.installed? return dep if dep.installed?
return req if req.satisfied? return req if req.satisfied?
dep dep
rescue FormulaUnavailableError rescue FormulaUnavailableError
req req

View File

@ -54,7 +54,7 @@ module Homebrew
this variable set to include other locations. this variable set to include other locations.
Some programs like `vapigen` may not work correctly. Some programs like `vapigen` may not work correctly.
Consider adding Homebrew's share directory to XDG_DATA_DIRS like so: Consider adding Homebrew's share directory to XDG_DATA_DIRS like so:
#{Utils::Shell.prepend_variable_in_profile("XDG_DATA_DIRS", HOMEBREW_PREFIX/"share")} echo 'export XDG_DATA_DIRS="#{HOMEBREW_PREFIX}/share:$XDG_DATA_DIRS"' >> #{shell_profile}
EOS EOS
end end

View File

@ -2,6 +2,6 @@ class CoreTap < Tap
# @private # @private
def initialize def initialize
super "Homebrew", "core" super "Homebrew", "core"
@full_name = "Linuxbrew/homebrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] @full_name = "Homebrew/linuxbrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
end end
end end

View File

@ -106,6 +106,7 @@ module Homebrew
def check_xcode_minimum_version def check_xcode_minimum_version
return unless MacOS::Xcode.below_minimum_version? return unless MacOS::Xcode.below_minimum_version?
xcode = MacOS::Xcode.version.to_s xcode = MacOS::Xcode.version.to_s
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?

View File

@ -36,21 +36,15 @@ class SystemConfig
end end
def clt def clt
@clt ||= if MacOS::CLT.installed? @clt ||= MacOS::CLT.version if MacOS::CLT.installed?
MacOS::CLT.version
end
end end
def clt_headers def clt_headers
@clt_headers ||= if MacOS::CLT.headers_installed? @clt_headers ||= MacOS::CLT.headers_version if MacOS::CLT.headers_installed?
MacOS::CLT.headers_version
end
end end
def xquartz def xquartz
@xquartz ||= if MacOS::XQuartz.installed? @xquartz ||= "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" if MacOS::XQuartz.installed?
"#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
end
end end
def dump_verbose_config(f = $stdout) def dump_verbose_config(f = $stdout)

View File

@ -345,9 +345,7 @@ class Pathname
# Writes an exec script that invokes a Java jar # Writes an exec script that invokes a Java jar
def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil) def write_jar_script(target_jar, script_name, java_opts = "", java_version: nil)
mkpath mkpath
java_home = if java_version java_home = ("JAVA_HOME=\"#{Language::Java.java_home_shell(java_version)}\" " if java_version)
"JAVA_HOME=\"#{Language::Java.java_home_shell(java_version)}\" "
end
join(script_name).write <<~SH join(script_name).write <<~SH
#!/bin/bash #!/bin/bash
#{java_home}exec java #{java_opts} -jar #{target_jar} "$@" #{java_home}exec java #{java_opts} -jar #{target_jar} "$@"

View File

@ -28,18 +28,14 @@ module StringInreplaceExtension
def sub!(before, after) def sub!(before, after)
result = super result = super
unless result errors << "expected replacement of #{before.inspect} with #{after.inspect}" unless result
errors << "expected replacement of #{before.inspect} with #{after.inspect}"
end
result result
end end
# Warn if nothing was replaced # Warn if nothing was replaced
def gsub!(before, after, audit_result = true) def gsub!(before, after, audit_result = true)
result = super(before, after) result = super(before, after)
if audit_result && result.nil? errors << "expected replacement of #{before.inspect} with #{after.inspect}" if audit_result && result.nil?
errors << "expected replacement of #{before.inspect} with #{after.inspect}"
end
result result
end end
@ -55,9 +51,7 @@ module StringInreplaceExtension
def remove_make_var!(flags) def remove_make_var!(flags)
Array(flags).each do |flag| Array(flags).each do |flag|
# Also remove trailing \n, if present. # Also remove trailing \n, if present.
unless gsub!(/^#{Regexp.escape(flag)}[ \t]*=.*$\n?/, "", false) errors << "expected to remove #{flag.inspect}" unless gsub!(/^#{Regexp.escape(flag)}[ \t]*=.*$\n?/, "", false)
errors << "expected to remove #{flag.inspect}"
end
end end
end end

View File

@ -176,9 +176,7 @@ class Formula
@name = name @name = name
@path = path @path = path
@alias_path = alias_path @alias_path = alias_path
@alias_name = if alias_path @alias_name = (File.basename(alias_path) if alias_path)
File.basename(alias_path)
end
@revision = self.class.revision || 0 @revision = self.class.revision || 0
@version_scheme = self.class.version_scheme || 0 @version_scheme = self.class.version_scheme || 0
@ -248,14 +246,10 @@ class Formula
end end
def validate_attributes! def validate_attributes!
if name.nil? || name.empty? || name =~ /\s/ raise FormulaValidationError.new(full_name, :name, name) if name.nil? || name.empty? || name =~ /\s/
raise FormulaValidationError.new(full_name, :name, name)
end
url = active_spec.url url = active_spec.url
if url.nil? || url.empty? || url =~ /\s/ raise FormulaValidationError.new(full_name, :url, url) if url.nil? || url.empty? || url =~ /\s/
raise FormulaValidationError.new(full_name, :url, url)
end
val = version.respond_to?(:to_str) ? version.to_str : version val = version.respond_to?(:to_str) ? version.to_str : version
return unless val.nil? || val.empty? || val =~ /\s/ return unless val.nil? || val.empty? || val =~ /\s/
@ -1338,9 +1332,7 @@ class Formula
# Avoid false positives for clock_gettime support on 10.11. # Avoid false positives for clock_gettime support on 10.11.
# CMake cache entries for other weak symbols may be added here as needed. # CMake cache entries for other weak symbols may be added here as needed.
if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0" args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0"
end
args args
end end
@ -1430,7 +1422,7 @@ class Formula
@installed ||= racks.flat_map do |rack| @installed ||= racks.flat_map do |rack|
begin begin
Formulary.from_rack(rack) Formulary.from_rack(rack)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError rescue
[] []
end end
end.uniq(&:name) end.uniq(&:name)
@ -1842,9 +1834,7 @@ class Formula
pretty_args.delete "--disable-debug" pretty_args.delete "--disable-debug"
end end
pretty_args.each_index do |i| pretty_args.each_index do |i|
if pretty_args[i].to_s.start_with? "import setuptools" pretty_args[i] = "import setuptools..." if pretty_args[i].to_s.start_with? "import setuptools"
pretty_args[i] = "import setuptools..."
end
end end
ohai "#{cmd} #{pretty_args * " "}".strip ohai "#{cmd} #{pretty_args * " "}".strip
@ -1957,9 +1947,7 @@ class Formula
# If the cellar only has one version installed, don't complain # If the cellar only has one version installed, don't complain
# that we can't tell which one to keep. Don't complain at all if the # that we can't tell which one to keep. Don't complain at all if the
# only installed version is a pinned formula. # only installed version is a pinned formula.
unless quiet opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed" unless quiet
opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed"
end
end end
eligible_for_cleanup eligible_for_cleanup
end end

View File

@ -244,9 +244,7 @@ class FormulaInstaller
check_conflicts check_conflicts
if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed? raise BuildToolsError, [formula] if !pour_bottle? && !formula.bottle_unneeded? && !DevelopmentTools.installed?
raise BuildToolsError, [formula]
end
unless ignore_deps? unless ignore_deps?
deps = compute_dependencies deps = compute_dependencies
@ -267,17 +265,13 @@ class FormulaInstaller
end end
options = display_options(formula) options = display_options(formula)
if show_header? oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header?
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip
end
unless formula.tap&.private? unless formula.tap&.private?
action = "#{formula.full_name} #{options}".strip action = "#{formula.full_name} #{options}".strip
Utils::Analytics.report_event("install", action) Utils::Analytics.report_event("install", action)
if installed_on_request Utils::Analytics.report_event("install_on_request", action) if installed_on_request
Utils::Analytics.report_event("install_on_request", action)
end
end end
self.class.attempted << formula self.class.attempted << formula
@ -624,9 +618,7 @@ class FormulaInstaller
keg = Keg.new(formula.prefix) keg = Keg.new(formula.prefix)
link(keg) link(keg)
unless @poured_bottle && formula.bottle_specification.skip_relocation? fix_dynamic_linkage(keg) unless @poured_bottle && formula.bottle_specification.skip_relocation?
fix_dynamic_linkage(keg)
end
if build_bottle? if build_bottle?
ohai "Not running post_install as we're building a bottle" ohai "Not running post_install as we're building a bottle"
@ -757,9 +749,7 @@ class FormulaInstaller
formula.update_head_version formula.update_head_version
if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation? raise "Empty installation" if !formula.prefix.directory? || Keg.new(formula.prefix).empty_installation?
raise "Empty installation"
end
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
if e.is_a? BuildError if e.is_a? BuildError
e.formula = formula e.formula = formula

View File

@ -16,9 +16,7 @@ module Formulary
end end
def self.load_formula(name, path, contents, namespace) def self.load_formula(name, path, contents, namespace)
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!"
end
mod = Module.new mod = Module.new
const_set(namespace, mod) const_set(namespace, mod)
@ -244,9 +242,7 @@ module Formulary
new_name = new_tap.core_tap? ? name : new_tapped_name new_name = new_tap.core_tap? ? name : new_tapped_name
end end
if warn && old_name && new_name opoo "Use #{new_name} instead of deprecated #{old_name}" if warn && old_name && new_name
opoo "Use #{new_name} instead of deprecated #{old_name}"
end
end end
[name, path] [name, path]
@ -397,22 +393,16 @@ module Formulary
return TapLoader.new(ref, from: from) return TapLoader.new(ref, from: from)
end end
if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist? return FromPathLoader.new(ref) if File.extname(ref) == ".rb" && Pathname.new(ref).expand_path.exist?
return FromPathLoader.new(ref)
end
formula_with_that_name = core_path(ref) formula_with_that_name = core_path(ref)
if formula_with_that_name.file? return FormulaLoader.new(ref, formula_with_that_name) if formula_with_that_name.file?
return FormulaLoader.new(ref, formula_with_that_name)
end
possible_alias = CoreTap.instance.alias_dir/ref possible_alias = CoreTap.instance.alias_dir/ref
return AliasLoader.new(possible_alias) if possible_alias.file? return AliasLoader.new(possible_alias) if possible_alias.file?
possible_tap_formulae = tap_paths(ref) possible_tap_formulae = tap_paths(ref)
if possible_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae) if possible_tap_formulae.size > 1
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae)
end
if possible_tap_formulae.size == 1 if possible_tap_formulae.size == 1
path = possible_tap_formulae.first.resolved_path path = possible_tap_formulae.first.resolved_path
@ -422,9 +412,7 @@ module Formulary
if newref = CoreTap.instance.formula_renames[ref] if newref = CoreTap.instance.formula_renames[ref]
formula_with_that_oldname = core_path(newref) formula_with_that_oldname = core_path(newref)
if formula_with_that_oldname.file? return FormulaLoader.new(newref, formula_with_that_oldname) if formula_with_that_oldname.file?
return FormulaLoader.new(newref, formula_with_that_oldname)
end
end end
possible_tap_newname_formulae = [] possible_tap_newname_formulae = []
@ -438,19 +426,13 @@ module Formulary
raise TapFormulaWithOldnameAmbiguityError.new(ref, possible_tap_newname_formulae) raise TapFormulaWithOldnameAmbiguityError.new(ref, possible_tap_newname_formulae)
end end
unless possible_tap_newname_formulae.empty? return TapLoader.new(possible_tap_newname_formulae.first, from: from) unless possible_tap_newname_formulae.empty?
return TapLoader.new(possible_tap_newname_formulae.first, from: from)
end
possible_keg_formula = Pathname.new("#{HOMEBREW_PREFIX}/opt/#{ref}/.brew/#{ref}.rb") possible_keg_formula = Pathname.new("#{HOMEBREW_PREFIX}/opt/#{ref}/.brew/#{ref}.rb")
if possible_keg_formula.file? return FormulaLoader.new(ref, possible_keg_formula) if possible_keg_formula.file?
return FormulaLoader.new(ref, possible_keg_formula)
end
possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb") possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
if possible_cached_formula.file? return FormulaLoader.new(ref, possible_cached_formula) if possible_cached_formula.file?
return FormulaLoader.new(ref, possible_cached_formula)
end
NullLoader.new(ref) NullLoader.new(ref)
end end
@ -473,9 +455,7 @@ module Formulary
def self.find_with_priority(ref, spec = :stable) def self.find_with_priority(ref, spec = :stable)
possible_pinned_tap_formulae = tap_paths(ref, Dir["#{HOMEBREW_LIBRARY}/PinnedTaps/*/*/"]).map(&:realpath) possible_pinned_tap_formulae = tap_paths(ref, Dir["#{HOMEBREW_LIBRARY}/PinnedTaps/*/*/"]).map(&:realpath)
if possible_pinned_tap_formulae.size > 1 raise TapFormulaAmbiguityError.new(ref, possible_pinned_tap_formulae) if possible_pinned_tap_formulae.size > 1
raise TapFormulaAmbiguityError.new(ref, possible_pinned_tap_formulae)
end
if possible_pinned_tap_formulae.size == 1 if possible_pinned_tap_formulae.size == 1
selected_formula = factory(possible_pinned_tap_formulae.first, spec) selected_formula = factory(possible_pinned_tap_formulae.first, spec)

View File

@ -148,6 +148,4 @@ require "official_taps"
require "tap" require "tap"
require "tap_constants" require "tap_constants"
if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"] require "compat" if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"]
require "compat"
end

View File

@ -61,7 +61,7 @@ module Hardware
def type def type
case RUBY_PLATFORM case RUBY_PLATFORM
when /x86_64/, /i\d86/ then :intel when /x86_64/, /i\d86/ then :intel
when /arm/ then :arm when /arm/, /aarch64/ then :arm
when /ppc\d+/ then :ppc when /ppc\d+/ then :ppc
else :dunno else :dunno
end end

View File

@ -83,6 +83,7 @@ module Homebrew
.generate_help_text .generate_help_text
rescue NoMethodError => e rescue NoMethodError => e
raise if e.name != cmd_args_method_name raise if e.name != cmd_args_method_name
nil nil
end end

View File

@ -263,9 +263,7 @@ class Keg
if tap if tap
bad_tap_opt = opt/tap.user bad_tap_opt = opt/tap.user
if !bad_tap_opt.symlink? && bad_tap_opt.directory? FileUtils.rm_rf bad_tap_opt if !bad_tap_opt.symlink? && bad_tap_opt.directory?
FileUtils.rm_rf bad_tap_opt
end
end end
aliases.each do |a| aliases.each do |a|
@ -569,9 +567,7 @@ class Keg
begin begin
keg = Keg.for(src) keg = Keg.for(src)
rescue NotAKegError rescue NotAKegError
if ARGV.verbose? puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar" if ARGV.verbose?
puts "Won't resolve conflicts for symlink #{dst} as it doesn't resolve into the Cellar"
end
return return
end end
@ -636,9 +632,7 @@ class Keg
# Don't link pyc or pyo files because Python overwrites these # Don't link pyc or pyo files because Python overwrites these
# cached object files and next time brew wants to link, the # cached object files and next time brew wants to link, the
# file is in the way. # file is in the way.
if %w[.pyc .pyo].include?(src.extname) && src.to_s.include?("/site-packages/") Find.prune if %w[.pyc .pyo].include?(src.extname) && src.to_s.include?("/site-packages/")
Find.prune
end
case yield src.relative_path_from(root) case yield src.relative_path_from(root)
when :skip_file, nil when :skip_file, nil

View File

@ -8,6 +8,7 @@ module Language
def self.java_home(version = nil) def self.java_home(version = nil)
req = JavaRequirement.new [*version] req = JavaRequirement.new [*version]
raise UnsatisfiedRequirements, req.message unless req.satisfied? raise UnsatisfiedRequirements, req.message unless req.satisfied?
req.java_home req.java_home
end end

View File

@ -11,9 +11,7 @@ module Language
# directory, consequently breaking that assumption. We require a tarball # directory, consequently breaking that assumption. We require a tarball
# because npm install creates a "real" installation when fed a tarball. # because npm install creates a "real" installation when fed a tarball.
output = Utils.popen_read("npm pack --ignore-scripts") output = Utils.popen_read("npm pack --ignore-scripts")
if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty? raise "npm failed to pack #{Dir.pwd}" if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?
raise "npm failed to pack #{Dir.pwd}"
end
output.lines.last.chomp output.lines.last.chomp
end end

View File

@ -1,6 +1,6 @@
PYTHON_VIRTUALENV_URL = PYTHON_VIRTUALENV_URL =
"https://files.pythonhosted.org/packages/51/aa" \ "https://files.pythonhosted.org/packages/37/db" \
"/c395a6e6eaaedfa5a04723b6446a1df783b16cca6fec66e671cede514688" \ "/89d6b043b22052109da35416abc3c397655e4bd3cff031446ba02b9654fa" \
"/virtualenv-16.4.0.tar.gz".freeze "/virtualenv-16.4.3.tar.gz".freeze
PYTHON_VIRTUALENV_SHA256 = PYTHON_VIRTUALENV_SHA256 =
"cceab52aa7d4df1e1871a70236eb2b89fcfe29b6b43510d9738689787c513261".freeze "984d7e607b0a5d1329425dd8845bd971b957424b5ba664729fab51ab8c11bc39".freeze

View File

@ -2,8 +2,6 @@ require "pathname"
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) $LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s)
end
require "vendor/bundle-standalone/bundler/setup" require "vendor/bundle/bundler/setup"

View File

@ -11,9 +11,7 @@ class Locale
def self.parse(string) def self.parse(string)
string = string.to_s string = string.to_s
if string !~ LOCALE_REGEX raise ParserError, "'#{string}' cannot be parsed to a #{self}" if string !~ LOCALE_REGEX
raise ParserError, "'#{string}' cannot be parsed to a #{self}"
end
scan = proc do |regex| scan = proc do |regex|
string.scan(/(?:\-|^)(#{regex})(?:\-|$)/).flatten.first string.scan(/(?:\-|^)(#{regex})(?:\-|$)/).flatten.first
@ -29,9 +27,7 @@ class Locale
attr_reader :language, :region, :script attr_reader :language, :region, :script
def initialize(language, region, script) def initialize(language, region, script)
if language.nil? && region.nil? && script.nil? raise ArgumentError, "#{self.class} cannot be empty" if language.nil? && region.nil? && script.nil?
raise ArgumentError, "#{self.class} cannot be empty"
end
{ {
language: language, language: language,

View File

@ -118,9 +118,7 @@ class Migrator
@old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) } @old_tabs = old_cellar.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
@old_tap = old_tabs.first.tap @old_tap = old_tabs.first.tap
if !force && !from_same_tap_user? raise MigratorDifferentTapsError.new(formula, old_tap) if !force && !from_same_tap_user?
raise MigratorDifferentTapsError.new(formula, old_tap)
end
@new_cellar = HOMEBREW_CELLAR/formula.name @new_cellar = HOMEBREW_CELLAR/formula.name
@new_cellar_existed = @new_cellar.exist? @new_cellar_existed = @new_cellar.exist?
@ -233,9 +231,7 @@ class Migrator
end end
end end
if conflicted odie "Remove #{new_cellar} manually and run brew migrate #{oldname}." if conflicted
odie "Remove #{new_cellar} manually and run brew migrate #{oldname}."
end
end end
oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}" oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}"

View File

@ -310,6 +310,7 @@ module OS
version = nil version = nil
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id| [EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id|
next unless File.exist?("#{PKG_PATH}/usr/bin/clang") next unless File.exist?("#{PKG_PATH}/usr/bin/clang")
version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1] version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1]
break if version break if version
end end

View File

@ -87,9 +87,7 @@ module OS
# remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and # remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and
# `MacOS::X11.include` instead, as that accounts for Xcode-only systems. # `MacOS::X11.include` instead, as that accounts for Xcode-only systems.
def prefix def prefix
@prefix ||= if Pathname.new("/opt/X11/lib/libpng.dylib").exist? @prefix ||= Pathname.new("/opt/X11") if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
Pathname.new("/opt/X11")
end
end end
def installed? def installed?

View File

@ -3,12 +3,8 @@ class CodesignRequirement < Requirement
def initialize(tags) def initialize(tags)
options = tags.shift options = tags.shift
unless options.is_a?(Hash) raise ArgumentError("CodesignRequirement requires an options Hash!") unless options.is_a?(Hash)
raise ArgumentError("CodesignRequirement requires an options Hash!") raise ArgumentError("CodesignRequirement requires an identity key!") unless options.key?(:identity)
end
unless options.key?(:identity)
raise ArgumentError("CodesignRequirement requires an identity key!")
end
@identity = options.fetch(:identity) @identity = options.fetch(:identity)
@with = options.fetch(:with, "code signing") @with = options.fetch(:with, "code signing")

View File

@ -66,9 +66,7 @@ class Resource
# directory. Subclasses that override stage should implement the tmp # directory. Subclasses that override stage should implement the tmp
# dir using {Mktemp} so that works with all subtypes. # dir using {Mktemp} so that works with all subtypes.
def stage(target = nil, &block) def stage(target = nil, &block)
unless target || block raise ArgumentError, "target directory or block is required" unless target || block
raise ArgumentError, "target directory or block is required"
end
verify_download_integrity(fetch) verify_download_integrity(fetch)
prepare_patches prepare_patches

View File

@ -7,13 +7,9 @@ module RuboCop
def audit_formula(_node, _class_node, _parent_class_node, body_node) def audit_formula(_node, _class_node, _parent_class_node, body_node)
return if body_node.nil? return if body_node.nil?
if method_called_ever?(body_node, :md5) problem "MD5 checksums are deprecated, please use SHA256" if method_called_ever?(body_node, :md5)
problem "MD5 checksums are deprecated, please use SHA256"
end
if method_called_ever?(body_node, :sha1) problem "SHA1 checksums are deprecated, please use SHA256" if method_called_ever?(body_node, :sha1)
problem "SHA1 checksums are deprecated, please use SHA256"
end
sha256_calls = find_every_method_call_by_name(body_node, :sha256) sha256_calls = find_every_method_call_by_name(body_node, :sha256)
sha256_calls.each do |sha256_call| sha256_calls.each do |sha256_call|

View File

@ -367,9 +367,7 @@ module RuboCop
def check_precedence(first_nodes, next_nodes) def check_precedence(first_nodes, next_nodes)
next_nodes.each do |each_next_node| next_nodes.each do |each_next_node|
first_nodes.each do |each_first_node| first_nodes.each do |each_first_node|
if component_precedes?(each_first_node, each_next_node) return [each_first_node, each_next_node] if component_precedes?(each_first_node, each_next_node)
return [each_first_node, each_next_node]
end
end end
end end
nil nil

View File

@ -65,14 +65,10 @@ module RuboCop
desc = parameters(desc_call).first desc = parameters(desc_call).first
# Check for leading whitespace. # Check for leading whitespace.
if regex_match_group(desc, /^\s+/) problem "Description shouldn't have a leading space" if regex_match_group(desc, /^\s+/)
problem "Description shouldn't have a leading space"
end
# Check for trailing whitespace. # Check for trailing whitespace.
if regex_match_group(desc, /\s+$/) problem "Description shouldn't have a trailing space" if regex_match_group(desc, /\s+$/)
problem "Description shouldn't have a trailing space"
end
# Check if command-line is wrongly used in formula's desc # Check if command-line is wrongly used in formula's desc
if match = regex_match_group(desc, /(command ?line)/i) if match = regex_match_group(desc, /(command ?line)/i)

View File

@ -89,9 +89,7 @@ module RuboCop
class OptionDeclarations < FormulaCop class OptionDeclarations < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, body_node) def audit_formula(_node, _class_node, _parent_class_node, body_node)
if find_method_def(body_node, :options) problem "Use new-style option definitions" if find_method_def(body_node, :options)
problem "Use new-style option definitions"
end
find_instance_method_call(body_node, :build, :without?) do |method| find_instance_method_call(body_node, :build, :without?) do |method|
next unless unless_modifier?(method.parent) next unless unless_modifier?(method.parent)
@ -327,9 +325,7 @@ module RuboCop
problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node) problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node)
end end
if find_method_def(body_node, :test) problem "Use new-style test definitions (test do)" if find_method_def(body_node, :test)
problem "Use new-style test definitions (test do)"
end
find_method_with_args(body_node, :skip_clean, :all) do find_method_with_args(body_node, :skip_clean, :all) do
problem "`skip_clean :all` is deprecated; brew no longer strips symbols. " \ problem "`skip_clean :all` is deprecated; brew no longer strips symbols. " \

View File

@ -97,9 +97,7 @@ module RuboCop
problem "Don't use #{Regexp.last_match(1)}use_mirror in SourceForge urls (url is #{url})." problem "Don't use #{Regexp.last_match(1)}use_mirror in SourceForge urls (url is #{url})."
end end
if url.end_with?("/download") problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")
problem "Don't use /download in SourceForge urls (url is #{url})."
end
if url =~ %r{^https?://sourceforge\.} if url =~ %r{^https?://sourceforge\.}
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})." problem "Use https://downloads.sourceforge.net to get geolocation (url is #{url})."

View File

@ -55,9 +55,7 @@ class SoftwareSpec
resources.each_value do |r| resources.each_value do |r|
r.owner = self r.owner = self
r.version ||= begin r.version ||= begin
if version.nil? raise "#{full_name}: version missing for \"#{r.name}\" resource!" if version.nil?
raise "#{full_name}: version missing for \"#{r.name}\" resource!"
end
if version.head? if version.head?
Version.create("HEAD") Version.create("HEAD")

View File

@ -30,9 +30,7 @@ module Homebrew
args << "--parallel" args << "--parallel"
end end
if ARGV.verbose? args += ["--extra-details", "--display-cop-names"] if ARGV.verbose?
args += ["--extra-details", "--display-cop-names"]
end
if options[:except_cops] if options[:except_cops]
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
@ -49,9 +47,7 @@ module Homebrew
RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym) RuboCop::Cop::Cop.registry.departments.include?(cop.to_sym)
end end
if cops_to_include.empty? odie "RuboCops #{options[:only_cops].join(",")} were not found" if cops_to_include.empty?
odie "RuboCops #{options[:only_cops].join(",")} were not found"
end
args << "--only" << cops_to_include.join(",") args << "--only" << cops_to_include.join(",")
end end

View File

@ -197,6 +197,7 @@ class SystemCommand
def success? def success?
return false if @exit_status.nil? return false if @exit_status.nil?
@exit_status.zero? @exit_status.zero?
end end

View File

@ -157,15 +157,9 @@ class SystemConfig
if defaults_hash[:HOMEBREW_REPOSITORY] != HOMEBREW_REPOSITORY.to_s if defaults_hash[:HOMEBREW_REPOSITORY] != HOMEBREW_REPOSITORY.to_s
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}" f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
end end
if defaults_hash[:HOMEBREW_CELLAR] != HOMEBREW_CELLAR.to_s f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" if defaults_hash[:HOMEBREW_CELLAR] != HOMEBREW_CELLAR.to_s
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" f.puts "HOMEBREW_CACHE: #{HOMEBREW_CACHE}" if defaults_hash[:HOMEBREW_CACHE] != HOMEBREW_CACHE.to_s
end f.puts "HOMEBREW_TEMP: #{HOMEBREW_TEMP}" if defaults_hash[:HOMEBREW_TEMP] != HOMEBREW_TEMP.to_s
if defaults_hash[:HOMEBREW_CACHE] != HOMEBREW_CACHE.to_s
f.puts "HOMEBREW_CACHE: #{HOMEBREW_CACHE}"
end
if defaults_hash[:HOMEBREW_TEMP] != HOMEBREW_TEMP.to_s
f.puts "HOMEBREW_TEMP: #{HOMEBREW_TEMP}"
end
if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s
f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}" f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}"
end end

View File

@ -133,13 +133,9 @@ class Tab < OpenStruct
def self.for_formula(f) def self.for_formula(f)
paths = [] paths = []
if f.opt_prefix.symlink? && f.opt_prefix.directory? paths << f.opt_prefix.resolved_path if f.opt_prefix.symlink? && f.opt_prefix.directory?
paths << f.opt_prefix.resolved_path
end
if f.linked_keg.symlink? && f.linked_keg.directory? paths << f.linked_keg.resolved_path if f.linked_keg.symlink? && f.linked_keg.directory?
paths << f.linked_keg.resolved_path
end
if (dirs = f.installed_prefixes).length == 1 if (dirs = f.installed_prefixes).length == 1
paths << dirs.first paths << dirs.first

View File

@ -22,17 +22,13 @@ class Tap
repo = args.second repo = args.second
end end
if [user, repo].any? { |part| part.nil? || part.include?("/") } raise "Invalid tap name '#{args.join("/")}'" if [user, repo].any? { |part| part.nil? || part.include?("/") }
raise "Invalid tap name '#{args.join("/")}'"
end
# We special case homebrew and linuxbrew so that users don't have to shift in a terminal. # We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
user = user.capitalize if ["homebrew", "linuxbrew"].include? user user = user.capitalize if ["homebrew", "linuxbrew"].include? user
repo = repo.delete_prefix "homebrew-" repo = repo.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")
if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo) return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
return CoreTap.instance
end
cache_key = "#{user}/#{repo}".downcase cache_key = "#{user}/#{repo}".downcase
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) } cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
@ -280,9 +276,7 @@ class Tap
begin begin
safe_system "git", *args safe_system "git", *args
unless Readall.valid_tap?(self, aliases: true) unless Readall.valid_tap?(self, aliases: true)
unless ARGV.homebrew_developer? raise "Cannot tap #{name}: invalid syntax in tap!" unless ARGV.homebrew_developer?
raise "Cannot tap #{name}: invalid syntax in tap!"
end
end end
rescue Interrupt, RuntimeError rescue Interrupt, RuntimeError
ignore_interrupts do ignore_interrupts do

View File

@ -8,3 +8,4 @@ HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source) HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask # match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze

View File

@ -1,6 +0,0 @@
---
BUNDLE_BIN: "../bin"
BUNDLE_PATH: "../vendor/bundle"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_JOBS: "4"
BUNDLE_RETRY: "3"

View File

@ -1,18 +0,0 @@
source "https://rubygems.org"
gem "parallel_tests"
gem "rspec"
gem "rspec-its", require: false
gem "rspec-retry", require: false
gem "rspec-wait", require: false
gem "rubocop"
group :development do
gem "ronn", require: false
end
group :coverage do
gem "coveralls", require: false
gem "simplecov", require: false
gem "simplecov-cobertura", require: false
end

View File

@ -228,11 +228,6 @@ shared_examples "#uninstall_phase or #zap_phase" do
it "is supported" do it "is supported" do
allow(fake_system_command).to receive(:run).with(any_args).and_call_original allow(fake_system_command).to receive(:run).with(any_args).and_call_original
expect(fake_system_command).to receive(:run).with(
"/bin/chmod",
args: ["--", "+x", script_pathname],
)
expect(fake_system_command).to receive(:run).with( expect(fake_system_command).to receive(:run).with(
cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"), cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"),
args: ["--please"], args: ["--please"],

View File

@ -42,7 +42,7 @@ describe Cask::Cmd::Style, :cask do
context "when installation succeeds" do context "when installation succeeds" do
before do before do
allow(Homebrew).to receive(:install_gem_setup_path!) allow(Homebrew).to receive(:install_bundler_gems!)
end end
it "exits successfully" do it "exits successfully" do
@ -52,7 +52,7 @@ describe Cask::Cmd::Style, :cask do
context "when installation fails" do context "when installation fails" do
before do before do
allow(Homebrew).to receive(:install_gem_setup_path!).and_raise(SystemExit) allow(Homebrew).to receive(:install_bundler_gems!).and_raise(SystemExit)
end end
it "raises an error" do it "raises an error" do

View File

@ -179,19 +179,19 @@ describe Homebrew::CLI::Parser do
end end
it "prioritizes cli arguments over env vars when they conflict" do it "prioritizes cli arguments over env vars when they conflict" do
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1")
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("0")
allow(ENV).to receive(:[]) allow(ENV).to receive(:[])
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1")
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return(nil)
parser.parse(["--switch-b"]) parser.parse(["--switch-b"])
expect(Homebrew.args.switch_a).to be_falsy expect(Homebrew.args.switch_a).to be_falsy
expect(Homebrew.args).to be_switch_b expect(Homebrew.args).to be_switch_b
end end
it "raises an exception on constraint violation when both are env vars" do it "raises an exception on constraint violation when both are env vars" do
allow(ENV).to receive(:[])
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1")
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("1") allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("1")
allow(ENV).to receive(:[]) expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
expect { parser.parse(["--switch-a", "--switch-b"]) }.to raise_error(Homebrew::CLI::OptionConflictError)
end end
end end

View File

@ -15,6 +15,10 @@ describe "brew style" do
end end
end end
before do
allow(Homebrew).to receive(:install_bundler_gems!)
end
describe "Homebrew::check_style_json" do describe "Homebrew::check_style_json" do
let(:dir) { mktmpdir } let(:dir) { mktmpdir }

Some files were not shown because too many files have changed in this diff Show More