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
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/rubygems/installer.rb', line 212 def install pre_install_checks FileUtils.rm_f File.join gem_home, 'specifications', @spec.spec_name run_pre_install_hooks # Completely remove any previous gem files FileUtils.rm_rf gem_dir FileUtils.mkdir_p gem_dir spec.loaded_from = spec_file if @options[:install_as_default] extract_bin write_default_spec else extract_files build_extensions write_build_info_file run_post_build_hooks generate_bin write_spec write_cache_file end say spec. unless spec..nil? Gem::Specification.add_spec spec unless Gem::Specification.include? spec run_post_install_hooks spec # TODO This rescue is in the wrong place. What is raising this exception? # move this rescue to around the code that actually might raise it. rescue Zlib::GzipFile::Error raise Gem::InstallError, "gzip error installing #{gem}" end |