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 if source_paths.empty? raise Error, "You don't have any source path defined for class #{self.class.name}. To fix this, " << "you can define a source_root in your class." else raise Error, "Could not find #{file.inspect} in source paths." end end