[PATCH] get_authors.sh, author.rb: use -s option of git shortlog.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Suggested by Miklos Vajna <vmiklos@xxxxxxxxxxxxxx>.
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux