Class: LicenseFinder::Dotnet
Defined Under Namespace
Classes: AssetFile, PackageMetadata
Instance Method Summary
collapse
#active?, #command_exists?, #current_packages_with_relations, #detected_package_path, id, #initialize, #installed?, #prepare, #project_root?, takes_priority_over
Instance Method Details
#asset_files ⇒ Object
71
72
73
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 71
def asset_files
Dir[project_path.join('**/project.assets.json')]
end
|
#current_packages ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 60
def current_packages
package_metadatas = asset_files
.flat_map { |path| AssetFile.new(path).dependencies }
.uniq { |d| [d.name, d.version] }
package_metadatas.map do |d|
path = Dir.glob("#{Dir.home}/.nuget/packages/#{d.name.downcase}/#{d.version}").first
NugetPackage.new(d.name, d.version, spec_licenses: d.read_license_urls, install_path: path)
end
end
|
#package_management_command ⇒ Object
75
76
77
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 75
def package_management_command
'dotnet'
end
|
#possible_package_paths ⇒ Object
55
56
57
58
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 55
def possible_package_paths
paths = Dir[project_path.join('*.csproj')]
paths.map { |p| Pathname(p) }
end
|
#prepare_command ⇒ Object
79
80
81
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 79
def prepare_command
"#{package_management_command} restore"
end
|