Sha256: c864fe0577e8f25c5dbe82da48e69fefbc1f0f8d0a35de018fbb86994854458e
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
module Licensee module ProjectFiles class PackageManagerFile < Licensee::ProjectFiles::ProjectFile # Hash of Extension => [possible matchers] MATCHERS_EXTENSIONS = { '.gemspec' => [Matchers::Gemspec], '.json' => [Matchers::NpmBower], '.cabal' => [Matchers::Cabal] }.freeze # Hash of Filename => [possible matchers] FILENAMES_EXTENSIONS = { 'DESCRIPTION' => [Matchers::Cran], 'dist.ini' => [Matchers::DistZilla], 'LICENSE.spdx' => [Matchers::Spdx], 'Cargo.toml' => [Matchers::Cargo] }.freeze FILENAMES_SCORES = { 'package.json' => 1.0, 'LICENSE.spdx' => 1.0, 'Cargo.toml' => 1.0, 'DESCRIPTION' => 0.9, 'dist.ini' => 0.8, 'bower.json' => 0.75, 'elm-package.json' => 0.7 }.freeze def possible_matchers MATCHERS_EXTENSIONS[extension] || FILENAMES_EXTENSIONS[filename] || [] end def self.name_score(filename) return 1.0 if ['.gemspec', '.cabal'].include?(File.extname(filename)) FILENAMES_SCORES[filename] || 0.0 end private def extension @extension ||= File.extname(filename) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
licensee-9.11.0 | lib/licensee/project_files/package_manager_file.rb |
licensee-9.10.1 | lib/licensee/project_files/package_manager_file.rb |