Class: AsciiBinderGabrielRH::Distro

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii_binder_gabriel_rh/distro.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(distro_map_filepath, distro_key, distro_config) ⇒ Distro

Returns a new instance of Distro.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 12

def initialize(distro_map_filepath,distro_key,distro_config)
  @id         = distro_key
  @name       = distro_config['name']
  @author     = distro_config['author']
  @site       = AsciiBinderGabrielRH::Site.new(distro_config)
  @branch_map = {}
  distro_config['branches'].each do |branch_name,branch_config|
    if @branch_map.has_key?(branch_name)
      Trollop::die "Error parsing #{distro_map_filepath}: distro '#{distro_key}' lists git branch '#{branch_name}' multiple times."
    end
    @branch_map[branch_name] = AsciiBinderGabrielRH::DistroBranch.new(branch_name,branch_config,self)
  end
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



10
11
12
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10

def author
  @author
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10

def name
  @name
end

#siteObject (readonly)

Returns the value of attribute site.



10
11
12
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10

def site
  @site
end

Instance Method Details

#branch(branch_name) ⇒ Object



34
35
36
37
38
39
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 34

def branch(branch_name)
  unless @branch_map.has_key?(branch_name)
    Trollop::die "Distro '#{@id}' does not include branch '#{branch_name}' in the distro map."
  end
  @branch_map[branch_name]
end

#branch_idsObject



41
42
43
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 41

def branch_ids
  @branch_map.keys
end

#branchesObject



45
46
47
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 45

def branches
  @branch_map.values
end

#errorsObject



30
31
32
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 30

def errors
  validate(true)
end

#is_valid?Boolean

Returns:

  • (Boolean)


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

def is_valid?
  validate
end