Sha256: 2e430c9d3d1a87358b94707a934c5aa69cb6770a410c07bd3b7aed9605fddb0c

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Licensee
  module Matchers
    class DistZilla < Licensee::Matchers::Package
      attr_reader :file

      LICENSE_REGEX = /^license\s*=\s*([a-z\-0-9._]+)/i.freeze

      private

      def license_property
        match = file.content.match LICENSE_REGEX
        spdx_name(match[1]).downcase if match && match[1]
      end

      def spdx_name(perl_name)
        perl_name.sub('_', '-')
                 .sub('_', '.')
                 .sub('Mozilla', 'MPL')
                 .sub(/^GPL-(\d)$/, 'GPL-\1.0')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
licensee-9.15.2 lib/licensee/matchers/dist_zilla.rb
licensee-9.15.1 lib/licensee/matchers/dist_zilla.rb
licensee-9.15.0 lib/licensee/matchers/dist_zilla.rb
licensee-9.14.1 lib/licensee/matchers/dist_zilla.rb