FalconSourceFalconCommandPaths

module Paths

A helper for resolving wildcard configuration paths.

Definitions

def resolved_paths(&block)

Resolve a set of @paths that may contain wildcards, into a sorted, unique array.

Signature

returns Array(String)

Implementation

def resolved_paths(&block)
	if @paths
		@paths.collect do |path|
			Dir.glob(path)
		end.flatten.sort.uniq.each(&block)
	end
end

def configuration

Build a configuration based on the resolved paths.

Implementation

def configuration
	configuration = Configuration.new
	
	self.resolved_paths do |path|
		path = File.expand_path(path)
		
		configuration.load_file(path)
	end
	
	return configuration
end