Class: Debci::Backend
- Inherits:
-
Object
- Object
- Debci::Backend
- Defined in:
- lib/debci/backend.rb
Class Method Summary collapse
- .backend_list ⇒ Object
- .default ⇒ Object
-
.select(package, arch) ⇒ Object
Select which backend to use for the given package.
Class Method Details
.backend_list ⇒ Object
25 26 27 |
# File 'lib/debci/backend.rb', line 25 def self.backend_list Debci.config.backend_list end |
.default ⇒ Object
29 30 31 |
# File 'lib/debci/backend.rb', line 29 def self.default Debci.config.backend end |
.select(package, arch) ⇒ Object
Select which backend to use for the given package. The backend specified in the package backend
attribute will be used if that backend is available for the given architecture; otherwise, the configured backend list is searched, and if no available backend if found, the default backend is used as a fallback. The default backend is assumed to be available.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/debci/backend.rb', line 12 def self.select(package, arch) candidates = backend_list.dup if package.backend && candidates.first != package.backend candidates.unshift(package.backend) end selected = candidates.find do |backend| Debci::AMQP.queue_exists?(arch, backend) end selected || default end |