Sha256: 36f446df263f5d4630027ed6e825d642a98fc94d1ce57ec5c65afbb6b9de219d

Contents?: true

Size: 629 Bytes

Versions: 14

Compression:

Stored size: 629 Bytes

Contents

class LicenseFinder::License::MIT < LicenseFinder::License::Base
  self.license_url = "http://opensource.org/licenses/mit-license"
  self.alternative_names = ["Expat"]

  HEADER_REGEX = /The MIT Licen[sc]e/
  ONE_LINER_REGEX = /is released under the MIT licen[sc]e/
  URL_REGEX = %r{MIT Licen[sc]e.*http://(?:www.)?opensource.org/licenses/mit-license}

  def matches?
    super || matches_url? || matches_header?
  end

  private

  def matches_url?
    !!(text =~ URL_REGEX)
  end

  def matches_header?
    header = text.split("\n").first
    header && ((header.strip =~ HEADER_REGEX) || !!(text =~ ONE_LINER_REGEX))
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
license_finder-0.9.1-java lib/license_finder/license/mit.rb
license_finder-0.9.1 lib/license_finder/license/mit.rb
license_finder-0.9.0-java lib/license_finder/license/mit.rb
license_finder-0.9.0 lib/license_finder/license/mit.rb
license_finder-0.8.2-java lib/license_finder/license/mit.rb
license_finder-0.8.2 lib/license_finder/license/mit.rb
license_finder-0.8.1-java lib/license_finder/license/mit.rb
license_finder-0.8.1 lib/license_finder/license/mit.rb
license_finder-0.8.0-java lib/license_finder/license/mit.rb
license_finder-0.8.0 lib/license_finder/license/mit.rb
license_finder-0.7.3 lib/license_finder/license/mit.rb
license_finder-0.7.1 lib/license_finder/license/mit.rb
license_finder-0.7.0 lib/license_finder/license/mit.rb
license_finder-0.6.0 lib/license_finder/license/mit.rb