[rubygems/rubygems] Allow --install-dir to be specified together with --user-install

The combination of `install-dir` and `--user-install` used to be
disabled for no good reason. This even makes problem on Linux
distributions such as Fedora, where `--user-install` is set by default
via operating_system.rb.

The `--install-dir` is already prefered over the `--user-install` by
the implementation, therefore just drop the check.

https://github.com/rubygems/rubygems/commit/313b1c5e76
This commit is contained in:
Vít Ondruch 2023-10-23 17:12:51 +02:00 committed by Hiroshi SHIBATA
parent bd5368fdec
commit ca7444cc44
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
2 changed files with 0 additions and 23 deletions

View File

@ -136,13 +136,6 @@ You can use `i` command instead of `install`.
"#{program_name} [options] GEMNAME [GEMNAME ...] -- --build-flags"
end
def check_install_dir # :nodoc:
if options[:install_dir] && options[:user_install]
alert_error "Use --install-dir or --user-install but not both"
terminate_interaction 1
end
end
def check_version # :nodoc:
if options[:version] != Gem::Requirement.default &&
get_all_gem_names.size > 1
@ -162,7 +155,6 @@ You can use `i` command instead of `install`.
ENV.delete "GEM_PATH" if options[:install_dir].nil?
check_install_dir
check_version
load_hooks

View File

@ -436,21 +436,6 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal expected, output
end
def test_execute_conflicting_install_options
@cmd.options[:user_install] = true
@cmd.options[:install_dir] = "whatever"
use_ui @ui do
assert_raise Gem::MockGemUi::TermError do
@cmd.execute
end
end
expected = "ERROR: Use --install-dir or --user-install but not both\n"
assert_equal expected, @ui.error
end
def test_execute_prerelease_skipped_when_no_flag_set
spec_fetcher do |fetcher|
fetcher.gem "a", 1