Class: Buildmeister::Project
- Inherits:
-
Object
- Object
- Buildmeister::Project
- Includes:
- StringUtils
- Defined in:
- lib/buildmeister/project.rb
Instance Attribute Summary collapse
-
#bins ⇒ Object
Returns the value of attribute bins.
-
#name ⇒ Object
Returns the value of attribute name.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #changed? ⇒ Boolean
- #display ⇒ Object
-
#find_tickets(*ids) ⇒ Object
There’s no good way to do this in the Lighthouse API.
-
#initialize(config, lighthouse_account, options = {}) ⇒ Project
constructor
A new instance of Project.
- #refresh! ⇒ Object
Methods included from StringUtils
Constructor Details
#initialize(config, lighthouse_account, options = {}) ⇒ Project
Returns a new instance of Project.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/buildmeister/project.rb', line 7 def initialize(config, lighthouse_account, = {}) self.name = config['name'] self.bins = [] bins.extend Finder self.project = lighthouse_account.projects.named(name) project_bins = project.bins config['bins'].each do |bin_name| bin = project_bins.find { |b| b.name == bin_name } raise "No bin named #{bin_name}" unless bin bins << Buildmeister::Bin.new(bin, [:mode], :annotations => config['annotations']) end config['personal_bins'].each do |bin_name| bin = project_bins.find { |b| !b.shared && (b.name == bin_name) } raise "No bin named #{bin_name}" unless bin bins << Buildmeister::Bin.new(bin, [:mode], :annotations => config['annotations']) end if config['personal_bins'] end |
Instance Attribute Details
#bins ⇒ Object
Returns the value of attribute bins.
5 6 7 |
# File 'lib/buildmeister/project.rb', line 5 def bins @bins end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/buildmeister/project.rb', line 5 def name @name end |
#project ⇒ Object
Returns the value of attribute project.
5 6 7 |
# File 'lib/buildmeister/project.rb', line 5 def project @project end |
Instance Method Details
#changed? ⇒ Boolean
56 57 58 |
# File 'lib/buildmeister/project.rb', line 56 def changed? bins.any? &:changed? end |
#display ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/buildmeister/project.rb', line 40 def display out = '' out << name + "\n" out << "#{divider}\n" bins.each do |bin| out << bin.display + "\n" end out end |
#find_tickets(*ids) ⇒ Object
There’s no good way to do this in the Lighthouse API. This is slow, but at least it’s easy to write.
34 35 36 37 38 |
# File 'lib/buildmeister/project.rb', line 34 def find_tickets(*ids) ids.map do |id| project.tickets(id).first end.compact end |
#refresh! ⇒ Object
52 53 54 |
# File 'lib/buildmeister/project.rb', line 52 def refresh! bins.each &:refresh! end |