test/test_grammars.rb
# Given the path to a submodule, return its SPDX-compliant license key
Given the path to a submodule, return its SPDX-compliant license key
Given the path to a submodule return its SPDX - compliant license key
def submodule_license(submodule)
    project = Licensee::FSProject.new(submodule)
    return project.license.key if project.license
    if project.license_file
      path = File.expand_path project.license_file.path, submodule
      license = classify_license(path)
      return license if license
    end
    files = Dir[File.join(ROOT, submodule, "*")]
    if readme = files.find { |path| File.basename(path) =~ /\Areadme\b/i }
      classify_license(readme)
    end
  end
def submodule_license ( submodule ) project = Licensee :: FSProject . new ( submodule ) return project . license . key if project . license if project . license_file path = File . expand_path project . license_file . path , submodule license = classify_license ( path ) return license if license end files = Dir [ File . join ( ROOT , submodule , "*" ) ] if readme = files . find { | path | File . basename ( path ) =~ / \A readme \b /i } classify_license ( readme ) end end
Given the path to a submodule, return its SPDX-compliant license key
Given the path to a submodule return its SPDX - compliant license key
# Prefer Licensee to detect a submodule's license # We know a license file exists, but Licensee wasn't able to detect the license, # Let's try our own more permissive regex method # Neither Licensee nor our own regex was able to detect the license, let's check the readme
submodule
<not_specific>