Class: Gem::Tasks::Build::Task

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

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, #initialize, #invoke, #namespaced_tasks, #run, #task?

Methods included from Printing

#debug, #error, #status

Constructor Details

This class inherits a constructor from Gem::Tasks::Task

Instance Method Details

#build(path, gemspec) ⇒ Object

This method is abstract.

Parameters:

  • path (String)
  • gemspec (Gem::Specification)


15
16
# File 'lib/rubygems/tasks/build/task.rb', line 15

def build(path,gemspec)
end

#build_task(name, extname = name) ⇒ Object (protected)

Defines build task(s) for file type.

Parameters:

  • name (Symbol)

    The name for the task(s).

  • extname (String, Symbol) (defaults to: name)

    The file extension for the resulting files.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rubygems/tasks/build/task.rb', line 31

def build_task(name,extname=name)
  directory Project::PKG_DIR

  task :validate

  @project.builds.each do |build,packages|
    gemspec = @project.gemspecs[build]
    path    = packages[extname]

    # define file tasks, so the packages are not needless re-built
    file(path => [Project::PKG_DIR, *gemspec.files]) do
      invoke :validate

      status "Building #{File.basename(path)} ..."

      build(path,gemspec)
    end

    task "build:#{name}:#{build}" => path
    task "build:#{build}"         => "build:#{name}:#{build}"
  end

  gemspec_tasks "build:#{name}"

  desc "Builds all packages" unless task?(:build)
  task :build => "build:#{name}"
end