Method: RC::Configuration#import
- Defined in:
- lib/rc/configuration.rb
#import(glob, opts = {}) ⇒ Object
Import other runtime configuration files.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/rc/configuration.rb', line 117 def import(glob, opts={}) paths = [] glob = glob + '**/*' if glob.end_with?('/') if from = opts[:from] paths = Find.path(glob, :from=>from) else if glob.start_with?('/') if root = lookup_root glob = File.join(root, glob) else raise "no project root for #{glob}" unless root end end paths = Dir.glob(glob) end paths = paths.select{ |path| File.file?(path) } paths = paths[0..0] if opts[:first] load_files(*paths) paths.empty? ? nil : paths end |