Class: AsciiBinderGabrielRH::Distro
- Inherits:
-
Object
- Object
- AsciiBinderGabrielRH::Distro
- Defined in:
- lib/ascii_binder_gabriel_rh/distro.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
- #branch(branch_name) ⇒ Object
- #branch_ids ⇒ Object
- #branches ⇒ Object
- #errors ⇒ Object
-
#initialize(distro_map_filepath, distro_key, distro_config) ⇒ Distro
constructor
A new instance of Distro.
- #is_valid? ⇒ Boolean
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
#author ⇒ Object (readonly)
Returns the value of attribute author.
10 11 12 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10 def @author end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 10 def name @name end |
#site ⇒ Object (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_ids ⇒ Object
41 42 43 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 41 def branch_ids @branch_map.keys end |
#branches ⇒ Object
45 46 47 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 45 def branches @branch_map.values end |
#errors ⇒ Object
30 31 32 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 30 def errors validate(true) end |
#is_valid? ⇒ Boolean
26 27 28 |
# File 'lib/ascii_binder_gabriel_rh/distro.rb', line 26 def is_valid? validate end |