Class: Gem::Tasks::Install

Inherits:
Task
  • Object
show all
Defined in:
lib/rubygems/tasks/install.rb

Overview

The install task.

Constant Summary

Constants included from Printing

Printing::ANSI_BRIGHT, Printing::ANSI_CLEAR, Printing::ANSI_GREEN, Printing::ANSI_RED, Printing::ANSI_YELLOW, Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::STATUS_PREFIX

Instance Attribute Summary

Attributes inherited from Task

#project

Instance Method Summary collapse

Methods inherited from Task

#bundle, #gem, #gemspec_tasks, #invoke, #namespaced_tasks, #run, #task?

Methods included from Printing

#debug, #error, #status

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Install

Initializes the install task.

Parameters:

  • options (Hash) (defaults to: {})

    Additional options.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
21
# File 'lib/rubygems/tasks/install.rb', line 16

def initialize(options={})
  super()

  yield self if block_given?
  define
end

Instance Method Details

#defineObject

Defines the install task.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rubygems/tasks/install.rb', line 26

def define
  namespace :install do
    @project.builds.each do |build,packages|
      path = packages[:gem]

      task build => path do
        status "Installing #{File.basename(path)} ..."

        install(path)
      end
    end
  end

  desc "Installs all built gem packages"
  gemspec_tasks :install

  task :install_gem => :install # backwards compatibility with Hoe
end

#install(path) ⇒ Boolean

Pushes the gem by running gem install.

Parameters:

  • path (String)

    The path to the .gem file.

Returns:

  • (Boolean)

    Specifies whether gem install was successful or not.



56
57
58
# File 'lib/rubygems/tasks/install.rb', line 56

def install(path)
  gem 'install', '-q', path
end