Sha256: 4e885edb9465398006494218d1eac2076c4c278b3397265e2f3d930cd58c3280

Contents?: true

Size: 494 Bytes

Versions: 5

Compression:

Stored size: 494 Bytes

Contents

# frozen_string_literal: true

module Licensee
  module Matchers
    class Spdx < Licensee::Matchers::Package
      # While we could parse the LICENSE.spdx file, prefer
      # a lenient regex for speed and security. Moar parsing moar problems.
      LICENSE_REGEX = /PackageLicenseDeclared:\s*([a-z\-0-9\. +()]+)\s*/i.freeze

      private

      def license_property
        match = @file.content.match LICENSE_REGEX
        match[1].downcase if match && match[1]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
licensee-9.14.0 lib/licensee/matchers/spdx.rb
licensee-9.13.2 lib/licensee/matchers/spdx.rb
licensee-9.13.1 lib/licensee/matchers/spdx.rb
licensee-9.13.0 lib/licensee/matchers/spdx.rb
licensee-9.12.0 lib/licensee/matchers/spdx.rb