71: def look_and_load(adhoc_path=nil)
72: cwd = Dir.pwd
73: cwd_path = File.join(cwd, '.rudy', 'config')
74:
75:
76:
77:
78:
79: core_config_paths = [cwd_path, Rudy::CONFIG_FILE]
80: core_config_paths.each do |path|
81: next unless path && File.exists?(path)
82: @paths << path
83: break
84: end
85:
86: if adhoc_path.nil?
87:
88: typelist = self.keys.collect { |g| "#{g}.rb" }.join(',')
89:
90:
91: @paths += Dir.glob(File.join(Rudy.sysinfo.home, '.rudy', '*.rb')) || []
92: @paths += Dir.glob(File.join(cwd, 'Rudyfile')) || []
93: @paths += Dir.glob(File.join(cwd, 'config', 'rudy', '*.rb')) || []
94: @paths += Dir.glob(File.join(cwd, '.rudy', '*.rb')) || []
95: @paths += Dir.glob(File.join(cwd, "{#{typelist}}")) || []
96: @paths += Dir.glob(File.join('/etc', 'rudy', '*.rb')) || []
97: @paths &&= @paths.uniq
98: else
99: @paths += [adhoc_path].flatten
100: end
101:
102: refresh
103: end