Sha256: e7f6bd742ad5c5ec88ca5eeacc1b1bda4498d89debf3aa7f0143247715726d13
Contents?: true
Size: 695 Bytes
Versions: 4
Compression:
Stored size: 695 Bytes
Contents
module LicenseFinder class PossibleLicenseFile def initialize(install_path, file_path) @install_path = Pathname.new(install_path) @file_path = Pathname.new(file_path) end def file_path @file_path.relative_path_from(@install_path).to_s end def full_file_path Pathname.new(@file_path).realpath.to_s end def file_name @file_path.basename.to_s end def text @text ||= @file_path.send(@file_path.respond_to?(:binread) ? :binread : :read) end def license license = LicenseFinder::License.all.detect do |klass| klass.new(text).matches? end license.pretty_name if license end end end
Version data entries
4 entries across 4 versions & 1 rubygems