Class: Debian::Build::Distribution

Inherits:
Object
  • Object
show all
Extended by:
BuildDirectoryMethods
Defined in:
lib/debian/build/distribution.rb

Constant Summary collapse

@@mirrors =
{ :debian => "http://ftp.debian.org/debian", :ubuntu => 'http://archive.ubuntu.com/ubuntu' }
@@local_names =
{ :oldstable => 'lenny', :stable => 'squeeze', :testing => 'wheezy' }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BuildDirectoryMethods

build_directory, build_directory=

Constructor Details

#initialize(flavor, distribution) ⇒ Distribution

Returns a new instance of Distribution.



7
8
9
10
# File 'lib/debian/build/distribution.rb', line 7

def initialize(flavor, distribution)
  @flavor = flavor
  @distribution = distribution.to_sym
end

Instance Attribute Details

#distributionObject (readonly)

Returns the value of attribute distribution.



5
6
7
# File 'lib/debian/build/distribution.rb', line 5

def distribution
  @distribution
end

#flavorObject (readonly)

Returns the value of attribute flavor.



5
6
7
# File 'lib/debian/build/distribution.rb', line 5

def flavor
  @flavor
end

Class Method Details

.allObject



12
13
14
# File 'lib/debian/build/distribution.rb', line 12

def self.all
  @@all ||= debian_distributions + ubuntu_distributions
end

.debian_distributionsObject



20
21
22
23
# File 'lib/debian/build/distribution.rb', line 20

def self.debian_distributions
  @@debian_distributions ||= 
    %w{oldstable stable testing unstable}.collect { |distribution| Distribution.new(:debian, distribution) }
end

.each(&block) ⇒ Object



16
17
18
# File 'lib/debian/build/distribution.rb', line 16

def self.each(&block)
  all.each &block
end

.mirrors=(mirrors) ⇒ Object



36
37
38
# File 'lib/debian/build/distribution.rb', line 36

def self.mirrors=(mirrors)
  @@mirrors.update(mirrors)
end

.ubuntu_distributionsObject



25
26
27
28
# File 'lib/debian/build/distribution.rb', line 25

def self.ubuntu_distributions
  @@ubuntu_distributions ||= 
    %w{karmic lucid maverick}.collect { |distribution| Distribution.new(:ubuntu, distribution) }
end

Instance Method Details

#local_nameObject



53
54
55
# File 'lib/debian/build/distribution.rb', line 53

def local_name
  @@local_names.fetch(distribution,self.to_s)
end

#mirrorObject



40
41
42
# File 'lib/debian/build/distribution.rb', line 40

def mirror
  @@mirrors[flavor]
end

#platformsObject



65
66
67
# File 'lib/debian/build/distribution.rb', line 65

def platforms
  Platform.all.select { |p| p.distribution == self }
end

#source_result_directoryObject



30
31
32
# File 'lib/debian/build/distribution.rb', line 30

def source_result_directory
  File.expand_path "#{Platform.build_directory}/sources/#{distribution}"
end

#task_nameObject



61
62
63
# File 'lib/debian/build/distribution.rb', line 61

def task_name
  to_s
end

#to_sObject



57
58
59
# File 'lib/debian/build/distribution.rb', line 57

def to_s
  distribution.to_s
end

#ubuntu?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/debian/build/distribution.rb', line 44

def ubuntu?
  flavor == :ubuntu
end

#unstable?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/debian/build/distribution.rb', line 48

def unstable?
  [ :unstable, :lucid ].include? distribution
end