From 78094f0a379076f72902605a288b02e970e0ce0d Mon Sep 17 00:00:00 2001 From: xx752690102 <752690102@qq.com> Date: Tue, 31 Dec 2024 15:30:02 +0800 Subject: [PATCH] support serveral install options,especially --force option can resolve gem that created before ruby3.0 can successfully installed in(above)ruby 3.0. (ruby3.0 will check required_rubygems_version field which gems created before ruby3.0 does not has this field) --- lib/rubygems/commands/specific_install_command.rb | 15 +++++++++++++++ lib/specific_install/version.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/commands/specific_install_command.rb b/lib/rubygems/commands/specific_install_command.rb index 07db560..4def6a4 100644 --- a/lib/rubygems/commands/specific_install_command.rb +++ b/lib/rubygems/commands/specific_install_command.rb @@ -39,6 +39,18 @@ def initialize(output=STDOUT) add_option('-i', '--install-dir INSTALL_DIR', arguments) do |installdir, options| options[:installdir] = installdir end + + add_option('-f', '--force', arguments) do |force, options| + options[:force] = force + end + + add_option('--ignore-dependencies', arguments) do |ignore_dependencies, options| + options[:ignore_dependencies] = ignore_dependencies + end + + add_option('--minimal-deps', arguments) do |minimal_deps, options| + options[:minimal_deps] = minimal_deps + end end def arguments @@ -213,6 +225,9 @@ def install_gemspec install_options = {} install_options[:user_install] = options[:userinstall].nil? ? nil : true install_options[:install_dir] = options[:installdir] if options[:installdir] + install_options[:force] = options[:force].nil? ? nil : true + install_options[:ignore_dependencies] = options[:ignore_dependencies].nil? ? nil : true + install_options[:minimal_deps] = options[:minimal_deps].nil? ? nil : true inst = Gem::DependencyInstaller.new install_options inst.install gem else diff --git a/lib/specific_install/version.rb b/lib/specific_install/version.rb index b231a10..96316de 100644 --- a/lib/specific_install/version.rb +++ b/lib/specific_install/version.rb @@ -1,3 +1,3 @@ module SpecificInstall - VERSION = "0.3.8" + VERSION = "0.3.9" end