public void ResolveAll(PackageList packageList) { var packages = packageList.GetInfos(); foreach (var package in packages) { SetLicenseUrlOnPackage(package); } }
private static void HandleFile(string file, PackageList packages) { if (Parser.SupportsFile(file)) { var result = Parser.ProcessFile(file); if (result.Any()) { packages.Add(result); } } }
private static void FindAllPackages(PackageList packages) { var traveler = new DirectoryTraveler(); Console.WriteLine("Reading packages..."); traveler.Begin(RootPath, file => HandleFile(file, packages)); packages.IgnorePackages(PackagesToIgnore); var licenseResolver = new LicenseResolver(); Console.WriteLine("Fetching package information..."); licenseResolver.ResolveAll(packages); }
public static void Main(string[] args) { Console.WriteLine(LicenatorHeaderLine); HandleAndEchoArguments(args); var packages = new PackageList(); FindAllPackages(packages); GenerateOutputFile(packages); Console.WriteLine("Done!"); }
private void WriteFailures(PackageList packages) { var failedPackages = packages.GetFailedPackages(); if (failedPackages.Any()) { Lines.Add("[!] Fetching package metadata failed for the following packages. [!]"); foreach (var p in failedPackages) { Lines.Add("[!]" + IndentWhitespaces + p.Name + " (" + p.Version + ")"); WriteUsedIn(p.UsedIn); Lines.Add(""); } } }
public void Generate(PackageList packages, string rootPath, string outputFile) { Lines = new List <string>(); WriteHeader(rootPath); var summary = packages.GetSummary(); foreach (var p in summary) { WriteSummary(p); } WriteFailures(packages); File.WriteAllLines(outputFile, Lines); Lines = null; }
private static void GenerateOutputFile(PackageList packages) { Generator.Generate(packages, RootPath, OutputFile); }