Class: Gem::Tasks::Build::Tar

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

Overview

The build:tar 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| ... } ⇒ Tar

Initializes the build:tar task.

Parameters:

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

    Additional options.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
21
22
# File 'lib/rubygems/tasks/build/tar.rb', line 17

def initialize(options={})
  super()

  yield self if block_given?
  define
end

Instance Method Details

#build(path, gemspec) ⇒ Object

Builds a .tar.gz archive.

Parameters:

  • path (String)

    The path for the .tar.gz archive.

  • gemspec (Gem::Specification)

    The gemspec to generate the archive from.



42
43
44
# File 'lib/rubygems/tasks/build/tar.rb', line 42

def build(path,gemspec)
  run 'tar', 'czf', path, *gemspec.files
end

#defineObject

Defines the build:tar task.



27
28
29
# File 'lib/rubygems/tasks/build/tar.rb', line 27

def define
  build_task :tar, 'tar.gz'
end