-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for platforms, lifecycles, and toolchains YAML files #142
Milestone
Comments
With upcoming 2.0 release YAML will be the primary format going forward. JSON support for backwards compatibility. |
https://github.com/samrocketman/jervis/blob/main/vars/hasGlobalResource.groovy was added for this purpose. e.g. detect YAML or fall back to JSON. |
8da9edc |
Convert platforms JSON to YAML import net.gleske.jervis.tools.YamlOperator
String prefix = 'resources'
Map platforms = YamlOperator.loadYamlFrom(new File("${prefix}/platforms.json"))
println "Writing to '${prefix}/platforms.yaml'"
new File("${prefix}/platforms.yaml").withWriter { w ->
w << YamlOperator.writeObjToYaml(platforms)
}
platforms.supported_platforms.collect { platform, oses ->
[
['lifecycles', 'toolchains'],
oses.collect { os, v ->
[
"${os}-stable",
"${os}-unstable"
]
}.flatten()
].combinations()*.join('-')
}.flatten().sort().unique().each { fileName ->
if(!(new File("${prefix}/${fileName}.json").exists())) {
// skip; unstable version doesn't likely exist
return
}
println "Writing to '${prefix}/${fileName}.yaml'"
new File("${prefix}/${fileName}.yaml").withWriter { w ->
Map json = YamlOperator.loadYamlFrom(new File("${prefix}/${fileName}.json"))
json.clone().each { top, v1 ->
if(top == 'toolchains') {
return
}
v1.clone().each { child, v2 ->
if(v2 in List) {
json[top][child] = v2.join('\n')
}
}
}
w << YamlOperator.writeObjToYaml(json)
}
}
null |
Closed by 8c93204 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JSON has been great... but YAML is more flexible and user-friendly than JSON for admins to add support.
JSON will always be supported for compatibility. However, it would be nice to have YAML as an option.
Example JSON files.
And the same purpose files but in YAML.
This is becomes more important as support for documentation generation gets implemented in the future. Refer to issue #139.
The text was updated successfully, but these errors were encountered: