Add initial implementation for running SBT commands.

This commit is contained in:
Stewart Hutchins 2022-11-23 18:13:43 +00:00
parent 81db32e148
commit 163e418754
10 changed files with 185 additions and 1 deletions

View file

@ -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',

View 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

View file

@ -0,0 +1,6 @@
import TouchCommand._
lazy val root = (project in file("."))
.settings(
commands ++= Seq(touchCommand)
)

View file

@ -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
}
}

View file

@ -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",