Class: Debci::Package

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/debci/package.rb', line 5

def name
  @name
end

#repositoryObject

Returns the value of attribute repository

Returns:

  • (Object)

    the current value of repository



5
6
7
# File 'lib/debci/package.rb', line 5

def repository
  @repository
end

Instance Method Details

#all_statusObject

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

Returns:

  • (Boolean)


115
116
117
# File 'lib/debci/package.rb', line 115

def always_failing?(suite = nil)
  !had_success?(suite)
end

#architecturesObject

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

Returns:

  • (Boolean)


101
102
103
# File 'lib/debci/package.rb', line 101

def blacklisted?(params = {})
  Debci.blacklist.include?(name, params)
end

#blacklisted_statusObject

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_neutralObject

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

#failuresObject

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

Returns:

  • (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

#newsObject

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

#prefixObject



96
97
98
99
# File 'lib/debci/package.rb', line 96

def prefix
  name =~ /^((lib)?.)/
  Regexp.last_match(1)
end

#statusObject

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

#suitesObject

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

#tmpfailObject

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_sObject



86
87
88
89
# File 'lib/debci/package.rb', line 86

def to_s  # :nodoc:

  "<Package #{name}>"
end

#to_strObject



91
92
93
94
# File 'lib/debci/package.rb', line 91

def to_str  # :nodoc:

  name
end