lib/licensee/project.rb in licensee-4.2.1 vs lib/licensee/project.rb in licensee-4.2.2
- old
+ new
@@ -1,16 +1,17 @@
class Licensee
class Project
attr_reader :repository
# Array of file names to look for potential license files, in order
+ # Filenames should be lower case as candidates are downcased before comparison
LICENSE_FILENAMES = %w[
- LICENSE
- LICENSE.txt
- LICENSE.md
- UNLICENSE
- COPYING
+ license
+ license.txt
+ license.md
+ unlicense
+ copying
]
# Initializes a new project
#
# path_or_repo path to git repo or Rugged::Repository instance
@@ -29,10 +30,10 @@
# Returns a Licensee::LicenseFile instance
def license_file
return @license_file if defined? @license_file
commit = @revision ? @repository.lookup(@revision) : @repository.last_commit
- license_blob = commit.tree.each_blob { |blob| break blob if LICENSE_FILENAMES.include? blob[:name] }
+ license_blob = commit.tree.each_blob { |blob| break blob if LICENSE_FILENAMES.include? blob[:name].downcase }
@license_file = if license_blob
LicenseFile.new(@repository.lookup(license_blob[:oid]))
end
end