Пример #1
0
 public PlatformDetectorResult Detect(RepositoryContext context)
 {
     return(_detector?.Detect(new DetectorContext
     {
         SourceRepo = new Detector.LocalSourceRepo(context.SourceRepo?.RootPath),
     }));
 }
Пример #2
0
        private bool IsDetectedPlatform(
            DetectorContext ctx,
            IPlatformDetector platformDetector,
            out Tuple <PlatformName, string> platformResult)
        {
            platformResult = null;
            PlatformName           platformName    = platformDetector.DetectorPlatformName;
            PlatformDetectorResult detectionResult = platformDetector.Detect(ctx);

            if (detectionResult == null)
            {
                _logger.LogInformation($"Platform '{platformName}' was not detected in the given repository.");
                return(false);
            }

            if (string.IsNullOrEmpty(detectionResult.PlatformVersion))
            {
                _logger.LogInformation($"Platform '{platformName}' was detected in the given repository, but " +
                                       $"no versions were detected.");
                platformResult = Tuple.Create(platformName, "Not Detected");
                return(true);
            }

            string detectedVersion = detectionResult.PlatformVersion;

            platformResult = Tuple.Create(platformName, detectedVersion);
            _logger.LogInformation($"platform '{platformName}' was detected with version '{detectedVersion}'.");
            return(true);
        }
Пример #3
0
        private bool IsDetectedPlatform(
            DetectorContext context,
            IPlatformDetector platformDetector,
            out PlatformDetectorResult platformResult)
        {
            platformResult = platformDetector.Detect(context);

            if (platformResult == null)
            {
                _logger.LogInformation("Could not detect any platform in the given repository.");
                return(false);
            }

            if (string.IsNullOrEmpty(platformResult.PlatformVersion))
            {
                _logger.LogInformation(
                    $"Platform '{platformResult.Platform}' was detected in the given repository, " +
                    $"but no versions were detected.");
            }

            _logger.LogInformation(
                $"Platform '{platformResult.Platform}' was detected with version '{platformResult.PlatformVersion}'.");
            return(true);
        }
Пример #4
0
 public PlatformDetectorResult Detect(RepositoryContext context)
 {
     return(_detector?.Detect(context));
 }