Class: Pallet

Inherits:
Object
  • Object
show all
Defined in:
lib/pallet.rb,
lib/pallet/gem.rb

Defined Under Namespace

Classes: Deb, Gem

Constant Summary collapse

VERSION =
'1.5.0'
NAMESPACE =
'package'
PACKAGE_DIR =
'pkg'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version = %x{svnversion}.chomp) {|_self| ... } ⇒ Pallet

Initializes the pallet to a sane state, and creates all the necessary Rake tasks. Passes a copy of itself to a block, if given, and uses that block for further initializiation. If no version is given, defaults to the output of svnversion.

Yields:

  • (_self)

Yield Parameters:

  • _self (Pallet)

    the object that the method was called on



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pallet.rb', line 46

def initialize(name, version = %x{svnversion}.chomp)

  # set up defaults
  self.name        = name
  self.version     = version
  self.author      = 'Anonymous'
  self.email       = '[email protected]'
  self.summary     = ''
  self.description = ''
  self.packages    = []
  
  # let block continue initialization, don't bother testing for
  # block_given? since we need a block
  yield self
  
  # check that we have _some_ package to build
  if packages.empty?
    raise TypeError, 'at least one package type must be specified'
  end

  # if no preferred format given, use the first one specified
  self.preferred_format ||= packages.first

  define_rake_tasks

end

Instance Attribute Details

#authorObject

The name of the current project maintainer.



26
27
28
# File 'lib/pallet.rb', line 26

def author
  @author
end

#descriptionObject

A longer, more detailed description of the package’s capabilities.



23
24
25
# File 'lib/pallet.rb', line 23

def description
  @description
end

#emailObject

The maintainer’s email address.



29
30
31
# File 'lib/pallet.rb', line 29

def email
  @email
end

#nameObject

The name of the project.



14
15
16
# File 'lib/pallet.rb', line 14

def name
  @name
end

#packagesObject

An enumerable with the package definitions for each package type you wish to support in your project.



33
34
35
# File 'lib/pallet.rb', line 33

def packages
  @packages
end

#preferred_formatObject

The preferred packaging format of your project. rake package will build this format, but others can still be built with rake package:#{format}.



38
39
40
# File 'lib/pallet.rb', line 38

def preferred_format
  @preferred_format
end

#summaryObject

A short description of the package function.



20
21
22
# File 'lib/pallet.rb', line 20

def summary
  @summary
end

#versionObject

The version number of the project to tag onto the package.



17
18
19
# File 'lib/pallet.rb', line 17

def version
  @version
end