class Gem::Tasks::Build::Gem

The `build:gem` task.

Public Class Methods

new(options={}) { |self| ... } click to toggle source

Initializes the `build:gem` task.

@param [Hash] options

Additional options.
Calls superclass method
# File lib/rubygems/tasks/build/gem.rb, line 21
def initialize(options={})
  super()

  yield self if block_given?
  define
end

Public Instance Methods

build(path,gemspec) click to toggle source

Builds the `.gem` package.

@param [String] path

The path for the `.gem` package.

@param [Gem::Specification] gemspec

The gemspec to build the `.gem` package from.

@api semipublic

# File lib/rubygems/tasks/build/gem.rb, line 52
def build(path,gemspec)
  gem = if ::Gem::VERSION > '2.'
          ::Gem::Package.build(gemspec)
        else
          ::Gem::Builder.new(gemspec).build
        end

  mv gem, Project::PKG_DIR
end
define() click to toggle source

Defines the `build:gem` task.

# File lib/rubygems/tasks/build/gem.rb, line 31
def define
  build_task :gem

  # backwards compatibility for Gem::PackageTask
  task :gem => 'build:gem'

  # backwards compatibility for Hoe
  task :package => 'build:gem'
end