Sha256: f1549adc82c90346f310c97044394a3db323edb882c9cd8a45195586d0a22baf
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
module LicenseFinder class PossibleLicenseFiles CANDIDATE_FILE_NAMES = %w(LICENSE License Licence COPYING README Readme ReadMe) CANDIDATE_PATH_WILDCARD = "*{#{CANDIDATE_FILE_NAMES.join(',')}}*" def self.find(install_path) new(install_path).find end def initialize(install_path) @install_path = install_path ? Pathname(install_path) : nil end def find paths_of_candidate_files.map do |path| PossibleLicenseFile.new(path) end end private attr_reader :install_path def paths_of_candidate_files candidate_files_and_dirs.map do |path| path.directory? ? path.children : path end.flatten.uniq end def candidate_files_and_dirs return [] if install_path.nil? Pathname.glob(install_path.join('**', CANDIDATE_PATH_WILDCARD)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
license_finder-2.0.0.rc2 | lib/license_finder/possible_license_files.rb |