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}]
trim_trailing_whitespace = true
[Library/Taps/homebrew/**.rb]
[Library/Taps/**.rb]
# trailing whitespace is crucial for patches
trim_trailing_whitespace = false

211
.gitignore vendored
View File

@ -22,105 +22,132 @@
# Ignore Bundler files
**/.bundle/bin
**/.bundle/cache
**/vendor/bundle
**/vendor/ruby
**/vendor/bundle-standalone/ruby/*/bin
**/vendor/bundle-standalone/ruby/*/build_info/
**/vendor/bundle-standalone/ruby/*/cache
**/vendor/bundle-standalone/ruby/*/extensions
**/vendor/bundle-standalone/ruby/*/gems/*/*
**/vendor/bundle-standalone/ruby/*/specifications
**/vendor/bundle/ruby/*/bin
**/vendor/bundle/ruby/*/build_info/
**/vendor/bundle/ruby/*/cache
**/vendor/bundle/ruby/*/extensions
**/vendor/bundle/ruby/*/gems/*/*
**/vendor/bundle/ruby/*/specifications
# Unignore vendored gems
!**/vendor/bundle-standalone/ruby/*/gems/*/lib
!**/vendor/bundle-standalone/ruby/*/gems/rubocop-rspec-*/config
!**/vendor/bundle/ruby/*/gems/*/lib
!**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/config
# 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-standalone/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-standalone/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-standalone/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-standalone/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-standalone/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-standalone/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-standalone/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-standalone/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-standalone/ruby/*/gems/backports-*/lib/backports/latest.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/version.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/1.*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.0*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.1*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.2*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.3*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.*.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/force/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/random/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/array/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/comparable/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/dir/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/enumerable/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/false_class/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/fixnum/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/float/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/hash/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/integer/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/kernel/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/module/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/nil_class/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/regexp/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/*/true_class/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/atomic/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/atomic_reference/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/collection/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/concern/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/executor/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/synchronization/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/thread_safe/
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib/utility/
**/vendor/bundle-standalone/ruby/*/gems/i18n-*/lib/i18n/tests*
**/vendor/bundle-standalone/ruby/*/gems/thread_safe-*/lib/thread_safe/util
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support.rb
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/all.rb
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache.rb
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/cache/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/concurrency/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies.rb
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/dependencies/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/duration/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/json.rb
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/json/
**/vendor/bundle/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/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/messages/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/multibyte/
**/vendor/bundle/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/
**/vendor/bundle/ruby/2.3.0/gems/activesupport-*/lib/active_support/testing/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/latest.rb
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/rails.rb
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/version.rb
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/1.*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.0*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.1*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.2*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.3*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.6*
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/2.*.rb
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/force/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/rails/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/random/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/array/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/comparable/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/dir/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/enumerable/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/false_class/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/fixnum/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/float/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/hash/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/integer/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/kernel/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/module/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/nil_class/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/regexp/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/struct/
**/vendor/bundle/ruby/*/gems/backports-*/lib/backports/*/true_class/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/atomic_reference/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/collection/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/concern/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/executor/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/synchronization/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/thread_safe/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/lib/utility/
**/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
**/vendor/bundle-standalone/ruby/*/gems/ast-*/
**/vendor/bundle-standalone/ruby/*/gems/connection_pool-*/lib
**/vendor/bundle-standalone/ruby/*/gems/domain_name-*/lib
**/vendor/bundle-standalone/ruby/*/gems/http-cookie-*/lib
**/vendor/bundle-standalone/ruby/*/gems/jaro_winkler-*/
**/vendor/bundle-standalone/ruby/*/gems/mime-types-data-*/lib
**/vendor/bundle-standalone/ruby/*/gems/mime-types-*/lib
**/vendor/bundle-standalone/ruby/*/gems/mini_portile2-*/lib
**/vendor/bundle-standalone/ruby/*/gems/minitest-*/lib
**/vendor/bundle-standalone/ruby/*/gems/net-http-digest_auth-*/lib
**/vendor/bundle-standalone/ruby/*/gems/net-http-persistent-*/lib
**/vendor/bundle-standalone/ruby/*/gems/nokogiri-*/lib
**/vendor/bundle-standalone/ruby/*/gems/ntlm-http-*/lib
**/vendor/bundle-standalone/ruby/*/gems/parallel-*/
**/vendor/bundle-standalone/ruby/*/gems/parser-*/
**/vendor/bundle-standalone/ruby/*/gems/powerpack-*/
**/vendor/bundle-standalone/ruby/*/gems/rainbow-*/
**/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/
**/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/
**/vendor/bundle-standalone/ruby/*/gems/unf_ext-*/lib
**/vendor/bundle-standalone/ruby/*/gems/unf-*/lib
**/vendor/bundle-standalone/ruby/*/gems/unicode-display_width-*/
**/vendor/bundle-standalone/ruby/*/gems/webrobots-*/lib
# Ignore dependencies we don't wish to vendor
**/vendor/bundle/ruby/*/gems/ast-*/
**/vendor/bundle/ruby/*/gems/bundler-*/
**/vendor/bundle/ruby/*/gems/coderay-*/
**/vendor/bundle/ruby/*/gems/connection_pool-*/
**/vendor/bundle/ruby/*/gems/coveralls-*/
**/vendor/bundle/ruby/*/gems/diff-lcs-*/
**/vendor/bundle/ruby/*/gems/docile-*/
**/vendor/bundle/ruby/*/gems/domain_name-*/
**/vendor/bundle/ruby/*/gems/http-cookie-*/
**/vendor/bundle/ruby/*/gems/hpricot-*/
**/vendor/bundle/ruby/*/gems/jaro_winkler-*/
**/vendor/bundle/ruby/*/gems/json-*/
**/vendor/bundle/ruby/*/gems/method_source-*/
**/vendor/bundle/ruby/*/gems/mime-types-data-*/
**/vendor/bundle/ruby/*/gems/mime-types-*/
**/vendor/bundle/ruby/*/gems/mini_portile2-*/
**/vendor/bundle/ruby/*/gems/minitest-*/
**/vendor/bundle/ruby/*/gems/mustache-*/
**/vendor/bundle/ruby/*/gems/net-http-digest_auth-*/
**/vendor/bundle/ruby/*/gems/net-http-persistent-*/
**/vendor/bundle/ruby/*/gems/nokogiri-*/
**/vendor/bundle/ruby/*/gems/ntlm-http-*/
**/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`.
**/vendor/bundle-standalone/ruby/*/gems/mechanize-*/lib
!**/vendor/bundle-standalone/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
!**/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/http/content_disposition_parser.rb
!**/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/version.rb
# Ignore `bin` contents (again).
/bin

View File

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

View File

@ -1,3 +1,19 @@
sut:
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:
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)
# and layout is not configurable (https://github.com/rubocop-hq/rubocop/issues/6254).
Layout/RescueEnsureAlignment:

View File

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

View File

@ -1,5 +1,7 @@
---
BUNDLE_PATH: "bundle-standalone"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_BIN: "false"
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:
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
Style/TrailingBodyOnMethodDefinition:
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
remote: https://rubygems.org/
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)
backports (3.12.0)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
coveralls (0.8.22)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
@ -10,16 +18,44 @@ GEM
tins (~> 1.6)
diff-lcs (1.3)
docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
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)
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)
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
parser (2.6.0.0)
ast (~> 2.4.0)
plist (3.5.0)
powerpack (0.1.2)
psych (3.1.0)
rainbow (3.0.0)
rdiscount (2.2.0.1)
ronn (0.7.3)
@ -46,14 +82,18 @@ GEM
rspec-support (3.8.0)
rspec-wait (0.0.9)
rspec (>= 3, < 4)
rubocop (0.64.0)
rubocop (0.65.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
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)
simplecov (0.16.1)
docile (~> 1.1)
@ -65,23 +105,37 @@ GEM
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (0.19.4)
thread_safe (0.3.6)
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)
webrobots (0.1.2)
PLATFORMS
ruby
DEPENDENCIES
activesupport
backports
concurrent-ruby
coveralls
mechanize
parallel_tests
plist
ronn
rspec
rspec-its
rspec-retry
rspec-wait
rubocop
rubocop-rspec
ruby-macho
simplecov
simplecov-cobertura
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!"
end
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
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}."
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.
class MissingEnvironmentVariables < RuntimeError; end
@ -92,9 +96,7 @@ begin
# `Homebrew.help` never returns, except for external/unknown commands.
end
if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source")
end
odisabled("HOMEBREW_BUILD_FROM_SOURCE", "--build-from-source") if ENV["HOMEBREW_BUILD_FROM_SOURCE"]
if internal_cmd
Homebrew.send cmd.to_s.tr("-", "_").downcase
@ -113,9 +115,7 @@ begin
brew_uid = HOMEBREW_BREW_FILE.stat.uid
tap_commands = []
if Process.uid.zero? && !brew_uid.zero?
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}]
end
tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero?
# Unset HOMEBREW_HELP to avoid confusing the tap
ENV.delete("HOMEBREW_HELP") if help_flag
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap}]

View File

@ -309,6 +309,11 @@ then
esac
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.
# This makes them behave like HOMEBREW_DEVELOPERs for brew update.
if [[ -z "$HOMEBREW_DEVELOPER" ]]

View File

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

View File

@ -20,6 +20,24 @@ module Cask
@dirmethod ||= "#{dsl_key}dir".to_sym
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)
return unless other.class < AbstractArtifact
return 0 if self.class == other.class

View File

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

View File

@ -13,9 +13,7 @@ module Cask
def self.from_args(cask, *args)
source_string, target_hash = args
if source_string.nil?
raise CaskInvalidError.new(cask.token, "no source given for #{english_name}")
end
raise CaskInvalidError.new(cask.token, "no source given for #{english_name}") if source_string.nil?
unless target_hash.is_a?(Hash)
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, **_)
ohai "Running #{self.class.dsl_key} script '#{path}'"
absolute_path = if path.absolute?
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
executable_path = staged_path_join_executable(path)
command.run!(
executable,
executable_path,
**args,
env: { "PATH" => PATH.new(
HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"sbin", ENV["PATH"]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,17 +9,13 @@ module Cask
def metadata_versioned_path(version: self.version)
cask_version = (version || :unknown).to_s
if cask_version.empty?
raise CaskError, "Cannot create metadata path with empty version."
end
raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty?
metadata_master_container_path.join(cask_version)
end
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."
end
raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && timestamp == :latest
path = if timestamp == :latest
Pathname.glob(metadata_versioned_path(version: version).join("*")).max
@ -37,9 +33,7 @@ module Cask
end
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."
end
raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && timestamp == :latest
unless leaf.respond_to?(:empty?) && !leaf.empty?
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:
EOS
if f.bin.directory?
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_bin.to_s)}\n"
end
if f.sbin.directory?
s << " #{Utils::Shell.prepend_path_in_profile(f.opt_sbin.to_s)}\n"
end
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_sbin.to_s)}\n" if f.sbin.directory?
end
if f.lib.directory? || f.include.directory?
@ -61,13 +57,9 @@ class Caveats
For compilers to find #{f.name} you may need to set:
EOS
if f.lib.directory?
s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n"
end
s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{f.opt_lib}")}\n" if f.lib.directory?
if f.include.directory?
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n"
end
s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{f.opt_include}")}\n" if f.include.directory?
if which("pkg-config", ENV["HOMEBREW_PATH"]) &&
((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
info_dir_file = @f.info + "dir"
if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
observe_file_removal info_dir_file
end
observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
prune
end
@ -111,9 +109,7 @@ class Cleaner
end
if ARGV.debug?
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)}"
end
puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
end
path.chmod perms
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -133,9 +133,7 @@ module Homebrew
pinned_versions = {}
names.sort.each do |d|
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
end
pinned_versions[d] = keg_pin.readlink.basename.to_s if keg_pin.exist? || keg_pin.symlink?
end
pinned_versions.each do |d, 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`)."
switch :verbose,
description: "Display detailed version information."
flag "--json=",
description: "Show output in JSON format for provided <version>. Currently the only "\
"accepted value of <version> is `v1`."
flag "--json",
description: "Print output in JSON format. Currently the default and only accepted "\
"value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>"
switch "--fetch-HEAD",
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 "\
"updates when a new stable or development version has been released."
switch :debug
conflicts "--quiet", "--verbose", "--json="
conflicts "--quiet", "--verbose", "--json"
end
end
@ -39,7 +40,9 @@ module Homebrew
else
ARGV.resolved_formulae
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)
else
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)`
homebrew-shellenv() {
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\""
case "$SHELL" in
*/fish)
echo "set -gx HOMEBREW_PREFIX \"$HOMEBREW_PREFIX\";"
echo "set -gx HOMEBREW_CELLAR \"$HOMEBREW_CELLAR\";"
echo "set -gx HOMEBREW_REPOSITORY \"$HOMEBREW_REPOSITORY\";"
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
switch "--installed",
description: "Display information on all installed taps."
flag "--json=",
description: "Print a JSON representation of <taps>. Currently the only accepted value for "\
"<version> is `v1`. See the docs for examples of using the JSON output: "\
"<https://docs.brew.sh/Querying-Brew>"
flag "--json",
description: "Print a JSON representation of <taps>. Currently the default and only accepted "\
"value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>"
switch :debug
end
end
@ -32,7 +32,9 @@ module Homebrew
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))
else
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"
# Consider the message possibly missed if not a TTY.
if $stdout.tty?
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true"
end
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true" if $stdout.tty?
end
end
@ -88,9 +86,7 @@ module Homebrew
initial_revision = ENV["HOMEBREW_UPDATE_BEFORE"].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!"
end
odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty?
if initial_revision != current_revision
update_preinstall_header
@ -121,9 +117,7 @@ module Homebrew
end
if !updated
if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
puts "Already up-to-date."
end
puts "Already up-to-date." if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"]
else
if hub.empty?
puts "No changes to formulae."

View File

@ -25,7 +25,7 @@ git_init_if_necessary() {
then
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/homebrew-core"
else
CORE_OFFICIAL_REMOTE="https://github.com/Linuxbrew/homebrew-core"
CORE_OFFICIAL_REMOTE="https://github.com/Homebrew/linuxbrew-core"
fi
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_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]*)
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"

View File

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

View File

@ -1,6 +1,4 @@
unless ENV["HOMEBREW_BREW_FILE"]
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!"
end
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
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
def get_env_or_raise(env)
unless ENV[env]
raise MissingEnvironmentVariables, "#{env} was not exported!"
end
raise MissingEnvironmentVariables, "#{env} was not exported!" unless ENV[env]
ENV[env]
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -331,6 +331,7 @@ module Homebrew
username = response.fetch("owner").fetch("login")
rescue GitHub::AuthenticationFailedError => e
raise unless e.github_message =~ /forking is disabled/
# If the repository is private, forking might be disabled.
# Create branches in the repository itself instead.
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.extend(StringInreplaceExtension)
replacement_pairs.each do |old, new|
unless Homebrew.args.quiet?
ohai "replace #{old.inspect} with #{new.inspect}"
end
unless old
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
end
ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
contents.gsub!(old, new)
end
unless contents.errors.empty?
raise Utils::InreplaceError, path => contents.errors
end
raise Utils::InreplaceError, path => contents.errors unless contents.errors.empty?
path.atomic_write(contents) if args.write?
contents
else
Utils::Inreplace.inreplace(path) do |s|
replacement_pairs.each do |old, new|
unless Homebrew.args.quiet?
ohai "replace #{old.inspect} with #{new.inspect}"
end
unless old
raise "No old value for new value #{new}! Did you pass the wrong arguments?"
end
ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet?
raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old
s.gsub!(old, new)
end

View File

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

View File

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

View File

@ -23,9 +23,7 @@ module Homebrew
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
if !bintray_user || !bintray_key
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!"
end
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key
ARGV.formulae.each do |f|
bintray_package = Utils::Bottles::Bintray.package f.name

View File

@ -66,17 +66,11 @@ module Homebrew
pull_args.parse
if ARGV.named.empty?
odie "This command requires at least one argument containing a URL or pull request number"
end
odie "This command requires at least one argument containing a URL or pull request number" if ARGV.named.empty?
# Passthrough Git environment variables for e.g. git am
if ENV["HOMEBREW_GIT_NAME"]
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"]
end
if ENV["HOMEBREW_GIT_EMAIL"]
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"]
end
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"]
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"]
# Depending on user configuration, git may try to invoke gpg.
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)
_, user, repo, issue = *api_match
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)
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
odie "Not a GitHub pull request or commit: #{arg}"
end
if !testing_job && args.bottle? && issue.nil?
odie "No pull request detected!"
end
odie "No pull request detected!" if !testing_job && args.bottle? && issue.nil?
if tap
tap.install unless tap.installed?
@ -157,9 +149,7 @@ module Homebrew
end
odie "Can not bump if non-formula files are changed" unless patch_changes[:others].empty?
end
if is_bumpable
old_versions = current_versions_from_info_external(patch_changes[:formulae].first)
end
old_versions = current_versions_from_info_external(patch_changes[:formulae].first) if is_bumpable
patch_puller.apply_patch
changed_formulae_names = []
@ -288,9 +278,7 @@ module Homebrew
end
def publish_changed_formula_bottles(tap, changed_formulae_names)
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Need to load formulae to publish them!"
end
raise "Need to load formulae to publish them!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
published = []
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)
package = Utils::Bottles::Bintray.package(f.name)
info = FormulaInfoFromJson.lookup(f.full_name)
if info.nil?
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}"
end
raise "Failed publishing bottle: failed reading formula info for #{f.full_name}" if info.nil?
unless info.bottle_info_any
opoo "No bottle defined in formula #{package}"
@ -562,9 +548,7 @@ module Homebrew
def verify_bintray_published(formulae_names)
return if formulae_names.empty?
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
raise "Need to load formulae to verify their publication!"
end
raise "Need to load formulae to verify their publication!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
ohai "Verifying bottles published on Bintray"
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})!"
end
if retry_count >= max_retries
raise "Failed to find published #{f} bottle at #{url}!"
end
raise "Failed to find published #{f} bottle at #{url}!" if retry_count >= max_retries
print(wrote_dots ? "." : "Waiting on Bintray.")
wrote_dots = true
@ -630,9 +612,7 @@ module Homebrew
curl_download url, to: filename
break
rescue
if retry_count >= max_curl_retries
raise "Failed to download #{f} bottle from #{url}!"
end
raise "Failed to download #{f} bottle from #{url}!" if retry_count >= max_curl_retries
puts "curl download failed; retrying in #{curl_retry_delay_seconds} sec"
sleep curl_retry_delay_seconds

View File

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

View File

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

View File

@ -106,6 +106,32 @@ module Homebrew
EOS
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
return if DevelopmentTools.installed?
@ -278,9 +304,7 @@ module Homebrew
next unless d.directory?
d.find do |path|
if path.symlink? && !path.resolved_path_exists?
broken_symlinks << path
end
broken_symlinks << path if path.symlink? && !path.resolved_path_exists?
end
end
return if broken_symlinks.empty?
@ -531,60 +555,16 @@ module Homebrew
end
def check_brew_git_origin
return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist?
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
examine_git_origin(HOMEBREW_REPOSITORY, "Homebrew/brew")
end
def check_coretap_git_origin
coretap_path = CoreTap.instance.path
return if !Utils.git_available? || !(coretap_path/".git").exist?
examine_git_origin(CoreTap.instance.path, CoreTap.instance.full_name)
end
origin = coretap_path.git_origin
if origin.nil?
<<~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
def check_casktap_git_origin
cask = Tap.default_cask_tap
examine_git_origin(cask.path, cask.full_name) if cask.installed?
end
def check_coretap_git_branch
@ -611,7 +591,7 @@ module Homebrew
<<~EOS
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`.
EOS
end

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ module Homebrew
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
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
end

View File

@ -2,6 +2,6 @@ class CoreTap < Tap
# @private
def initialize
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

View File

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

View File

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

View File

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

View File

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

View File

@ -176,9 +176,7 @@ class Formula
@name = name
@path = path
@alias_path = alias_path
@alias_name = if alias_path
File.basename(alias_path)
end
@alias_name = (File.basename(alias_path) if alias_path)
@revision = self.class.revision || 0
@version_scheme = self.class.version_scheme || 0
@ -248,14 +246,10 @@ class Formula
end
def validate_attributes!
if name.nil? || name.empty? || name =~ /\s/
raise FormulaValidationError.new(full_name, :name, name)
end
raise FormulaValidationError.new(full_name, :name, name) if name.nil? || name.empty? || name =~ /\s/
url = active_spec.url
if url.nil? || url.empty? || url =~ /\s/
raise FormulaValidationError.new(full_name, :url, url)
end
raise FormulaValidationError.new(full_name, :url, url) if url.nil? || url.empty? || url =~ /\s/
val = version.respond_to?(:to_str) ? version.to_str : version
return unless val.nil? || val.empty? || val =~ /\s/
@ -1338,9 +1332,7 @@ class Formula
# Avoid false positives for clock_gettime support on 10.11.
# 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"
end
args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0"
args
end
@ -1430,7 +1422,7 @@ class Formula
@installed ||= racks.flat_map do |rack|
begin
Formulary.from_rack(rack)
rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError
rescue
[]
end
end.uniq(&:name)
@ -1842,9 +1834,7 @@ class Formula
pretty_args.delete "--disable-debug"
end
pretty_args.each_index do |i|
if pretty_args[i].to_s.start_with? "import setuptools"
pretty_args[i] = "import setuptools..."
end
pretty_args[i] = "import setuptools..." if pretty_args[i].to_s.start_with? "import setuptools"
end
ohai "#{cmd} #{pretty_args * " "}".strip
@ -1957,9 +1947,7 @@ class Formula
# 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
# only installed version is a pinned formula.
unless quiet
opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed"
end
opoo "Skipping #{full_name}: most recent version #{pkg_version} not installed" unless quiet
end
eligible_for_cleanup
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,9 +89,7 @@ module RuboCop
class OptionDeclarations < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, body_node)
if find_method_def(body_node, :options)
problem "Use new-style option definitions"
end
problem "Use new-style option definitions" if find_method_def(body_node, :options)
find_instance_method_call(body_node, :build, :without?) do |method|
next unless unless_modifier?(method.parent)
@ -327,9 +325,7 @@ module RuboCop
problem "Use Language::Node for npm install args" unless languageNodeModule?(method_node)
end
if find_method_def(body_node, :test)
problem "Use new-style test definitions (test do)"
end
problem "Use new-style test definitions (test do)" if find_method_def(body_node, :test)
find_method_with_args(body_node, :skip_clean, :all) do
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})."
end
if url.end_with?("/download")
problem "Don't use /download in SourceForge urls (url is #{url})."
end
problem "Don't use /download in SourceForge urls (url is #{url})." if url.end_with?("/download")
if url =~ %r{^https?://sourceforge\.}
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|
r.owner = self
r.version ||= begin
if version.nil?
raise "#{full_name}: version missing for \"#{r.name}\" resource!"
end
raise "#{full_name}: version missing for \"#{r.name}\" resource!" if version.nil?
if version.head?
Version.create("HEAD")

View File

@ -30,9 +30,7 @@ module Homebrew
args << "--parallel"
end
if ARGV.verbose?
args += ["--extra-details", "--display-cop-names"]
end
args += ["--extra-details", "--display-cop-names"] if ARGV.verbose?
if options[:except_cops]
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)
end
if cops_to_include.empty?
odie "RuboCops #{options[:only_cops].join(",")} were not found"
end
odie "RuboCops #{options[:only_cops].join(",")} were not found" if cops_to_include.empty?
args << "--only" << cops_to_include.join(",")
end

View File

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

View File

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

View File

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

View File

@ -22,17 +22,13 @@ class Tap
repo = args.second
end
if [user, repo].any? { |part| part.nil? || part.include?("/") }
raise "Invalid tap name '#{args.join("/")}'"
end
raise "Invalid tap name '#{args.join("/")}'" if [user, repo].any? { |part| part.nil? || part.include?("/") }
# 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
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
end
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
cache_key = "#{user}/#{repo}".downcase
cache.fetch(cache_key) { |key| cache[key] = Tap.new(user, repo) }
@ -280,9 +276,7 @@ class Tap
begin
safe_system "git", *args
unless Readall.valid_tap?(self, aliases: true)
unless ARGV.homebrew_developer?
raise "Cannot tap #{name}: invalid syntax in tap!"
end
raise "Cannot tap #{name}: invalid syntax in tap!" unless ARGV.homebrew_developer?
end
rescue Interrupt, RuntimeError
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)
# 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_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
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(
cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"),
args: ["--please"],

View File

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

View File

@ -179,19 +179,19 @@ describe Homebrew::CLI::Parser do
end
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(:[]).with("HOMEBREW_SWITCH_A").and_return("1")
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return(nil)
parser.parse(["--switch-b"])
expect(Homebrew.args.switch_a).to be_falsy
expect(Homebrew.args).to be_switch_b
end
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_B").and_return("1")
allow(ENV).to receive(:[])
expect { parser.parse(["--switch-a", "--switch-b"]) }.to raise_error(Homebrew::CLI::OptionConflictError)
expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
end
end

View File

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

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