コード例 #1
0
        public ModuleDefaults Parse([CanBeNull] Dictionary <object, object> defaultsContents)
        {
            if (defaultsContents == null)
            {
                return(null);
            }

            var installSection   = defaultsContents.FindValue("install");
            var artifactsSection = defaultsContents.FindValue("artifacts");

            try
            {
                var installData  = installSectionParser.Parse(installSection, artifactsSection);
                var hooksData    = hooksSectionParser.Parse(defaultsContents.FindValue("hooks"));
                var settingsData = settingsSectionParser.Parse(defaultsContents.FindValue("settings"));
                var buildData    = buildSectionParser.ParseDefaults(defaultsContents.FindValue("build"));
                var depsSection  = depsSectionParser.Parse(defaultsContents.FindValue("deps"));

                return(new ModuleDefaults
                {
                    BuildSection = buildData,
                    DepsSection = depsSection,
                    InstallSection = installData,
                    SettingsSection = settingsData,
                    HooksSection = hooksData
                });
            }
            catch (BadYamlException ex)
            {
                throw new BadYamlException("default." + ex.SectionName, ex.Message);
            }
        }
コード例 #2
0
        public ConfigSection Parse(string title, Dictionary <object, object> data, ModuleDefaults yamlDefaults)
        {
            var configSectionTitle = configSectionTitleParser.Parse(title);

            var installSection   = data?.FindValue("install");
            var artifactsSection = data?.FindValue("artifacts");
            var installData      = installSectionParser.Parse(installSection, artifactsSection, yamlDefaults?.InstallSection?.CurrentConfigurationInstallFiles);

            var depsData    = data?.FindValue("deps");
            var depsSection = depsSectionParser.Parse(depsData, yamlDefaults);

            var buildSection = data?.FindValue("build");
            var buildData    = buildSectionParser.ParseConfiguration(buildSection, yamlDefaults?.BuildSection);

            return(new ConfigSection()
            {
                Title = configSectionTitle,
                DepsSection = depsSection,
                InstallSection = installData,
                BuildSection = buildData
            });
        }