Example #1
0
 public InstallBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport)
 {
     _project = project;
     _packageBuilder = packageBuilder;
     _buildReport = buildReport;
     IsApplicationPackage = project.Commands.Any();
 }
Example #2
0
        public Reports CreateReports(bool verbose, bool quiet)
        {
            var useConsoleColor = _runtimeEnv.OperatingSystem == "Windows";

            IReport output = new Report(AnsiConsole.GetOutput(useConsoleColor));
            var reports = new Reports()
            {
                Information = output,
                Verbose = verbose ? output : new NullReport(),
                Error = new Report(AnsiConsole.GetError(useConsoleColor)),
            };

            // If "--verbose" and "--quiet" are specified together, "--verbose" wins
            reports.Quiet = quiet ? reports.Verbose : output;

            return reports;
        }
Example #3
0
        public static IPackageFeed CreatePackageFolderFromPath(string path, bool ignoreFailedSources, Reports reports)
        {
            Func<string, bool> containsNupkg = dir => Directory.Exists(dir) &&
                Directory.EnumerateFiles(dir, "*" + Constants.PackageExtension)
                .Where(x => !Path.GetFileNameWithoutExtension(x).EndsWith(".symbols"))
                .Any();

            if (Directory.Exists(path) &&
                (containsNupkg(path) || Directory.EnumerateDirectories(path).Any(x => containsNupkg(x))))
            {
                return new NuGetPackageFolder(path, reports);
            }
            else
            {
                return new PackageFolder(path, ignoreFailedSources, reports);
            }
        }
Example #4
0
        public static IPackageFeed CreatePackageFeed(PackageSource source, bool noCache, bool ignoreFailedSources,
            Reports reports)
        {
            if (new Uri(source.Source).IsFile)
            {
                return PackageFolderFactory.CreatePackageFolderFromPath(source.Source, ignoreFailedSources, reports);
            }
            else
            {
                var httpSource = new HttpSource(
                    source.Source,
                    source.UserName,
                    source.Password,
                    reports);

                Uri packageBaseAddress;
                if (NuGetv3Feed.DetectNuGetV3(httpSource, noCache, out packageBaseAddress))
                {
                    if (packageBaseAddress == null)
                    {
                        reports.Information.WriteLine(
                            $"Ignoring NuGet v3 feed {source.Source.Yellow().Bold()}, which doesn't provide PackageBaseAddress resource.");
                        return null;
                    }

                    httpSource = new HttpSource(
                        packageBaseAddress.AbsoluteUri,
                        source.UserName,
                        source.Password,
                        reports);

                    return new NuGetv3Feed(
                        httpSource,
                        noCache,
                        reports,
                        ignoreFailedSources);
                }

                return new NuGetv2Feed(
                    httpSource,
                    noCache,
                    reports,
                    ignoreFailedSources);
            }
        }
Example #5
0
 public static IPackageFeed CreatePackageFeed(PackageSource source, bool noCache, bool ignoreFailedSources,
     Reports reports)
 {
     if (new Uri(source.Source).IsFile)
     {
         return PackageFolderFactory.CreatePackageFolderFromPath(source.Source, ignoreFailedSources, reports);
     }
     else
     {
         return new NuGetv2Feed(
             source.Source,
             source.UserName,
             source.Password,
             noCache,
             reports,
             ignoreFailedSources);
     }
 }
Example #6
0
        public static IPackageFeed CreatePackageFeed(PackageSource source, bool noCache, bool ignoreFailedSources,
            Reports reports)
        {
            if (new Uri(source.Source).IsFile)
            {
                return PackageFolderFactory.CreatePackageFolderFromPath(source.Source, ignoreFailedSources, reports);
            }
            else
            {
                // TODO: temporarily ignore NuGet v3 feeds
                if (source.Source.EndsWith(".json"))
                {
                    return null;
                }

                return new NuGetv2Feed(
                    source.Source,
                    source.UserName,
                    source.Password,
                    noCache,
                    reports,
                    ignoreFailedSources);
            }
        }
Example #7
0
        private Reports CreateReports(bool verbose, bool quiet)
        {
            IReport output = new Report(AnsiConsole.Output);
            var reports = new Reports()
            {
                Information = output,
                Verbose = verbose ? output : new NullReport(),
                Error = new Report(AnsiConsole.Output),
            };

            // If "--verbose" and "--quiet" are specified together, "--verbose" wins
            reports.Quiet = quiet ? reports.Verbose : output;

            return reports;
        }
Example #8
0
 public UninstallCommand(IAppCommandsRepository commandsRepo, Reports reports)
 {
     _commandsRepo = commandsRepo;
     _reports      = reports;
 }
Example #9
0
 public UninstallCommand(IApplicationEnvironment applicationEnvironment, IAppCommandsRepository commandsRepo, Reports reports)
 {
     _environment = applicationEnvironment;
     _commandsRepo = commandsRepo;
     _reports = reports;
 }
Example #10
0
 public UninstallCommand(IApplicationEnvironment applicationEnvironment, IAppCommandsRepository commandsRepo, Reports reports)
 {
     _environment  = applicationEnvironment;
     _commandsRepo = commandsRepo;
     _reports      = reports;
 }
Example #11
0
 public ListFeedsCommand(Reports reports, string targetDirectory)
 {
     Reports         = reports;
     TargetDirectory = targetDirectory;
 }
Example #12
0
        public static IPackageFeed CreatePackageFolderFromPath(string path, bool ignoreFailedSources, Reports reports)
        {
            Func <string, bool> containsNupkg = dir => Directory.Exists(dir) &&
                                                Directory.EnumerateFiles(dir, "*" + Constants.PackageExtension)
                                                .Where(x => !Path.GetFileNameWithoutExtension(x).EndsWith(".symbols"))
                                                .Any();

            if (Directory.Exists(path) &&
                (containsNupkg(path) || Directory.EnumerateDirectories(path).Any(x => containsNupkg(x))))
            {
                return(new NuGetPackageFolder(path, reports));
            }
            else
            {
                return(new KpmPackageFolder(path, ignoreFailedSources, reports));
            }
        }
Example #13
0
 public InstallBuilder(Runtime.Project project, IPackageBuilder packageBuilder, Reports buildReport)
 {
     _project             = project;
     _packageBuilder      = packageBuilder;
     _buildReport         = buildReport;
     IsApplicationPackage = project.Commands.Any();
 }
Example #14
0
 public UninstallCommand(IAppCommandsRepository commandsRepo, Reports reports)
 {
     _commandsRepo = commandsRepo;
     _reports = reports;
 }
Example #15
0
 public ListFeedsCommand(Reports reports, string targetDirectory)
 {
     Reports = reports;
     TargetDirectory = targetDirectory;
 }