Ejemplo n.º 1
0
        public static ImageInfo Create(
            Image model, string fullRepoModelName, string repoName, ManifestFilter manifestFilter, VariableHelper variableHelper, string baseDirectory)
        {
            ImageInfo imageInfo = new ImageInfo();

            imageInfo.Model = model;

            imageInfo.ProductVersion = variableHelper.SubstituteValues(model.ProductVersion);

            if (model.SharedTags == null)
            {
                imageInfo.SharedTags = Enumerable.Empty <TagInfo>();
            }
            else
            {
                imageInfo.SharedTags = model.SharedTags
                                       .Select(kvp => TagInfo.Create(kvp.Key, kvp.Value, repoName, variableHelper))
                                       .ToArray();
            }

            imageInfo.AllPlatforms = model.Platforms
                                     .Select(platform => PlatformInfo.Create(platform, fullRepoModelName, repoName, variableHelper, baseDirectory))
                                     .ToArray();

            IEnumerable <Platform> filteredPlatformModels = manifestFilter.GetPlatforms(model);

            imageInfo.FilteredPlatforms = imageInfo.AllPlatforms
                                          .Where(platform => filteredPlatformModels.Contains(platform.Model));

            return(imageInfo);
        }
Ejemplo n.º 2
0
        public static ImageInfo Create(Image model, string repoName, ManifestFilter manifestFilter, VariableHelper variableHelper)
        {
            ImageInfo imageInfo = new ImageInfo();

            imageInfo.Model = model;

            if (model.SharedTags == null)
            {
                imageInfo.SharedTags = Enumerable.Empty <TagInfo>();
            }
            else
            {
                imageInfo.SharedTags = model.SharedTags
                                       .Select(kvp => TagInfo.Create(kvp.Key, kvp.Value, repoName, variableHelper))
                                       .ToArray();
            }

            imageInfo.Platforms = manifestFilter.GetPlatforms(model)
                                  .Select(platform => PlatformInfo.Create(platform, repoName, variableHelper))
                                  .ToArray();

            IEnumerable <Platform> activePlatformModels = manifestFilter.GetActivePlatforms(model);

            imageInfo.ActivePlatforms = imageInfo.Platforms
                                        .Where(platform => activePlatformModels.Contains(platform.Model));

            return(imageInfo);
        }
Ejemplo n.º 3
0
        public static ImageInfo Create(Image model, Manifest manifest, string repoName, ManifestFilter manifestFilter)
        {
            ImageInfo imageInfo = new ImageInfo();

            imageInfo.Model = model;

            if (model.SharedTags == null)
            {
                imageInfo.SharedTags = Enumerable.Empty <TagInfo>();
            }
            else
            {
                imageInfo.SharedTags = model.SharedTags
                                       .Select(kvp => TagInfo.Create(kvp.Key, kvp.Value, manifest, repoName))
                                       .ToArray();
            }

            imageInfo.Platforms = manifestFilter.GetPlatforms(model)
                                  .Select(platform => PlatformInfo.Create(platform, manifest, repoName))
                                  .ToArray();

            Platform activePlatformModel = manifestFilter.GetActivePlatform(model);

            if (activePlatformModel != null)
            {
                imageInfo.ActivePlatform = imageInfo.Platforms
                                           .First(platform => platform.Model == activePlatformModel);
                imageInfo.ActiveFullyQualifiedTags = imageInfo.SharedTags
                                                     .Select(tag => tag.FullyQualifiedName)
                                                     .Concat(imageInfo.ActivePlatform.Tags.Select(tag => tag.FullyQualifiedName));
            }

            return(imageInfo);
        }