def pattern_for(basename)
        extname = File.extname(basename)
        aliases = @reverse_aliases[extname]

        if aliases
          basename = File.basename(basename, extname)
          aliases  = [extname] + aliases
          aliases_pattern = aliases.map { |e| Regexp.escape(e) }.join("|")
          basename_re = Regexp.escape(basename) + "(?:#{aliases_pattern})"
        else
          basename_re = Regexp.escape(basename)
        end

        extension_pattern = extensions.map { |e| Regexp.escape(e) }.join("|")
        /^#{basename_re}(?:#{extension_pattern})*$/
      end
def pattern_for(basename)
        extname = File.extname(basename)
        aliases = @reverse_aliases[extname]

        if aliases
          basename = File.basename(basename, extname)
          aliases  = [extname] + aliases
          aliases_pattern = aliases.map { |e| Regexp.escape(e) }.join("|")
          basename_re = Regexp.escape(basename) + "(?:#{aliases_pattern})"
        else
          basename_re = Regexp.escape(basename)
        end

        extension_pattern = extensions.map { |e| Regexp.escape(e) }.join("|")
        /^#{basename_re}(?:#{extension_pattern})*$/
      end
Returns a `Regexp` that matches the allowed extensions.

     pattern_for("index.html") #=> /^index(.html|.htm)(.builder|.erb)*$/