Class: Debci::Config
- Inherits:
-
Struct
- Object
- Struct
- Debci::Config
- Defined in:
- lib/debci/config.rb
Overview
This class contains provides a Ruby interface to read debci configuration values.
Available configuration items:
-
data_basedir
: the root directory used by debci to store test run data
There is a globally accessible instance of this class accessible from the config
method of the Debci module.
>> Debci.config.data_basedir
=> "/path/to/debci/data"
Instance Attribute Summary collapse
-
#amqp_cacert ⇒ Object
Returns the value of attribute amqp_cacert.
-
#amqp_cert ⇒ Object
Returns the value of attribute amqp_cert.
-
#amqp_key ⇒ Object
Returns the value of attribute amqp_key.
-
#amqp_results_queue ⇒ Object
Returns the value of attribute amqp_results_queue.
-
#amqp_server ⇒ Object
Returns the value of attribute amqp_server.
-
#amqp_ssl ⇒ Object
Returns the value of attribute amqp_ssl.
-
#arch ⇒ Object
Returns the value of attribute arch.
-
#arch_list ⇒ Object
Returns the value of attribute arch_list.
-
#artifacts_url_base ⇒ Object
Returns the value of attribute artifacts_url_base.
-
#auth_fail_page ⇒ Object
Returns the value of attribute auth_fail_page.
-
#autopkgtest_basedir ⇒ Object
Returns the value of attribute autopkgtest_basedir.
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#backend_list ⇒ Object
Returns the value of attribute backend_list.
-
#config_dir ⇒ Object
Returns the value of attribute config_dir.
-
#data_basedir ⇒ Object
Returns the value of attribute data_basedir.
-
#data_retention_days ⇒ Object
(also: #data_retention)
Returns the value of attribute data_retention_days.
-
#database_url ⇒ Object
Returns the value of attribute database_url.
-
#disk_storage_limit ⇒ Object
Returns the value of attribute disk_storage_limit.
-
#distro_name ⇒ Object
Returns the value of attribute distro_name.
-
#failing_packages_per_page ⇒ Object
Returns the value of attribute failing_packages_per_page.
-
#html_dir ⇒ Object
Returns the value of attribute html_dir.
-
#packages_dir ⇒ Object
Returns the value of attribute packages_dir.
-
#pending_status_per_page ⇒ Object
Returns the value of attribute pending_status_per_page.
-
#quiet ⇒ Object
Returns the value of attribute quiet.
-
#salsa_client_id ⇒ Object
Returns the value of attribute salsa_client_id.
-
#salsa_client_secret ⇒ Object
Returns the value of attribute salsa_client_secret.
-
#secrets_dir ⇒ Object
Returns the value of attribute secrets_dir.
-
#sendmail_from ⇒ Object
Returns the value of attribute sendmail_from.
-
#sendmail_to ⇒ Object
Returns the value of attribute sendmail_to.
-
#session_secret ⇒ Object
Returns the value of attribute session_secret.
-
#slow_tests_duration_minutes ⇒ Object
Returns the value of attribute slow_tests_duration_minutes.
-
#status_visible_days ⇒ Object
Returns the value of attribute status_visible_days.
-
#suite ⇒ Object
Returns the value of attribute suite.
-
#suite_list ⇒ Object
Returns the value of attribute suite_list.
-
#url_base ⇒ Object
Returns the value of attribute url_base.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/debci/config.rb', line 85 def initialize # :nodoc: IO.popen(['debci', 'config', *members.map(&:to_s)]) do |data| data.each_line.each do |line| key, value = line.strip.split('=', 2) cast = self.class.cast_for(key) value = cast.call(value) self.send("#{key}=", value) end end end |
Instance Attribute Details
#amqp_cacert ⇒ Object
Returns the value of attribute amqp_cacert
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_cacert @amqp_cacert end |
#amqp_cert ⇒ Object
Returns the value of attribute amqp_cert
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_cert @amqp_cert end |
#amqp_key ⇒ Object
Returns the value of attribute amqp_key
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_key @amqp_key end |
#amqp_results_queue ⇒ Object
Returns the value of attribute amqp_results_queue
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_results_queue @amqp_results_queue end |
#amqp_server ⇒ Object
Returns the value of attribute amqp_server
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_server @amqp_server end |
#amqp_ssl ⇒ Object
Returns the value of attribute amqp_ssl
16 17 18 |
# File 'lib/debci/config.rb', line 16 def amqp_ssl @amqp_ssl end |
#arch ⇒ Object
Returns the value of attribute arch
16 17 18 |
# File 'lib/debci/config.rb', line 16 def arch @arch end |
#arch_list ⇒ Object
Returns the value of attribute arch_list
16 17 18 |
# File 'lib/debci/config.rb', line 16 def arch_list @arch_list end |
#artifacts_url_base ⇒ Object
Returns the value of attribute artifacts_url_base
16 17 18 |
# File 'lib/debci/config.rb', line 16 def artifacts_url_base @artifacts_url_base end |
#auth_fail_page ⇒ Object
Returns the value of attribute auth_fail_page
16 17 18 |
# File 'lib/debci/config.rb', line 16 def auth_fail_page @auth_fail_page end |
#autopkgtest_basedir ⇒ Object
Returns the value of attribute autopkgtest_basedir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def autopkgtest_basedir @autopkgtest_basedir end |
#backend ⇒ Object
Returns the value of attribute backend
16 17 18 |
# File 'lib/debci/config.rb', line 16 def backend @backend end |
#backend_list ⇒ Object
Returns the value of attribute backend_list
16 17 18 |
# File 'lib/debci/config.rb', line 16 def backend_list @backend_list end |
#config_dir ⇒ Object
Returns the value of attribute config_dir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def config_dir @config_dir end |
#data_basedir ⇒ Object
Returns the value of attribute data_basedir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def data_basedir @data_basedir end |
#data_retention_days ⇒ Object Also known as: data_retention
Returns the value of attribute data_retention_days
16 17 18 |
# File 'lib/debci/config.rb', line 16 def data_retention_days @data_retention_days end |
#database_url ⇒ Object
Returns the value of attribute database_url
16 17 18 |
# File 'lib/debci/config.rb', line 16 def database_url @database_url end |
#disk_storage_limit ⇒ Object
Returns the value of attribute disk_storage_limit
16 17 18 |
# File 'lib/debci/config.rb', line 16 def disk_storage_limit @disk_storage_limit end |
#distro_name ⇒ Object
Returns the value of attribute distro_name
16 17 18 |
# File 'lib/debci/config.rb', line 16 def distro_name @distro_name end |
#failing_packages_per_page ⇒ Object
Returns the value of attribute failing_packages_per_page
16 17 18 |
# File 'lib/debci/config.rb', line 16 def failing_packages_per_page @failing_packages_per_page end |
#html_dir ⇒ Object
Returns the value of attribute html_dir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def html_dir @html_dir end |
#packages_dir ⇒ Object
Returns the value of attribute packages_dir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def packages_dir @packages_dir end |
#pending_status_per_page ⇒ Object
Returns the value of attribute pending_status_per_page
16 17 18 |
# File 'lib/debci/config.rb', line 16 def pending_status_per_page @pending_status_per_page end |
#quiet ⇒ Object
Returns the value of attribute quiet
16 17 18 |
# File 'lib/debci/config.rb', line 16 def quiet @quiet end |
#salsa_client_id ⇒ Object
Returns the value of attribute salsa_client_id
16 17 18 |
# File 'lib/debci/config.rb', line 16 def salsa_client_id @salsa_client_id end |
#salsa_client_secret ⇒ Object
Returns the value of attribute salsa_client_secret
16 17 18 |
# File 'lib/debci/config.rb', line 16 def salsa_client_secret @salsa_client_secret end |
#secrets_dir ⇒ Object
Returns the value of attribute secrets_dir
16 17 18 |
# File 'lib/debci/config.rb', line 16 def secrets_dir @secrets_dir end |
#sendmail_from ⇒ Object
Returns the value of attribute sendmail_from
16 17 18 |
# File 'lib/debci/config.rb', line 16 def sendmail_from @sendmail_from end |
#sendmail_to ⇒ Object
Returns the value of attribute sendmail_to
16 17 18 |
# File 'lib/debci/config.rb', line 16 def sendmail_to @sendmail_to end |
#session_secret ⇒ Object
Returns the value of attribute session_secret
16 17 18 |
# File 'lib/debci/config.rb', line 16 def session_secret @session_secret end |
#slow_tests_duration_minutes ⇒ Object
Returns the value of attribute slow_tests_duration_minutes
16 17 18 |
# File 'lib/debci/config.rb', line 16 def slow_tests_duration_minutes @slow_tests_duration_minutes end |
#status_visible_days ⇒ Object
Returns the value of attribute status_visible_days
16 17 18 |
# File 'lib/debci/config.rb', line 16 def status_visible_days @status_visible_days end |
#suite ⇒ Object
Returns the value of attribute suite
16 17 18 |
# File 'lib/debci/config.rb', line 16 def suite @suite end |
#suite_list ⇒ Object
Returns the value of attribute suite_list
16 17 18 |
# File 'lib/debci/config.rb', line 16 def suite_list @suite_list end |
#url_base ⇒ Object
Returns the value of attribute url_base
16 17 18 |
# File 'lib/debci/config.rb', line 16 def url_base @url_base end |
Class Method Details
.cast_for(key) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/debci/config.rb', line 76 def self.cast_for(key) pair = types.find { |k,v| k === key } if pair pair[1] else lambda { |x| x == "" ? nil : x } end end |
.types ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/debci/config.rb', line 63 def self.types @types ||= { /_list$/ => lambda { |x| x.split}, # Array 'quiet' => lambda { |x| x == 'true' }, # boolean 'amqp_ssl' => lambda { |x| x == 'true' }, # boolean 'data_retention_days' => lambda { |x| x.to_i }, 'disk_storage_limit' => lambda { |x| x.to_i }, 'status_visible_days' => lambda { |x| x.to_i }, 'failing_packages_per_page' => lambda { |x| x.to_i }, 'slow_tests_duration_minutes' => lambda { |x| x.to_i } } end |