diff --git a/build.sbt b/build.sbt index c22c87d..e1e4e1c 100644 --- a/build.sbt +++ b/build.sbt @@ -10,13 +10,13 @@ licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")) -scalaVersion := "2.12.8" +scalaVersion := "2.13.4" libraryDependencies ++= Seq( "org.apache.jena" % "jena-arq" % "3.6.0", "org.apache.jena" % "jena-cmds" % "3.6.0", - "com.github.scopt" %% "scopt" % "3.7.0", - "org.scala-lang.modules" %% "scala-xml" % "1.0.6" + "com.github.scopt" %% "scopt" % "4.0.0", + "org.scala-lang.modules" %% "scala-xml" % "1.3.0" ) mainClass in assembly := Some("uk.org.floop.sparqlTestRunner.Run") diff --git a/project/build.properties b/project/build.properties index 7609b47..97a7ea7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.2.8 \ No newline at end of file +sbt.version = 1.4.7 \ No newline at end of file diff --git a/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala b/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala index eafe78f..1fb6b6f 100644 --- a/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala +++ b/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala @@ -50,35 +50,56 @@ val packageVersion: String = getClass.getPackage.getImplementationVersion val parser: OptionParser[Config] = new scopt.OptionParser[Config]("sparql-testrunner") { head("sparql-test-runner", packageVersion) - opt[File]('t', "testdir") optional() valueName "" action { (x, c) => - c.copy(dir = x) - } text "location of SPARQL queries to run, defaults to tests/sparql" - opt[File]('r', "report") optional() valueName "" action { (x, c) => - c.copy(report = x) - } text "file to output XML test report, defaults to reports/TESTS-sparql-test-runner.xml" - opt[Unit]('i', "ignorefail") optional() action { (_, c) => - c.copy(ignoreFail = true) - } text "exit with success even if there are reported failures" - opt[URI]('s', name= "service") optional() valueName "" action { (x, c) => - c.copy(endpoint = Some(x)) - } text "SPARQL endpoint to run the queries against" - opt[String]('a', "auth") optional() valueName "" action { (x, c) => - c.copy(auth = Some(Left(x))) - } text "basic authentication username:password" - opt[String]('k', "token") optional() valueName "" action { (x, c) => - c.copy(auth = Some(Right(x))) - } text "oAuth token" - opt[Map[String,String]]('p', name="param") optional() valueName "l=\"somelabel\"@en,n=" action { - (x, c) => c.copy(params = x) - } text "variables to replace in query" - opt[String]('f', name="from") optional() unbounded() valueName "" action { - (x, c) => c.copy(froms = c.froms :+ x) - } text "graphs to query" - opt[Int]('l', name="limit") optional() valueName "" action { - (x, c) => c.copy(limit = Some(x)) - } text "limit the number of results (examples of failure) to return" - arg[File]("...") unbounded() optional() action { (x, c) => - c.copy(data = c.data :+ x) } text "data to run the queries against" + opt[File]('t', "testdir") + .optional() + .valueName("") + .action((x, c) => c.copy(dir = x)) + .text("location of SPARQL queries to run, defaults to tests/sparql") + opt[File]('r', "report") + .optional() + .valueName("") + .action((x, c) => c.copy(report = x)) + .text("file to output XML test report, defaults to reports/TESTS-sparql-test-runner.xml") + opt[Unit]('i', "ignorefail") + .optional() + .action((_, c) => c.copy(ignoreFail = true)) + .text("exit with success even if there are reported failures") + opt[URI]('s', name= "service") + .optional() + .valueName("") + .action((x, c) => c.copy(endpoint = Some(x))) + .text("SPARQL endpoint to run the queries against") + opt[String]('a', "auth") + .optional() + .valueName("") + .action((x, c) => c.copy(auth = Some(Left(x)))) + .text("basic authentication username:password") + opt[String]('k', "token") + .optional() + .valueName("") + .action((x, c) => c.copy(auth = Some(Right(x)))) + .text("oAuth token") + opt[Map[String,String]]('p', name="param") + .optional() + .valueName("l=\"somelabel\"@en,n=") + .action((x, c) => c.copy(params = x)) + .text("variables to replace in query") + opt[String]('f', name="from") + .optional() + .unbounded() + .valueName("") + .action((x, c) => c.copy(froms = c.froms :+ x)) + .text("graphs to query") + opt[Int]('l', name="limit") + .optional() + .valueName("") + .action((x, c) => c.copy(limit = Some(x))) + .text("limit the number of results (examples of failure) to return") + arg[File]("...") + .unbounded() + .optional() + .action((x, c) => c.copy(data = c.data :+ x)) + .text("data to run the queries against") checkConfig( c => if (!c.dir.exists || !c.dir.isDirectory) { failure("Tests directory (" + c.dir.toString + ") doesn't exist or isn't a directory.") diff --git a/src/main/scala/uk/org/floop/updateInPlace/Run.scala b/src/main/scala/uk/org/floop/updateInPlace/Run.scala index 8adc57c..a973b05 100644 --- a/src/main/scala/uk/org/floop/updateInPlace/Run.scala +++ b/src/main/scala/uk/org/floop/updateInPlace/Run.scala @@ -34,11 +34,15 @@ val packageVersion: String = getClass.getPackage.getImplementationVersion() val parser = new scopt.OptionParser[Config]("sparql-update-in-place") { head("sparql-update-in-place", packageVersion) - opt[File]('q', "querydir") optional() valueName "" action { (x, c) => - c.copy(dir = x) - } text "location of SPARQL update queries to run, defaults to sparql" - arg[File]("") required() action { (x, c) => - c.copy(data = x) } text "data to update in-place" + opt[File]('q', "querydir") + .optional() + .valueName("") + .action((x, c) => c.copy(dir = x)) + .text("location of SPARQL update queries to run, defaults to sparql") + arg[File]("") + .required() + .action((x, c) => c.copy(data = x)) + .text("data to update in-place") } parser.parse(args, Config()) match { case None =>