From 0d2e92a07e707d50b857683fd8e25ae96fdf6cd3 Mon Sep 17 00:00:00 2001 From: Hao Wang Date: Wed, 20 Sep 2023 23:50:53 +0800 Subject: [PATCH] more config file extensions (#98) * more config file extensions * add changelog --------- Co-authored-by: Aviram Hassan --- changelog.d/+support-yaml-and-toml.added.md | 1 + .../main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt | 2 +- .../main/kotlin/com/metalbear/mirrord/MirrordDropDown.kt | 6 +++++- src/main/resources/META-INF/mirrord-maven.xml | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 changelog.d/+support-yaml-and-toml.added.md create mode 100644 src/main/resources/META-INF/mirrord-maven.xml diff --git a/changelog.d/+support-yaml-and-toml.added.md b/changelog.d/+support-yaml-and-toml.added.md new file mode 100644 index 00000000..f616fe70 --- /dev/null +++ b/changelog.d/+support-yaml-and-toml.added.md @@ -0,0 +1 @@ +Add support for TOML and YAML mirrord configuration files \ No newline at end of file diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt index 1412b2b3..cf563049 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt @@ -120,7 +120,7 @@ class MirrordConfigAPI(private val service: MirrordProjectService) { fun getDefaultConfig(): VirtualFile? { return getMirrordDir() ?.children - ?.filter { it.name.endsWith("mirrord.json") } + ?.filter { it.name.endsWith("mirrord.json") || it.name.endsWith("mirrord.yaml") || it.name.endsWith("mirrord.toml") } ?.minByOrNull { it.name } } diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordDropDown.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordDropDown.kt index 9fb184cd..a7fd0959 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordDropDown.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordDropDown.kt @@ -188,7 +188,11 @@ class MirrordConfigIndex : ScalarIndexExtension() { override fun getInputFilter(): FileBasedIndex.InputFilter { return FileBasedIndex.InputFilter { - it.isInLocalFileSystem && !it.isDirectory && it.path.endsWith("mirrord.json") + it.isInLocalFileSystem && !it.isDirectory && ( + it.path.endsWith("mirrord.json") || + it.path.endsWith("mirrord.yaml") || + it.path.endsWith("mirrord.toml") + ) } } diff --git a/src/main/resources/META-INF/mirrord-maven.xml b/src/main/resources/META-INF/mirrord-maven.xml new file mode 100644 index 00000000..3494c7f9 --- /dev/null +++ b/src/main/resources/META-INF/mirrord-maven.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file