Sha256: e4b280a6af2d19e2556102b453fff845d478a849c70ac1587f2308bf9e79b610

Contents?: true

Size: 613 Bytes

Versions: 6

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module Licensee
  module Matchers
    class NpmBower < Licensee::Matchers::Package
      # While we could parse the package.json or bower.json file, prefer
      # a lenient regex for speed and security. Moar parsing moar problems.
      LICENSE_REGEX = /
        \s*["']license["']\s*:\s*['"]([a-z\-0-9.+ ()]+)['"],?\s*
      /ix.freeze

      private

      def license_property
        match = @file.content.match LICENSE_REGEX
        return unless match && match[1]
        return 'no-license' if match[1] == 'UNLICENSED'

        match[1].downcase
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
licensee-9.16.0 lib/licensee/matchers/npm_bower.rb
licensee-9.15.3 lib/licensee/matchers/npm_bower.rb
licensee-9.15.2 lib/licensee/matchers/npm_bower.rb
licensee-9.15.1 lib/licensee/matchers/npm_bower.rb
licensee-9.15.0 lib/licensee/matchers/npm_bower.rb
licensee-9.14.1 lib/licensee/matchers/npm_bower.rb