diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/check-license.rb (renamed from tools/hooks/pre-commit.rb) | 9 | ||||
-rwxr-xr-x | tools/gen_authors.rb | 18 | ||||
-rwxr-xr-x | tools/gen_authors.sh | 20 |
3 files changed, 22 insertions, 25 deletions
diff --git a/tools/hooks/pre-commit.rb b/tools/check-license.rb index 825a851..8eeb6bb 100755 --- a/tools/hooks/pre-commit.rb +++ b/tools/check-license.rb @@ -1,19 +1,18 @@ #!/usr/bin/env ruby result = 0 -files = Dir.glob("src/**/*.h") + Dir.glob("src/**/*.cpp") + Dir.glob("lib/**/*.h") + Dir.glob("lib/**/*.cpp") - -puts "pre-commit: #{`pwd`}" +files = Dir.glob("src/**/*.h") + Dir.glob("src/**/*.cpp") \ + + Dir.glob("lib/**/*.h") + Dir.glob("lib/**/*.cpp") \ + + Dir.glob("plugins/**/*.h") + Dir.glob("plugins/**/*.cpp") puts 'Checking licenses...' files.each { |name| File.open(name) { |file| if file.grep(/SPDX-License-Identifier/).empty? then puts "Missing or incorrect license header: #{name}" - result = 1 + result += 1 end } } -puts "pre-commit exit(#{result})" exit result diff --git a/tools/gen_authors.rb b/tools/gen_authors.rb new file mode 100755 index 0000000..96f2679 --- /dev/null +++ b/tools/gen_authors.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +# Generate list of authors from repository commits + +log = `hg log --template='{author}'%` + +authors = Hash.new(0) +log.split('%').each do |i| + authors[i] += 1 +end + +# sort list by descending number of commits +authors = authors.sort_by {|k, v| v}.reverse + +# print out authors +authors.each do |k, v| + #print " #{k} (#{v})\n" + print " #{k}\n" +end diff --git a/tools/gen_authors.sh b/tools/gen_authors.sh deleted file mode 100755 index ed24634..0000000 --- a/tools/gen_authors.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# -# Generate a list of everyone who has contributed to the project merging those -# who commited under two names or email addresses. -# Original: https://github.com/Arora/arora/blob/master/generateAuthors -# -# To can pass an arg (which goes to git log) -# Example: to see everyone who contributed between tag 0.6 and now -# ./generateAuthors 0.6..HEAD -# -# Currently this is sorted based on # of commits, sorting contributions is not -# a simple topic as pointed out in this article http://lwn.net/Articles/222773/ -# - -# List of aliases -# Aqua, Aqua-sama <aqua@iserlohn-fortress.net>, Xian Nox, xiannox <xian.nox@gmail.com> - -hg log --template='{author}\n' \ - | sort | uniq -c | sort -n -r \ - | sed -e 's/^ *[0-9]* / /g' |