mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Add initial implementation for running SBT commands.
This commit is contained in:
parent
81db32e148
commit
163e418754
10 changed files with 185 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ import sys
|
|||
LANGUAGES = (
|
||||
'conda', 'coursier', 'dart', 'docker', 'docker_image', 'dotnet', 'fail',
|
||||
'golang', 'lua', 'node', 'perl', 'pygrep', 'python', 'r', 'ruby', 'rust',
|
||||
'script', 'swift', 'system',
|
||||
'sbt', 'script', 'swift', 'system',
|
||||
)
|
||||
FIELDS = (
|
||||
'ENVIRONMENT_DIR', 'get_default_version', 'health_check',
|
||||
|
|
|
|||
6
testing/resources/sbt_hooks_repo/.pre-commit-hooks.yaml
Normal file
6
testing/resources/sbt_hooks_repo/.pre-commit-hooks.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
- id: sbt-create-files
|
||||
name: touch
|
||||
entry: touch
|
||||
args: ["file1.txt", "\"file2 with space.txt\""]
|
||||
description: "creates files provided by `args` or `files`"
|
||||
language: sbt
|
||||
6
testing/resources/sbt_repo_with_touch_command/build.sbt
Normal file
6
testing/resources/sbt_repo_with_touch_command/build.sbt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import TouchCommand._
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
commands ++= Seq(touchCommand)
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import sbt.Command
|
||||
|
||||
import java.nio.file.{Files, Paths}
|
||||
|
||||
object TouchCommand {
|
||||
def touchCommand = Command.args("touch", "args") { (state, args) =>
|
||||
args.map(Paths.get(_).toAbsolutePath).foreach { path =>
|
||||
println(f"Creating file: $path")
|
||||
Files.createFile(path)
|
||||
}
|
||||
state
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,10 @@ skipif_cant_run_lua = pytest.mark.skipif(
|
|||
os.name == 'nt',
|
||||
reason="lua isn't installed or can't be found",
|
||||
)
|
||||
skipif_cant_run_sbt = pytest.mark.skipif(
|
||||
parse_shebang.find_executable('sbt') is None,
|
||||
reason="SBT isn't installed or can't be found",
|
||||
)
|
||||
skipif_cant_run_swift = pytest.mark.skipif(
|
||||
parse_shebang.find_executable('swift') is None,
|
||||
reason="swift isn't installed or can't be found",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue