public
Description: Gitorious aims to provide a great way of doing distributed opensource code collaboration.
Homepage: http://gitorious.org/projects/gitorious
Clone URL: git://github.com/dysinger/gitorious.git
Render README for repositories

Signed-off-by: David A. Cuadrado <krawek@gmail.com>
David A. Cuadrado (author)
Mon Apr 28 21:34:49 -0700 2008
commit  edf16c0466ef89bdcc54f4c7ea69910b1fb49c9a
tree    fcb5eea844ee6e6cf755f0c5bc4d07ca0c94a118
parent  bdaaa5b9a0088212b933bc99b7edb30bef3aaf44
...
224
225
226
 
 
 
 
 
 
 
 
 
 
 
227
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
0
@@ -224,4 +224,15 @@ module ApplicationHelper
0
   def sidebar_content?
0
     !@content_for_sidebar.blank?
0
   end
0
+
0
+ def render_readme(repository)
0
+ possibilities = []
0
+ repository.git.git.ls_tree({:name_only => true}, "master").each do |line|
0
+ possibilities << line[0, line.length-1] if line =~ /README.*/
0
+ end
0
+
0
+ return "" if possibilities.empty?
0
+ text = repository.git.git.show({}, "master:#{possibilities.first}")
0
+ markdown(text) rescue text.gsub("\n", "<br/>")
0
+ end
0
 end
...
6
7
8
9
 
 
 
10
11
12
...
6
7
8
 
9
10
11
12
13
14
0
@@ -6,7 +6,9 @@
0
 <% render_if_ready(@repository) do -%>
0
 
0
   <%= render :partial => "infobox" -%>
0
-
0
+
0
+ <%= render_readme(@repository) %>
0
+
0
   <h2>Activities</h2>
0
   <%= render :partial => "events/events", :locals => { :events => @events } -%>
0
 <% end -%>

Comments

    No one has commented yet.