[Xfce4-commits] <moka:master> Somewhat improve the cgit script.

Nick Schermer noreply at xfce.org
Sun Nov 20 20:26:01 CET 2011


Updating branch refs/heads/master
         to a84fb0f27cc24d61767a8719fe35df6b7fb77e63 (commit)
       from d339ae8c4dd4228c0dab7e171e2b872fd44822f2 (commit)

commit a84fb0f27cc24d61767a8719fe35df6b7fb77e63
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Nov 20 20:02:16 2011 +0100

    Somewhat improve the cgit script.

 lib/helpers/cgit.rb |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/helpers/cgit.rb b/lib/helpers/cgit.rb
index 52c5ea3..e57daaf 100644
--- a/lib/helpers/cgit.rb
+++ b/lib/helpers/cgit.rb
@@ -9,7 +9,7 @@ module Moka
     def run(repofile, gitpath, prepend_files = nil)
 
       conf = "# This file is generated by Moka at\n" +
-             "# " + Time.now.to_s + "\n\n"
+             "# " + Time.now.to_s + "\n"
 
       public = Moka::Models::Group.get('public')
 
@@ -23,7 +23,7 @@ module Moka
             next unless File.directory?(path)
 
             project = Moka::Models::Project.get(name)
-            next if project == nil
+            next if project.nil?
 
             # only show public projects
             next unless project.groups.include?(public)
@@ -31,12 +31,15 @@ module Moka
             sect << "repo.url=#{classification.name}/#{project.name}\n"
             sect << "repo.name=#{project.name}\n"
             sect << "repo.path=#{path}\n"
-            sect << "repo.desc=#{project.shortdesc}\n"
-            sect << "repo.owner=#{project.owner}\n\n"
+            sect << "repo.desc=#{project.shortdesc}\n" unless
+              project.shortdesc.nil? or project.shortdesc.empty?
+            sect << "repo.owner=#{project.owner}\n" unless
+              project.owner.nil? or project.owner.empty?
+            sect << "\n"
         end
 
         if not sect.empty?
-          conf << "section=#{classification.name}\n\n"
+          conf << "\nsection=#{classification.name}\n\n"
           conf << sect
         end
       end


More information about the Xfce4-commits mailing list