Class: Debci::Package
- Inherits:
-
Struct
- Object
- Struct
- Debci::Package
- Defined in:
- lib/debci/package.rb
Overview
This class represents a single package. See Debci::Repository for how to obtain one of these.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
-
#all_status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:.
- #always_failing?(suite = nil) ⇒ Boolean
-
#architectures ⇒ Object
Returns the architectures in which this package is available.
- #blacklist_comment(params = {}) ⇒ Object
- #blacklisted?(params = {}) ⇒ Boolean
-
#blacklisted_status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:.
-
#fail_or_neutral ⇒ Object
Returns an Array of statuses where this package is failing or neutral.
-
#failures ⇒ Object
Returns an Array of statuses where this package is failing.
- #had_success?(suite = nil) ⇒ Boolean
-
#history(suite, architecture) ⇒ Object
Returns an array of Debci::Status objects that represent the test history for this package.
- #last_updated_at(suite = nil) ⇒ Object
-
#news ⇒ Object
Returns a list of Debci::Status objects that are newsworthy for this package.
- #prefix ⇒ Object
-
#status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:.
-
#suites ⇒ Object
Returns the suites in which this package is available.
-
#tmpfail ⇒ Object
Returns an Array of statuses where this package is temporarily failing.
- #to_s ⇒ Object
- #to_str ⇒ Object
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/debci/package.rb', line 5 def name @name end |
#repository ⇒ Object
Returns the value of attribute repository
5 6 7 |
# File 'lib/debci/package.rb', line 5 def repository @repository end |
Instance Method Details
#all_status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:
[
[ amd64_unstable , amd64_testing ],
[ i386_unstable, i386_testing ],
]
Each cell of the matrix contains a Debci::Status object. Note: Contains all statuses
40 41 42 |
# File 'lib/debci/package.rb', line 40 def all_status repository.all_status_for(self) end |
#always_failing?(suite = nil) ⇒ Boolean
115 116 117 |
# File 'lib/debci/package.rb', line 115 def always_failing?(suite = nil) !had_success?(suite) end |
#architectures ⇒ Object
Returns the architectures in which this package is available
7 8 9 |
# File 'lib/debci/package.rb', line 7 def architectures repository.architectures_for(self) end |
#blacklist_comment(params = {}) ⇒ Object
105 106 107 |
# File 'lib/debci/package.rb', line 105 def blacklist_comment(params = {}) Debci.blacklist.comment(name, params) end |
#blacklisted?(params = {}) ⇒ Boolean
101 102 103 |
# File 'lib/debci/package.rb', line 101 def blacklisted?(params = {}) Debci.blacklist.include?(name, params) end |
#blacklisted_status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:
[
[ amd64_unstable , amd64_testing ],
[ i386_unstable, i386_testing ],
]
Each cell of the matrix contains a Debci::Status object. Note: Contains blacklisted statuses
54 55 56 |
# File 'lib/debci/package.rb', line 54 def blacklisted_status repository.blacklisted_status_for(self) end |
#fail_or_neutral ⇒ Object
Returns an Array of statuses where this package is failing or neutral.
77 78 79 |
# File 'lib/debci/package.rb', line 77 def fail_or_neutral status.flatten.select { |p| (p.status == :fail) || (p.status == :neutral) } end |
#failures ⇒ Object
Returns an Array of statuses where this package is failing.
72 73 74 |
# File 'lib/debci/package.rb', line 72 def failures status.flatten.select { |p| p.status == :fail } end |
#had_success?(suite = nil) ⇒ Boolean
109 110 111 112 113 |
# File 'lib/debci/package.rb', line 109 def had_success?(suite = nil) return status.flatten.any? { |p| p.status == :pass } unless suite status.flatten.any? { |p| (p.status == :pass) && (p.suite == suite) } end |
#history(suite, architecture) ⇒ Object
Returns an array of Debci::Status objects that represent the test history for this package
60 61 62 |
# File 'lib/debci/package.rb', line 60 def history(suite, architecture) repository.history_for(self, suite, architecture) end |
#last_updated_at(suite = nil) ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/debci/package.rb', line 119 def last_updated_at(suite = nil) statuses = if suite status.flatten.select { |s| s.suite == suite } else status.flatten end statuses.map(&:date).compact.max end |
#news ⇒ Object
Returns a list of Debci::Status objects that are newsworthy for this package. The list is sorted with the most recent entries first and the older entries last.
67 68 69 |
# File 'lib/debci/package.rb', line 67 def news repository.news_for(self) end |
#prefix ⇒ Object
96 97 98 99 |
# File 'lib/debci/package.rb', line 96 def prefix name =~ /^((lib)?.)/ Regexp.last_match(1) end |
#status ⇒ Object
Returns a matrix of Debci::Status objects, where rows represent architectures and columns represent suites:
[
[ amd64_unstable , amd64_testing ],
[ i386_unstable, i386_testing ],
]
Each cell of the matrix contains a Debci::Status object. Note: Contains statuses which are not blacklisted
26 27 28 |
# File 'lib/debci/package.rb', line 26 def status repository.status_for(self) end |
#suites ⇒ Object
Returns the suites in which this package is available
12 13 14 |
# File 'lib/debci/package.rb', line 12 def suites repository.suites_for(self) end |
#tmpfail ⇒ Object
Returns an Array of statuses where this package is temporarily failing. If
82 83 84 |
# File 'lib/debci/package.rb', line 82 def tmpfail status.flatten.select { |p| p.status == :tmpfail } end |
#to_s ⇒ Object
86 87 88 89 |
# File 'lib/debci/package.rb', line 86 def to_s # :nodoc: "<Package #{name}>" end |
#to_str ⇒ Object
91 92 93 94 |
# File 'lib/debci/package.rb', line 91 def to_str # :nodoc: name end |