[PATCH] Remove duplicate entries from gem_server's list of gems

S

Sean O'Halpin

Hi,

I finally got fed up with seeing n-thousand duplicate anchors at the
top of my gem_server's index page, so I rustled this up to winnow the
list:

--- PATCH ---

--- /ruby-1.8.2/bin/gem_server=092005-04-17 17:41:08.000000000 +0100
+++ gem_server=092005-09-27 21:27:19.840023000 +0100
@@ -24,14 +24,14 @@
<h1>Summary</h1>
<p>There are %gem_count% gems installed:</p>
<p>
-START:specs
+START:index
IFNOT:is_last
<a href=3D"#%name%">%name%</a>,
ENDIF:is_last
IF:is_last
<a href=3D"#%name%">%name%</a>.
ENDIF:is_last
-END:specs
+END:index
<h1>Gems</h1>

<dl>
@@ -415,12 +415,16 @@
# create page from template
template =3D TemplatePage.new(DOC_TEMPLATE)
res['content-type'] =3D 'text/html'
+
+ index =3D specs.map{|spec| spec["name"]}.uniq.sort{|a,b| a.downcase
<=3D> b.downcase}.map{|name| {"name" =3D> name}}
+
template.write_html_on(
res.body,
{
"gem_count" =3D> specs.size.to_s,
"specs" =3D> specs,
"total_file_count" =3D> total_file_count.to_s,
+ "index" =3D> index
}
)

--- END OF PATCH ---

Regards,

Sean

P.S. Is this the right place to send this kind of patch?
 
A

Austin Ziegler

Hi,

I finally got fed up with seeing n-thousand duplicate anchors at the
top of my gem_server's index page, so I rustled this up to winnow the
list: [...]
P.S. Is this the right place to send this kind of patch?

This mighit be better sent to rubygems-developers on RubyForge, or
submitted as a patch on the RubyForge tracker for RubyGems, at least
until RubyGems is integrated into core Ruby.

-austin
 
D

Dave Burt

Austin Ziegler:
This mighit be better sent to rubygems-developers on RubyForge, or
submitted as a patch on the RubyForge tracker for RubyGems, at least
until RubyGems is integrated into core Ruby.

But this is also a good place to post this kind of patch, as well as other
stuff. Thanks for sharing, please pass it to a Rubygems dev forum as well.

Cheers,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top