Sha256: d62d6e8cc4b2ce05433106535fa1fbb10e1be899a457f9ec9431ca5811fcf956
Contents?: true
Size: 990 Bytes
Versions: 8
Compression:
Stored size: 990 Bytes
Contents
module Licensee module ProjectFiles class ReadmeFile < Licensee::ProjectFiles::LicenseFile SCORES = { /\AREADME\z/i => 1.0, /\AREADME\.(md|markdown|mdown|txt)\z/i => 0.9 }.freeze CONTENT_REGEX = /^ (?:\#+\sLicen[sc]e # Start of hashes-based license header | Licen[sc]e\n[-=]+)$ # Start of underlined license header (.*?) # License content (?=^(?:\#+ # Next hashes-based header | [^\n]+\n[-=]+) # Next of underlined header | \z) # End of file /mix def self.name_score(filename) SCORES.each do |pattern, score| return score if pattern =~ filename end 0.0 end def self.license_content(content) match = CONTENT_REGEX.match(content) match[1].strip if match end end end end
Version data entries
8 entries across 8 versions & 1 rubygems