class QED::Settings
Constants
- DEFAULT_FILES
If files are not specified than these directories will be searched.
- OMIT_PATHS
Directory names to omit from automatic selection.
Attributes
Output format.
Paths to be added to $LOAD_PATH.
Parse mode.
File patterns to omit.
Libraries to be required.
Operate from project root?
Operate from system temporary directory?
Trace execution?
Public Class Methods
Initialize new Settings
instance.
# File lib/qed/settings.rb, line 23 def initialize(options={}, &block) initialize_defaults @profile = (options.delete(:profile) || default_profile).to_s load_profile(&block) options.each do |key, val| send("#{key}=", val) if val end end
Public Instance Methods
Remove and recreate temporary working directory.
# File lib/qed/settings.rb, line 158 def clear_directory FileUtils.rm_r(tmpdir) if File.exist?(tmpdir) FileUtils.mkdir_p(tmpdir) end
Profile name can come from ‘profile` or `p` environment variables.
# File lib/qed/settings.rb, line 51 def default_profile ENV['profile'] || ENV['p'] || 'default' end
Demonstration files (or globs).
# File lib/qed/settings.rb, line 56 def files @files ||= ( [DEFAULT_FILES.find{ |d| File.directory?(d) }].compact ) end
# File lib/qed/settings.rb, line 63 def files=(files) @files = ( if files.nil? or files.empty? nil else Array(files).flatten.compact end ) end
Initialize default settings.
# File lib/qed/settings.rb, line 38 def initialize_defaults @files = nil #DEFAULT_FILES @format = :dot @trace = false @mode = nil # ? @loadpath = ['lib'] @omit = OMIT_PATHS @rootless = false @requires = [] #@profile = :default end
Load QED
configuration profile. The load procedure is stored as a Proc object in a hash b/c different configuration systems can be used.
# File lib/qed/settings.rb, line 102 def load_profile(&block) config = QED.profiles[@profile] config.call(self) if config end
Profiles are collected from the RC library, unless RC is deactivated via the override file.
# File lib/qed/settings.rb, line 111 def profiles QED.profiles.keys end
Project’s root directory.
# File lib/qed/settings.rb, line 125 def root Utils.root end
Operate relative to project root directory, or use system’s location.
# File lib/qed/settings.rb, line 118 def rootless? @rootless end
Temporary directory. If ‘#rootless?` return true then this will be a system’s temporary directory (e.g. ‘/tmp/qed/foo/20111117242323/`). Otherwise, it will local to the project’s root int ‘tmp/qed/`.
# File lib/qed/settings.rb, line 139 def temporary_directory @temporary_directory ||= ( if rootless? Utils.system_tmpdir else File.join(root_directory, 'tmp', 'qed') end #FileUtils.mkdir_p(dir) unless File.directory?(dir) ) end