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
74
75
76
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 74
def asset_files
Dir[project_path.join('**/project.assets.json')]
end
|
#current_packages ⇒ Object
64
65
66
67
68
69
70
71
72
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 64
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
78
79
80
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 78
def package_management_command
'dotnet'
end
|
#possible_package_paths ⇒ Object
59
60
61
62
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 59
def possible_package_paths
paths = Dir[project_path.join('*.csproj')]
paths.map { |p| Pathname(p) }
end
|
#prepare_command ⇒ Object
82
83
84
|
# File 'lib/license_finder/package_managers/dotnet.rb', line 82
def prepare_command
"#{package_management_command} restore"
end
|