module Thor::Actions
def find_in_source_paths(file)
Receives a file or directory and search for it in the source paths.
def find_in_source_paths(file) relative_root = relative_to_original_destination_root(destination_root, false) source_paths.each do |source| source_file = File.expand_path(file, File.join(source, relative_root)) return source_file if File.exists?(source_file) end message = "Could not find #{file.inspect} in any of your source paths. " unless self.class.source_root message << "Please invoke #{self.class.name}.source_root(PATH) with the PATH containing your templates. " end if source_paths.empty? message << "Currently you have no source paths." else message << "Your current source paths are: \n#{source_paths.join("\n")}" end raise Error, message end