Method: Gem::DependencyInstaller#install
- Defined in:
- lib/rubygems/dependency_installer.rb
#install(dep_or_name, version = Gem::Requirement.default) ⇒ Object
Installs the gem dep_or_name and all its dependencies. Returns an Array of installed gem specifications.
If the :prerelease option is set and there is a prerelease for dep_or_name the prerelease version will be installed.
Unless explicitly specified as a prerelease dependency, prerelease gems that dep_or_name depend on will not be installed.
If c-1.a depends on b-1 and a-1.a and there is a gem b-1.a available then c-1.a, b-1 and a-1.a will be installed. b-1.a will need to be installed separately.
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/rubygems/dependency_installer.rb', line 370 def install dep_or_name, version = Gem::Requirement.default request_set = resolve_dependencies dep_or_name, version @installed_gems = [] = { :bin_dir => @bin_dir, :build_args => @build_args, :env_shebang => @env_shebang, :force => @force, :format_executable => @format_executable, :ignore_dependencies => @ignore_dependencies, :security_policy => @security_policy, :user_install => @user_install, :wrappers => @wrappers, :install_as_default => @install_as_default } [:install_dir] = @install_dir if @only_install_dir request_set.install do |_, installer| @installed_gems << installer.spec if installer end @installed_gems.sort! # Since this is currently only called for docs, we can be lazy and just say # it's documentation. Ideally the hook adder could decide whether to be in # the background or not, and what to call it. in_background "Installing documentation" do Gem.done_installing_hooks.each do |hook| hook.call self, @installed_gems end end unless Gem.done_installing_hooks.empty? @installed_gems end |