class ASF::Config
Support for local (development) configuration overrides to be stored in .whimsy
files in YAML format. Allows the specification of where subversion, git, and other files are stored, where updated files are cached, mailing list configuration, and other values.
Any .whimsy file in your home directory is processed first.
Additionally, a search is made for .whimsy files in the current working directory and then working up the directory path and finally in /srv. If such a .whimsy file is found, it will be processed for overrides to the configuration.
The configuration value of :root:, if provided, will establish the default root directory for a number of files/directories (among them, svn, git, and subscriptions). If the value is ‘.’ and the parent directory for this file contains a ‘whimsy` subdirectory, then the parent directory will be considered the root.
Public Class Methods
Look up a configuration value by name (generally a symbol, like :svn
). Allows test overrides
# File lib/whimsy/asf/config.rb, line 114 def self.[](value) @testdata[value] || @config[value] end
Set a local directory corresponding to a path Useful as a test data override.
# File lib/whimsy/asf/config.rb, line 120 def self.[]=(name, path) @testdata[name] = File.expand_path(path) end
Look up a configuration value by name (generally a symbol, like :svn
).
# File lib/whimsy/asf/config.rb, line 108 def self.get(value) @config[value] end
Get an executable path override
e.g. :exepaths:
gpg: /usr/local/bin/gpg3
returns its input if no override is found
# File lib/whimsy/asf/config.rb, line 146 def self.getexepath(name) @config[:exepaths]&.fetch(name, name) || name end
# File lib/whimsy/asf/config.rb, line 124 def self.root @root end
For testing only!!
# File lib/whimsy/asf/config.rb, line 129 def self.setroot(path) @root = path end
Testing only: override svn config path must end in /*
# File lib/whimsy/asf/config.rb, line 135 def self.setsvnroot(path) raise RuntimeError "Invalid path: #{path}" unless path.end_with? '/*' @config[:svn] = path end