File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,44 @@ def self.specific_extra_args_hash=(value)
6060 end
6161end
6262
63+ class Gem ::Installer
64+ # Copy from Gem::Installer#install with install_as_default option from old version
65+ def install_default_gem
66+ pre_install_checks
67+
68+ run_pre_install_hooks
69+
70+ spec . loaded_from = default_spec_file
71+
72+ FileUtils . rm_rf gem_dir
73+ FileUtils . rm_rf spec . extension_dir
74+
75+ dir_mode = options [ :dir_mode ]
76+ FileUtils . mkdir_p gem_dir , mode : dir_mode && 0o755
77+
78+ extract_bin
79+ write_default_spec
80+
81+ generate_bin
82+ generate_plugins
83+
84+ File . chmod ( dir_mode , gem_dir ) if dir_mode
85+
86+ say spec . post_install_message if options [ :post_install_message ] && !spec . post_install_message . nil?
87+
88+ Gem ::Specification . add_spec ( spec )
89+
90+ load_plugin
91+
92+ run_post_install_hooks
93+
94+ spec
95+ rescue Errno ::EACCES => e
96+ # Permission denied - /path/to/foo
97+ raise Gem ::FilePermissionError , e . message . split ( " - " ) . last
98+ end
99+ end
100+
63101##
64102# RubyGemTestCase provides a variety of methods for testing rubygems and
65103# gem-related behavior in a sandbox. Through RubyGemTestCase you can install
@@ -812,7 +850,7 @@ def install_specs(*specs)
812850 def install_default_gems ( *specs )
813851 specs . each do |spec |
814852 installer = Gem ::Installer . for_spec ( spec )
815- installer . install
853+ installer . install_default_gem
816854 Gem . register_default_spec ( spec )
817855 end
818856 end
You can’t perform that action at this time.
0 commit comments