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
Source
# File lib/whimsy/asf/config.rb, line 116 def self.[](value) @testdata[value] || @config[value] end
Look up a configuration value by name (generally a symbol, like :svn
). Allows test overrides
Source
# File lib/whimsy/asf/config.rb, line 122 def self.[]=(name, path) @testdata[name] = File.expand_path(path) end
Set a local directory corresponding to a path Useful as a test data override.
Source
# File lib/whimsy/asf/config.rb, line 110 def self.get(value) @config[value] end
Look up a configuration value by name (generally a symbol, like :svn
).
Source
# File lib/whimsy/asf/config.rb, line 148 def self.getexepath(name) @config[:exepaths]&.fetch(name, name) || name end
Get an executable path override
e.g. :exepaths:
gpg: /usr/local/bin/gpg3
returns its input if no override is found
Source
# File lib/whimsy/asf/config.rb, line 131 def self.setroot(path) @root = path end
For testing only!!
Source
# File lib/whimsy/asf/config.rb, line 137 def self.setsvnroot(path) raise RuntimeError "Invalid path: #{path}" unless path.end_with? '/*' @config[:svn] = path end
Testing only: override svn config path must end in /*