Sha256: d5d7475557986747093ce44fd8d5753dbd662b1992cb02ca8707626cb5904dea

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 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

      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')
                 .sub(/^AGPL-(\d)$/, 'AGPL-\1.0')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
licensee-9.18.0 lib/licensee/matchers/dist_zilla.rb
licensee-9.17.1 lib/licensee/matchers/dist_zilla.rb
licensee-9.17.0 lib/licensee/matchers/dist_zilla.rb
licensee-9.16.1 lib/licensee/matchers/dist_zilla.rb