Пример #1
0
        public static ManifestInfo Create(Manifest model, ManifestFilter manifestFilter, IOptionsInfo options)
        {
            ManifestInfo manifestInfo = new ManifestInfo();

            manifestInfo.Model          = model;
            manifestInfo.ManifestFilter = manifestFilter;
            manifestInfo.Registry       = options.RegistryOverride ?? model.Registry;
            manifestInfo.VariableHelper = new VariableHelper(model, options, manifestInfo.GetTagById, manifestInfo.GetRepoById);
            manifestInfo.AllRepos       = manifestInfo.Model.Repos
                                          .Select(repo => RepoInfo.Create(repo, manifestInfo.Registry, manifestFilter, options, manifestInfo.VariableHelper))
                                          .ToArray();

            IEnumerable <string> repoNames = manifestInfo.AllRepos.Select(repo => repo.Name).ToArray();

            foreach (PlatformInfo platform in manifestInfo.AllRepos.SelectMany(repo => repo.AllImages).SelectMany(image => image.AllPlatforms))
            {
                platform.Initialize(repoNames);
            }

            IEnumerable <Repo> filteredRepoModels = manifestFilter.GetRepos(manifestInfo.Model);

            manifestInfo.FilteredRepos = manifestInfo.AllRepos
                                         .Where(repo => filteredRepoModels.Contains(repo.Model))
                                         .ToArray();

            return(manifestInfo);
        }
Пример #2
0
        private static ManifestInfo Create(string manifestPath, ManifestFilter manifestFilter, IManifestOptionsInfo options)
        {
            string   manifestDirectory = PathHelper.GetNormalizedDirectory(manifestPath);
            Manifest model             = LoadModel(manifestPath, manifestDirectory);

            model.Validate(manifestDirectory);

            ManifestInfo manifestInfo = new ManifestInfo
            {
                Model     = model,
                Registry  = options.RegistryOverride ?? model.Registry,
                Directory = manifestDirectory
            };

            manifestInfo.VariableHelper = new VariableHelper(model, options, manifestInfo.GetRepoById);
            manifestInfo.AllRepos       = manifestInfo.Model.Repos
                                          .Select(repo => RepoInfo.Create(
                                                      repo,
                                                      manifestInfo.Registry,
                                                      model.Registry,
                                                      manifestFilter,
                                                      options,
                                                      manifestInfo.VariableHelper,
                                                      manifestInfo.Directory))
                                          .ToArray();

            if (model.Readme != null)
            {
                manifestInfo.ReadmePath = Path.Combine(manifestInfo.Directory, model.Readme.Path);
                if (model.Readme.TemplatePath != null)
                {
                    manifestInfo.ReadmeTemplatePath = Path.Combine(manifestInfo.Directory, model.Readme.TemplatePath);
                }
            }

            IEnumerable <string> repoNames = manifestInfo.AllRepos.Select(repo => repo.QualifiedName).ToArray();

            foreach (PlatformInfo platform in manifestInfo.GetAllPlatforms())
            {
                platform.Initialize(repoNames, manifestInfo.Registry);
            }

            IEnumerable <Repo> filteredRepoModels = manifestFilter.GetRepos(manifestInfo.Model);

            manifestInfo.FilteredRepos = manifestInfo.AllRepos
                                         .Where(repo => filteredRepoModels.Contains(repo.Model))
                                         .ToArray();

            return(manifestInfo);
        }
Пример #3
0
        public static ManifestInfo Load(IManifestOptionsInfo options)
        {
            Logger.WriteHeading("READING MANIFEST");

            ManifestInfo manifest = ManifestInfo.Create(
                options.Manifest,
                options.GetManifestFilter(),
                options);

            if (options.IsVerbose)
            {
                Logger.WriteMessage(JsonConvert.SerializeObject(manifest, Formatting.Indented));
            }

            return(manifest);
        }
Пример #4
0
        public static ManifestInfo Create(Manifest model, ManifestFilter manifestFilter, IOptionsInfo options)
        {
            ManifestInfo manifestInfo = new ManifestInfo();

            manifestInfo.Model          = model;
            manifestInfo.ManifestFilter = manifestFilter;
            manifestInfo.VariableHelper = new VariableHelper(model, options, manifestInfo.GetTagById);
            manifestInfo.Repos          = manifestFilter.GetRepos(manifestInfo.Model)
                                          .Select(repo => RepoInfo.Create(repo, manifestFilter, options, manifestInfo.VariableHelper))
                                          .ToArray();
            manifestInfo.ActiveImages = manifestInfo.Repos
                                        .SelectMany(repo => repo.Images)
                                        .Where(image => image.ActivePlatforms.Any())
                                        .ToArray();

            return(manifestInfo);
        }
Пример #5
0
        private static ManifestInfo Create(string manifestPath, ManifestFilter manifestFilter, IManifestOptionsInfo options)
        {
            string   manifestJson      = File.ReadAllText(manifestPath);
            Manifest model             = JsonConvert.DeserializeObject <Manifest>(manifestJson);
            string   manifestDirectory = PathHelper.GetNormalizedDirectory(manifestPath);

            model.Validate(manifestDirectory);

            ManifestInfo manifestInfo = new ManifestInfo
            {
                Model     = model,
                Registry  = options.RegistryOverride ?? model.Registry,
                Directory = manifestDirectory
            };

            manifestInfo.VariableHelper = new VariableHelper(model, options, manifestInfo.GetRepoById);
            manifestInfo.AllRepos       = manifestInfo.Model.Repos
                                          .Select(repo => RepoInfo.Create(
                                                      repo,
                                                      manifestInfo.Registry,
                                                      model.Registry,
                                                      manifestFilter,
                                                      options,
                                                      manifestInfo.VariableHelper,
                                                      manifestInfo.Directory))
                                          .ToArray();

            IEnumerable <string> repoNames = manifestInfo.AllRepos.Select(repo => repo.QualifiedName).ToArray();

            foreach (PlatformInfo platform in manifestInfo.GetAllPlatforms())
            {
                platform.Initialize(repoNames, manifestInfo.Registry);
            }

            IEnumerable <Repo> filteredRepoModels = manifestFilter.GetRepos(manifestInfo.Model);

            manifestInfo.FilteredRepos = manifestInfo.AllRepos
                                         .Where(repo => filteredRepoModels.Contains(repo.Model))
                                         .ToArray();

            return(manifestInfo);
        }
Пример #6
0
        public static ManifestInfo Create(Manifest model, ManifestFilter manifestFilter, string repoOwner)
        {
            ManifestInfo manifestInfo = new ManifestInfo();

            manifestInfo.Model = model;
            manifestInfo.Repos = manifestFilter.GetRepos(manifestInfo.Model)
                                 .Select(repo => RepoInfo.Create(repo, manifestInfo.Model, manifestFilter, repoOwner))
                                 .ToArray();
            manifestInfo.Images = manifestInfo.Repos
                                  .SelectMany(repo => repo.Images)
                                  .ToArray();
            manifestInfo.ActiveImages = manifestInfo.Images
                                        .Where(image => image.ActivePlatform != null)
                                        .ToArray();
            manifestInfo.ActivePlatformFullyQualifiedTags = manifestInfo.ActiveImages
                                                            .SelectMany(image => image.ActivePlatform.Tags)
                                                            .Select(tag => tag.FullyQualifiedName)
                                                            .ToArray();
            manifestInfo.TestCommands = manifestFilter.GetTestCommands(manifestInfo.Model);

            return(manifestInfo);
        }