git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adeodato Simó" <dato@net.com.org.es>
To: Scott Chacon <schacon@gmail.com>
Cc: git@vger.kernel.org, "Miklos Vajna" <vmiklos@frugalware.org>,
	"Adeodato Simó" <dato@net.com.org.es>
Subject: [PATCH] get_authors.sh, author.rb: use -s option of git shortlog.
Date: Mon,  5 Jan 2009 23:52:26 +0100	[thread overview]
Message-ID: <1231195946-20967-1-git-send-email-dato@net.com.org.es> (raw)
In-Reply-To: <20090105185737.GV21154@genesis.frugalware.org>

Suggested by Miklos Vajna <vmiklos@frugalware.org>.
---
 app/models/author.rb  |   26 ++++++++++++--------------
 script/get_authors.sh |    2 +-
 2 files changed, 13 insertions(+), 15 deletions(-)

> I suppose fixing up the ruby part after this is not that hard, sadly I
> don't speak Ruby myself, so I have no idea where and what to touch. ;-)

Done.

Btw, I don't think authors.txt should be in the repo at all, since it's
automatically generated, but it's your choice. :-)

diff --git a/app/models/author.rb b/app/models/author.rb
index 8fafc15..6bf069a 100644
--- a/app/models/author.rb
+++ b/app/models/author.rb
@@ -1,22 +1,20 @@
 class Author
-	
-	def self.all
-		authors =  File.join(RAILS_ROOT, 'config/authors.txt')
+  def self.all
+    authors = File.join(RAILS_ROOT, 'config/authors.txt')
     if File.exists?(authors)
       authors = File.readlines(authors)
       @authors = {:main => [], :contrib => []}
       authors.each do |author|
-        data = author.split(' ')
-        number = data.pop.gsub('(', '').gsub(')', '').chomp
-        name = data.join(' ')
-        if(number.to_i > 50)
-          @authors[:main] << [name, number.to_i]
-        else
-          @authors[:contrib] << [name, number.to_i]
+        if author =~ /(\d+)\s+(.+)/
+          name, number = $2, $1.to_i
+          if number > 50
+            @authors[:main] << [name, number]
+          else
+            @authors[:contrib] << [name, number]
+          end
         end
       end
+      @authors
     end
-		@authors
-	end
-	
-end
\ No newline at end of file
+  end
+end
diff --git a/script/get_authors.sh b/script/get_authors.sh
index 9aa8c6b..028a354 100755
--- a/script/get_authors.sh
+++ b/script/get_authors.sh
@@ -1,3 +1,3 @@
 export GIT_DIR=/Users/schacon/projects/git/.git
 cd /Users/schacon/projects/git
-git log --pretty=short --no-merges | git shortlog -n | grep -v -e '^ ' | grep ':' > ../gitscm/config/authors.txt
+git shortlog --no-merges -sn > ../gitscm/config/authors.txt
-- 
1.6.1.62.g677ca

  parent reply	other threads:[~2009-01-05 22:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d411cc4a0812151007n1be9ce95h92c8c11592ea5f9d@mail.gmail.com>
2008-12-16 11:41 ` git-scm.com transition Petr Baudis
     [not found]   ` <d411cc4a0901011040h4ab97aag20de54a6e138a4ec@mail.gmail.com>
2009-01-05 16:40     ` [ANNOUNCE] Git homepage change Petr Baudis
2009-01-05 18:57       ` Miklos Vajna
2009-01-05 19:03         ` Miklos Vajna
2009-01-05 22:52         ` Adeodato Simó [this message]
2009-01-05 23:54           ` [PATCH] get_authors.sh, author.rb: use -s option of git shortlog Miklos Vajna
2009-01-05 19:40       ` [ANNOUNCE] Git homepage change Mike Hommey
2009-01-05 21:27         ` David Bryson
2009-01-06  1:49           ` Scott Chacon
2009-01-06  2:17             ` Baz
2009-01-06  2:25               ` Baz
2009-01-06  2:43             ` Miklos Vajna
2009-01-06  4:24             ` Boyd Lynn Gerber
2009-01-06  8:54               ` Miklos Vajna
2009-01-06 16:12                 ` Boyd Lynn Gerber
2009-01-06 20:40                   ` Miklos Vajna
2009-01-06  9:07             ` Adeodato Simó
2009-01-05 20:16       ` Felipe Oliveira Carvalho
2009-01-05 20:33         ` Scott Chacon
2009-01-05 20:51           ` Boyd Lynn Gerber
2009-01-05 20:27       ` Ted Pavlic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1231195946-20967-1-git-send-email-dato@net.com.org.es \
    --to=dato@net.com.org.es \
    --cc=git@vger.kernel.org \
    --cc=schacon@gmail.com \
    --cc=vmiklos@frugalware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).