Prefer Licence over Copying
This commit is contained in:
parent
c5d97c7e37
commit
9ec32b1cac
1 changed files with 7 additions and 3 deletions
|
@ -210,9 +210,13 @@ class Repository
|
|||
|
||||
def license
|
||||
cache.fetch(:license) do
|
||||
tree(:head).blobs.find_all do |file|
|
||||
file.name =~ /\A(copying|license)/i
|
||||
end.last # Prefer `LICENSE` as filename over `COPYING`
|
||||
licenses = tree(:head).blobs.find_all do |file|
|
||||
file.name =~ /\A(copying|license)/i
|
||||
end
|
||||
|
||||
# If `licence`, `copying` and `copying.lesser` are found, return in the
|
||||
# following order: licence, copying, copying.lesser
|
||||
licenses.find { |l| l =~ /\Alicence/i } || licenses.sort.first
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue