Class: Debci::Package
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Debci::Package
- Defined in:
- lib/debci/package.rb
Overview
This class represents a single package.
Class Method Summary collapse
Instance Method Summary collapse
-
#fail_or_neutral ⇒ Object
Returns an Array of statuses where this package is failing or neutral.
-
#history(suite, architecture) ⇒ Object
Returns an array of Debci::Job objects that represent the test history for this package.
- #last_updated_at(suite = nil) ⇒ Object
- #news ⇒ Object
- #prefix ⇒ Object
- #reject_list_comment(params = {}) ⇒ Object
- #reject_listed?(params = {}) ⇒ Boolean
-
#status ⇒ Object
Returns a matrix of Debci::Job objects, where rows represent architectures and columns represent suites:.
- #to_s ⇒ Object
- #to_str ⇒ Object
Class Method Details
.prefix(name) ⇒ Object
79 80 81 82 |
# File 'lib/debci/package.rb', line 79 def self.prefix(name) name =~ /^((lib)?.)/ Regexp.last_match(1) end |
.prefixes ⇒ Object
74 75 76 77 |
# File 'lib/debci/package.rb', line 74 def self.prefixes # FIXME: optimize(?) select(:name).distinct.pluck(:name).map { |n| prefix(n) }.sort.uniq end |
Instance Method Details
#fail_or_neutral ⇒ Object
Returns an Array of statuses where this package is failing or neutral.
60 61 62 |
# File 'lib/debci/package.rb', line 60 def fail_or_neutral status.flatten.compact.select { |p| (p.status.to_sym == :fail) || (p.status.to_sym == :neutral) } end |
#history(suite, architecture) ⇒ Object
Returns an array of Debci::Job objects that represent the test history for this package
51 52 53 |
# File 'lib/debci/package.rb', line 51 def history(suite, architecture) Debci::Job.history(self, suite, architecture) end |
#last_updated_at(suite = nil) ⇒ Object
96 97 98 99 |
# File 'lib/debci/package.rb', line 96 def last_updated_at(suite = nil) statuses = status.flatten.compact.select { |s| s.suite == suite || !suite } statuses.map(&:date).compact.max end |
#news ⇒ Object
55 56 57 |
# File 'lib/debci/package.rb', line 55 def news jobs.newsworthy.order('date DESC').first(10) end |
#prefix ⇒ Object
84 85 86 |
# File 'lib/debci/package.rb', line 84 def prefix self.class.prefix(name) end |
#reject_list_comment(params = {}) ⇒ Object
92 93 94 |
# File 'lib/debci/package.rb', line 92 def reject_list_comment(params = {}) Debci.reject_list.comment(name, params) end |
#reject_listed?(params = {}) ⇒ Boolean
88 89 90 |
# File 'lib/debci/package.rb', line 88 def reject_listed?(params = {}) Debci.reject_list.include?(name, params) end |
#status ⇒ Object
Returns a matrix of Debci::Job 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::Job object. Note: Contains statuses which are not rejectlisted
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/debci/package.rb', line 34 def status @status ||= begin map = package_status.includes(:job).each_with_object({}) do |st, memo| memo[st.arch] ||= {} memo[st.arch][st.suite] = st.job end Debci.config.arch_list.map do |arch| Debci.config.suite_list.map do |suite| map[arch] && map[arch][suite] end end end end |
#to_s ⇒ Object
64 65 66 67 |
# File 'lib/debci/package.rb', line 64 def to_s # :nodoc: "<Package #{name}>" end |
#to_str ⇒ Object
69 70 71 72 |
# File 'lib/debci/package.rb', line 69 def to_str # :nodoc: name end |