Sha256: 98171bd7959ad6649e3f5e2a163f1bbe3fdb55cd23e0513432bfef5f9b0d85be

Contents?: true

Size: 576 Bytes

Versions: 5

Compression:

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

5 entries across 5 versions & 1 rubygems

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