public NetFxSupportTableSource(LocalPackageCache packageCache)
 {
     this.packageCache = packageCache;
 }
Example #2
0
 public GeneralInfoTableSource(LocalPackageCache packageCache, HttpDataProvider dataProvider, LicenseResolver licenseResolver)
 {
     this.packageCache    = packageCache;
     this.dataProvider    = dataProvider;
     this.licenseResolver = licenseResolver;
 }
Example #3
0
        private static void Main(CommandLineArguments args)
        {
            var cache            = new LocalPackageCache(Path.GetFullPath(ConfigurationManager.AppSettings["NuGetPackagesPath"]));
            var httpDataProvider = new HttpDataProvider(new DirectoryInfo("HttpCache"));

            var attributeCleaner = new AttributeTextCleaner();
            var sources          = new IFeatureTableSource[] {
                new GeneralInfoTableSource(
                    cache,
                    httpDataProvider,
                    new LicenseResolver(httpDataProvider, new Uri(ConfigurationManager.AppSettings["LicensesJsonUrl"]))
                    ),
                new NetFxSupportTableSource(cache),
                new FeatureTestTableSource(new FeatureTestRunner(attributeCleaner), attributeCleaner, new ExceptionNormalizer())
            };
            var outputs = new IResultOutput[] {
                new HtmlOutput(new DirectoryInfo(ConfigurationManager.AppSettings["HtmlTemplatesPath"])),
                new JsonOutput()
            };

            var outputDirectory = new DirectoryInfo(args.OutputPath ?? ConfigurationManager.AppSettings["OutputPath"]);

            if (!outputDirectory.Exists)
            {
                outputDirectory.Create();
            }

            var assemblyPaths = GetAssemblyPaths();
            var results       = assemblyPaths.Select(path => {
                console.White.Text("Running " + Path.GetFileName(path) + ":");
                try {
                    var assembly = Assembly.LoadFrom(path);

                    var tables = sources.SelectMany(s => s.GetTables(assembly)).ToArray();
                    CalculateTotal(tables.Single(t => t.Key == MetadataKeys.GeneralInfoTable), tables);

                    var outputNamePrefix = assembly.GetName().Name.SubstringAfter(AssemblyNamePrefix);
                    var result           = new ResultForAssembly(assembly, tables, outputNamePrefix);

                    console.Green.Line(" OK");
                    return(result);
                }
                catch (Exception) {
                    console.Red.Line(" FAIL");
                    throw;
                }
            }).ToArray();

            console.NewLine();
            console.White.Line("Creating outputs:");
            foreach (var output in outputs)
            {
                output.Write(outputDirectory, results, args.WatchTemplates);
            }

            if (args.WatchTemplates)
            {
                console.NewLine()
                .White
                .Line("Auto-updating outputs if templates change.")
                .Line("Press [Enter] to stop.");
                Console.ReadLine();
            }

            foreach (var output in outputs)
            {
                output.Dispose();
            }

            Console.WriteLine();
            console.Green.Line("Completed.");
        }