aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2023-10-23 17:12:51 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-08 09:04:28 +0900
commitca7444cc44b1e939a31aa4366727b1ad09faa626 (patch)
tree3149fc71c1129838ad17d4c14994cf7492de3aaf
parentbd5368fdec1109b3bf3dfa635f6ab1d60cfc5ddc (diff)
downloadruby-ca7444cc44b1e939a31aa4366727b1ad09faa626.tar.gz
[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
-rw-r--r--lib/rubygems/commands/install_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb15
2 files changed, 0 insertions, 23 deletions
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index bbb2b08d71..9e59aee1c9 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -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
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 6a61f3645b..ba87534e69 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -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