Allow more developer commands with HOMEBREW_INSTALL_FROM_API
This commit is contained in:
parent
d23dba67ca
commit
b896f6cb0d
@ -107,6 +107,10 @@ begin
|
||||
end
|
||||
|
||||
if internal_cmd || Commands.external_ruby_v2_cmd_path(cmd)
|
||||
if Commands::INSTALL_FROM_API_FORBIDDEN_COMMANDS.include?(cmd) && Homebrew::EnvConfig.install_from_api?
|
||||
odie "This command cannot be run while HOMEBREW_INSTALL_FROM_API is set!"
|
||||
end
|
||||
|
||||
Homebrew.send Commands.method_name(cmd)
|
||||
elsif (path = Commands.external_ruby_cmd_path(cmd))
|
||||
require?(path)
|
||||
|
@ -748,34 +748,6 @@ then
|
||||
export HOMEBREW_DEVELOPER_COMMAND="1"
|
||||
fi
|
||||
|
||||
# Set HOMEBREW_DEVELOPER_MODE if this command will turn (or keep) developer mode on. This is the case if:
|
||||
# - The command being run is not `brew developer off`
|
||||
# - Any of the following are true
|
||||
# - HOMEBREW_DEVELOPER is set
|
||||
# - HOMEBREW_DEV_CMD_RUN is set
|
||||
# - A developer command is being run
|
||||
# - The command being run is `brew developer on`
|
||||
if [[ "${HOMEBREW_COMMAND}" != "developer" || ! $* =~ "off" ]] &&
|
||||
[[ -n "${HOMEBREW_DEVELOPER}" ||
|
||||
-n "${HOMEBREW_DEV_CMD_RUN}" ||
|
||||
-n "${HOMEBREW_DEVELOPER_COMMAND}" ||
|
||||
"${HOMEBREW_COMMAND}" == "developer" && $* =~ "on" ]]
|
||||
then
|
||||
export HOMEBREW_DEVELOPER_MODE="1"
|
||||
fi
|
||||
|
||||
if [[ -n "${HOMEBREW_INSTALL_FROM_API}" && -n "${HOMEBREW_DEVELOPER_COMMAND}" && "${HOMEBREW_COMMAND}" != "irb" ]]
|
||||
then
|
||||
odie "Developer commands cannot be run while HOMEBREW_INSTALL_FROM_API is set!"
|
||||
elif [[ -n "${HOMEBREW_INSTALL_FROM_API}" && -n "${HOMEBREW_DEVELOPER_MODE}" ]]
|
||||
then
|
||||
message="Developers should not have HOMEBREW_INSTALL_FROM_API set!
|
||||
Please unset HOMEBREW_INSTALL_FROM_API or turn developer mode off by running:
|
||||
brew developer off
|
||||
"
|
||||
opoo "${message}"
|
||||
fi
|
||||
|
||||
if [[ -n "${HOMEBREW_DEVELOPER_COMMAND}" && -z "${HOMEBREW_DEVELOPER}" ]]
|
||||
then
|
||||
if [[ -z "${HOMEBREW_DEV_CMD_RUN}" ]]
|
||||
|
@ -140,6 +140,10 @@ module Homebrew
|
||||
def install
|
||||
args = install_args.parse
|
||||
|
||||
if args.build_from_source? && Homebrew::EnvConfig.install_from_api?
|
||||
raise UsageError, "--build-from-source is not supported when using HOMEBREW_INSTALL_FROM_API."
|
||||
end
|
||||
|
||||
if args.env.present?
|
||||
# Can't use `replacement: false` because `install_args` are used by
|
||||
# `build.rb`. Instead, `hide_from_man_page` and don't do anything with
|
||||
|
@ -88,6 +88,10 @@ module Homebrew
|
||||
def reinstall
|
||||
args = reinstall_args.parse
|
||||
|
||||
if args.build_from_source? && Homebrew::EnvConfig.install_from_api?
|
||||
raise UsageError, "--build-from-source is not supported when using HOMEBREW_INSTALL_FROM_API."
|
||||
end
|
||||
|
||||
formulae, casks = args.named.to_formulae_and_casks(method: :resolve)
|
||||
.partition { |o| o.is_a?(Formula) }
|
||||
|
||||
|
@ -31,6 +31,25 @@ module Commands
|
||||
"tc" => "typecheck",
|
||||
}.freeze
|
||||
|
||||
INSTALL_FROM_API_FORBIDDEN_COMMANDS = %w[
|
||||
audit
|
||||
bottle
|
||||
bump-cask-pr
|
||||
bump-formula-pr
|
||||
bump-revision
|
||||
bump-unversioned-casks
|
||||
cat
|
||||
create
|
||||
edit
|
||||
extract
|
||||
formula
|
||||
livecheck
|
||||
pr-pull
|
||||
pr-upload
|
||||
test
|
||||
update-python-resources
|
||||
].freeze
|
||||
|
||||
def valid_internal_cmd?(cmd)
|
||||
require?(HOMEBREW_CMD_PATH/cmd)
|
||||
end
|
||||
|
@ -114,7 +114,7 @@ module Homebrew
|
||||
end.compact
|
||||
@sort = " (sorted by installs in the last 90 days; top 10,000 only)"
|
||||
|
||||
all_formulae = Formula
|
||||
all_formulae = Formula.all
|
||||
end
|
||||
|
||||
[formulae, all_formulae, formula_installs]
|
||||
|
Loading…
x
Reference in New Issue
Block a user