Class: Licensee::Project::PackageInfo

Inherits:
File
  • Object
show all
Defined in:
lib/licensee/project_files/package_info.rb

Constant Summary

Constants inherited from File

File::ENCODING, File::ENCODING_OPTIONS

Instance Attribute Summary

Attributes inherited from File

#content, #filename

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from File

#confidence, #initialize, #license, #matcher

Constructor Details

This class inherits a constructor from Licensee::Project::File

Class Method Details

.name_score(filename) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/licensee/project_files/package_info.rb', line 21

def self.name_score(filename)
  return 1.0  if ::File.extname(filename) == '.gemspec'
  return 1.0  if filename == 'package.json'
  return 0.8  if filename == 'dist.ini'
  return 0.9  if filename == 'DESCRIPTION'
  return 0.75 if filename == 'bower.json'
  0.0
end

Instance Method Details

#possible_matchersObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/licensee/project_files/package_info.rb', line 4

def possible_matchers
  case ::File.extname(filename)
  when '.gemspec'
    [Matchers::Gemspec]
  when '.json'
    [Matchers::NpmBower]
  else
    if filename == 'DESCRIPTION' && content.start_with?('Package:')
      [Matchers::Cran]
    elsif filename == 'dist.ini'
      [Matchers::DistZilla]
    else
      []
    end
  end
end