Improve gradle tasks

This commit is contained in:
2021-02-27 00:19:30 +01:00
parent a13ca2d954
commit b200b3579a
28 changed files with 115 additions and 92 deletions

View File

@@ -87,4 +87,4 @@ class Function(
}
}
}
}
}

View File

@@ -32,4 +32,4 @@ class Migration(
class MigrationNotFound(cause: Throwable? = null) : Resource.ParseException("Migration not found in script", cause)
enum class Direction { UP, DOWN }
}
}

View File

@@ -30,4 +30,4 @@ class Parameter(val name: String, val type: String, direction: Direction? = Dire
interface ParametersInterface {
val parameters: List<Parameter>
}
}

View File

@@ -14,12 +14,12 @@ class Query(
"""-- *name ?: ?(?<name>[^ \n]+)"""
.toRegex(setOf(RegexOption.IGNORE_CASE, RegexOption.MULTILINE))
.find(script)?.let {
it.groups["name"]?.value?.trim()
}
it.groups["name"]?.value?.trim()
}
/** Try to get name from the filename */
private fun getNameFromFile(source: Path): String = source
.fileName.toString()
.substringAfterLast("/")
.substringBeforeLast(".sql")
}
}

View File

@@ -37,4 +37,4 @@ interface Resource {
interface ResourceCollection {
val parameters: List<Parameter>
}
}