Class: PackageChanger::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/PackageChanger/config.rb

Constant Summary collapse

DEFAULT_CONF_FILE =

The location of the default config file

Pathname.new '/etc/packagechanger.conf'
SAMPLE_CONF_FILE =
Pathname.new(__FILE__).parent.parent.parent + 'data/packagechanger.conf.example'
CONF_KEYS =
{
    jamf_server: nil,
    jamf_port: :to_i,
    jamf_use_ssl: nil,
    jamf_user: nil,
    jamf_password: nil,
    testers_keyword: nil,
    release_keyword: nil
}.freeze

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initialize!



31
32
33
# File 'lib/PackageChanger/config.rb', line 31

def initialize
  read_global
end

Instance Method Details



41
42
43
# File 'lib/PackageChanger/config.rb', line 41

def print
  CONF_KEYS.keys.sort.each { |k| puts "#{k}: #{send k}" }
end

#read_globalObject



35
36
37
38
39
# File 'lib/PackageChanger/config.rb', line 35

def read_global
  return false unless DEFAULT_CONF_FILE.file? && DEFAULT_CONF_FILE.readable?

  read DEFAULT_CONF_FILE
end