Method: Gem::Installer#install
- Defined in:
- lib/rubygems/installer.rb
#install ⇒ Object
Installs the gem and returns a loaded Gem::Specification for the installed gem.
The gem will be installed with the following structure:
@gem_home/
cache/<gem-version>.gem #=> a cached copy of the installed gem
gems/<gem-version>/... #=> extracted files
specifications/<gem-version>.gemspec #=> the Gem::Specification
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/rubygems/installer.rb', line 268 def install pre_install_checks run_pre_install_hooks # Set loaded_from to ensure extension_dir is correct spec.loaded_from = spec_file # Completely remove any previous gem files FileUtils.rm_rf gem_dir FileUtils.rm_rf spec.extension_dir dir_mode = [:dir_mode] FileUtils.mkdir_p gem_dir, mode: dir_mode && 0o755 extract_files build_extensions write_build_info_file run_post_build_hooks generate_bin generate_plugins write_spec write_cache_file File.chmod(dir_mode, gem_dir) if dir_mode say spec. if [:post_install_message] && !spec..nil? Gem::Specification.add_spec(spec) unless @install_dir load_plugin run_post_install_hooks spec rescue Errno::EACCES => e # Permission denied - /path/to/foo raise Gem::FilePermissionError, e..split(" - ").last end |