diff --git a/common/shared/src/main/scala/org/specs2/main/ArgumentsArgs.scala b/common/shared/src/main/scala/org/specs2/main/ArgumentsArgs.scala index 57912cb691..d9f51d757e 100644 --- a/common/shared/src/main/scala/org/specs2/main/ArgumentsArgs.scala +++ b/common/shared/src/main/scala/org/specs2/main/ArgumentsArgs.scala @@ -6,8 +6,8 @@ import text._ /** * Methods with default Property values to create Arguments instances - * - * There is an implicit conversion from (=> T) to Property[T] to allow the direct passing of parameters + * + * There is an implicit conversion from (=> T) to Property[T] to allow the direct passing of parameters */ trait ArgumentsArgs extends ArgumentsCreation with ArgProperties @@ -133,7 +133,7 @@ trait ArgumentsCreation { checkUrls: ArgProperty[Boolean] = ArgProperty[Boolean](), notoc: ArgProperty[Boolean] = ArgProperty[Boolean](), notifier: ArgProperty[String] = ArgProperty[String](), - exporter: ArgProperty[String] = ArgProperty[String]()) = new Arguments( + printer: ArgProperty[String] = ArgProperty[String]()) = new Arguments( report = Report(xonly.toOption.map(v => if (v) Report.xonlyFlags else Report.allFlags).orElse(showOnly.toOption), failtrace.toOption, color.toOption, @@ -145,7 +145,7 @@ trait ArgumentsCreation { checkUrls.toOption, notoc.toOption, notifier.toOption, - exporter.toOption)) + printer.toOption)) } diff --git a/common/shared/src/main/scala/org/specs2/main/CommandLine.scala b/common/shared/src/main/scala/org/specs2/main/CommandLine.scala index 3ef6ca49b3..08c252c00f 100644 --- a/common/shared/src/main/scala/org/specs2/main/CommandLine.scala +++ b/common/shared/src/main/scala/org/specs2/main/CommandLine.scala @@ -80,6 +80,35 @@ object CommandLine extends Extract { Report.allArguments ++ FilesRunnerArguments.allArguments + // other arguments which are not mentioned in Arguments + // this is a stop gap measure until a more modular solution is found + val extraArguments: Seq[ArgumentType] = List( + BooleanArgument("verbose"), + BooleanArgument("console"), + BooleanArgument("all"), + BooleanArgument("silent"), + BooleanArgument("pandoc"), + ValuedArgument("scalacheck.mintestsok"), + ValuedArgument("scalacheck.minsize"), + ValuedArgument("scalacheck.maxdiscardratio"), + ValuedArgument("scalacheck.maxsize"), + ValuedArgument("scalacheck.workers"), + ValuedArgument("scalacheck.seed"), + ValuedArgument("scalacheck.verbosity"), + ValuedArgument("sbt.tags"), + ValuedArgument("stats.outdir"), + ValuedArgument("junit.outdir"), + ValuedArgument("markdown.outdir"), + ValuedArgument("markdown.ext"), + ValuedArgument("html.outdir"), + ValuedArgument("html.template"), + ValuedArgument("html.variables"), + ValuedArgument("html.nostats"), + ValuedArgument("html.search"), + ValuedArgument("html.toc"), + ValuedArgument("html.toc.entrymaxsize"), + ValuedArgument("html.warn.missingref")) + val allArgumentNames = allArguments.map(_.name) def splitValues(arguments: String): Seq[String] = splitValues(arguments.split(" ")) diff --git a/common/shared/src/main/scala/org/specs2/main/Report.scala b/common/shared/src/main/scala/org/specs2/main/Report.scala index 8ddb19b09d..6d9eea4e03 100644 --- a/common/shared/src/main/scala/org/specs2/main/Report.scala +++ b/common/shared/src/main/scala/org/specs2/main/Report.scala @@ -19,7 +19,7 @@ case class Report( _checkUrls : Option[Boolean] = None, _notoc: Option[Boolean] = None, _notifier: Option[String] = None, - _exporter: Option[String] = None) extends ShowArgs { + _printer: Option[String] = None) extends ShowArgs { import Arguments._ @@ -36,7 +36,7 @@ case class Report( def notoc: Boolean = _notoc.getOrElse(false) def hasToc: Boolean = !notoc def notifier: String = _notifier.getOrElse("") - def exporter: String = _exporter.getOrElse("") + def printer: String = _printer.getOrElse("") def overrideWith(other: Report) = { new Report( @@ -51,7 +51,7 @@ case class Report( other._checkUrls .orElse(_checkUrls), other._notoc .orElse(_notoc), other._notifier .orElse(_notifier), - other._exporter .orElse(_exporter) + other._printer .orElse(_printer) ) } @@ -67,7 +67,7 @@ case class Report( "checkUrls" -> _checkUrls, "notoc" -> _notoc, "notifier" -> _notifier, - "exporter" -> _exporter).flatMap(showArg).mkString("Report(", ", ", ")") + "printer" -> _printer).flatMap(showArg).mkString("Report(", ", ", ")") } @@ -87,7 +87,7 @@ object Report extends Extract { _checkUrls = bool("checkUrls"), _notoc = bool("noToc"), _notifier = value("notifier"), - _exporter = value("exporter") + _printer = value("printer") ) } @@ -111,6 +111,6 @@ object Report extends Extract { BooleanArgument("checkUrls"), BooleanArgument("noToc"), ValuedArgument("notifier"), - ValuedArgument("exporter")) + ValuedArgument("printer")) } diff --git a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ArgumentsDsl.scala b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ArgumentsDsl.scala index 08e80d70e2..030a9b9305 100644 --- a/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ArgumentsDsl.scala +++ b/core/shared/src/main/scala/org/specs2/specification/dsl/mutable/ArgumentsDsl.scala @@ -133,7 +133,7 @@ trait ArgumentsCreation extends org.specs2.main.ArgumentsCreation with MutableAr checkUrls: ArgProperty[Boolean] = ArgProperty[Boolean](), notoc: ArgProperty[Boolean] = ArgProperty[Boolean](), notifier: ArgProperty[String] = ArgProperty[String](), - exporter: ArgProperty[String] = ArgProperty[String]()) = updateArguments(super.report( + printer: ArgProperty[String] = ArgProperty[String]()) = updateArguments(super.report( xonly, showOnly, failtrace, @@ -146,11 +146,8 @@ trait ArgumentsCreation extends org.specs2.main.ArgumentsCreation with MutableAr checkUrls, notoc, notifier, - exporter)) + printer)) } } - - - diff --git a/guide/src/test/scala/org/specs2/Website.scala b/guide/src/test/scala/org/specs2/Website.scala index 1f5a948939..6ea1960c61 100644 --- a/guide/src/test/scala/org/specs2/Website.scala +++ b/guide/src/test/scala/org/specs2/Website.scala @@ -19,7 +19,7 @@ class Website(env: Env) extends Specification with Specs2Variables with Specs2Ta """ implicit val ee = env.executionEnv - + val outputDir = "target" / "specs2-reports" / "site" val versionDirName = FileName.unsafe("SPECS2-"+VERSION) @@ -39,7 +39,7 @@ class Website(env: Env) extends Specification with Specs2Variables with Specs2Ta fs.writeFile(siteOutputDir | page.name, replacedVersion) >> { // copy the index page at the root of the site // it will then re-direct to a specific version - if (page.path.contains("index.html") && isOfficial(VERSION)) fs.writeFile(outputDir | page.name, replacedVersion) + if (page.path.contains("index.html")) fs.writeFile(outputDir | page.name, replacedVersion) else Operations.ok(()) } } yield () diff --git a/guide/src/test/scala/org/specs2/guide/ArgumentsReference.scala b/guide/src/test/scala/org/specs2/guide/ArgumentsReference.scala index 84db604419..c84bfbad0f 100644 --- a/guide/src/test/scala/org/specs2/guide/ArgumentsReference.scala +++ b/guide/src/test/scala/org/specs2/guide/ArgumentsReference.scala @@ -1,7 +1,7 @@ package org.specs2 package guide -import org.specs2.runner.SpecificationsFinder._ +import org.specs2.main.FilesRunnerArguments._ object ArgumentsReference extends UserGuidePage { def is = "Arguments reference".title ^ s2""" @@ -35,27 +35,28 @@ This reference guide for arguments is divided in several sections: - "reporting" arguments to control the output - API for arguments when used in the code +**Tip!** the `verbose` argument will report any unknown argument passed on the command line + ## Paths Name | Default value | Description ----------------------- | ------------------------------ | ------------------------------------------------------------------------------------------- `stats.outdir` | `target/specs2-reports/stats` | output directory for run statistics (see $Selection) `junit.outdir` | `target/test-reports/` | output directory for JUnit XML files (see $JUnitXmlOutput) + `html.outdir` | `target/specs2-reports` | output directory for html files (see $HtmlOutput) `filesrunner.basepath` | `$specificationsBasePath` | source directory for test files (see $RunInShell) `filesrunner.path` | `$specificationsPath` | glob pattern for the file paths (see $RunInShell) `filesrunner.pattern` | `$specificationsPattern` | regular expression capturing the specification class/object name (see $RunInShell) `filesrunner.verbose` | `false` | logs of searched paths and potential classes to instantiate (see $RunInShell) - `html.outdir` | `target/specs2-reports` | output directory for html files (see $HtmlOutput) - ## Selection Name | Default value | Description ----------------------- | ------------------------------ | ------------------------------------------------------------------------------------------- `ex` | `.*` | regular expression specifying the examples to execute. Use `ex .*brilliant.*` on the command line + `was` | `""` | select only some previously executed examples based on their status `include` | `""` | execute only the fragments tagged with any of the comma-separated list of tags: `t1,t2,...` `exclude` | `""` | do not execute the fragments tagged with any of the comma-separated list of tags: `t1,t2,...` - `was` | `""` | select only some previously executed examples based on their status `selector` | `""` | implementation of the `org.specs2.specification.process.Selector` trait ## Execution @@ -109,7 +110,6 @@ See the $ConsoleOutput page for a more precise description of these options. `showtimes` | `false` | show execution times for examples `notifier` | `""` | name of a class extending the `org.specs2.reporter.Notifier` trait `printer` | `""` | name of a class extending the `org.specs2.reporter.Printer` trait - `reporter` | `""` | name of a class extending the `org.specs2.reporter.Reporter` trait For ${"the HTML output" ~/ HtmlOutput} the following options can be used: @@ -166,4 +166,3 @@ There are also a few shortcuts: """ } - diff --git a/guide/src/test/scala/org/specs2/guide/RunInShell.scala b/guide/src/test/scala/org/specs2/guide/RunInShell.scala index bc0f6aa7a7..58bf0ab334 100644 --- a/guide/src/test/scala/org/specs2/guide/RunInShell.scala +++ b/guide/src/test/scala/org/specs2/guide/RunInShell.scala @@ -1,7 +1,7 @@ package org.specs2 package guide -import org.specs2.runner.SpecificationsFinder._ +import org.specs2.main.FilesRunnerArguments._ object RunInShell extends UserGuidePage { def is = s2""" It is not necessary to use a build tool to run a specification. You just need to have the right dependencies on the classpath and use one of the $specs2 runners. @@ -10,12 +10,12 @@ It is not necessary to use a build tool to run a specification. You just need to When you use a build tool you generally only need to specify the main dependencies then any transitive dependency will be fetched for you. However, when you run specifications from the shell you need to specify the classpath yourself. The best way to do this is to use `sbt` to -make sure your specification compiles with all the required dependencies, then export the classpath with: +make sure your specification compiles with all the required dependencies, then export the project classpath: ``` sbt> export Runtime / fullClasspath sbt> export Test / fullClasspath ``` -With the output of both commands you can define an environment variable, $$SPECS2_PATH +With the output of both commands you can define an environment variable, `$$SPECS2_PATH` ``` sh> export $$SPECS2_PATH=: ``` @@ -33,7 +33,7 @@ And the other arguments are used to drive the execution of the specification as #### Run several specifications -The `specs2.files` object will select and execute all Specifications found in the test source directory according to the following parameters: +The `specs2.files` object will select and execute all specifications found in the test source directory according to the following parameters: Name | Default value | Description ----------- | --------------- | ------------------------- diff --git a/guide/src/test/scala/org/specs2/guide/Specs2Variables.scala b/guide/src/test/scala/org/specs2/guide/Specs2Variables.scala index f53a57a2d4..fab1d5fa9c 100644 --- a/guide/src/test/scala/org/specs2/guide/Specs2Variables.scala +++ b/guide/src/test/scala/org/specs2/guide/Specs2Variables.scala @@ -1,6 +1,8 @@ package org.specs2 package guide +import buildinfo._ + object Specs2Variables extends Specs2Variables trait Specs2Variables { @@ -14,17 +16,11 @@ trait Specs2Variables { lazy val specs2Variables: Map[String, String] = Map( - "VERSION" -> VERSION, - "SITE_DIR" -> SITE_DIR, - "PROJECT_DIR" -> PROJECT_DIR, - "GUIDE_DIR" -> GUIDE_DIR, - "EXAMPLES_DIR" -> EXAMPLES_DIR, - "API_DIR" -> API_DIR + "VERSION" -> VERSION, + "SITE_DIR" -> SITE_DIR, + "PROJECT_DIR" -> PROJECT_DIR, + "GUIDE_DIR" -> GUIDE_DIR, + "EXAMPLES_DIR" -> EXAMPLES_DIR, + "API_DIR" -> API_DIR ) - - - /** @return true if the version is not timestamped */ - def isOfficial(version: String): Boolean = - !version.contains(BuildInfo.timestamp) } - diff --git a/scalacheck/shared/src/main/scala/org/specs2/scalacheck/Parameters.scala b/scalacheck/shared/src/main/scala/org/specs2/scalacheck/Parameters.scala index 2a53e65c7d..5463ca8ef3 100644 --- a/scalacheck/shared/src/main/scala/org/specs2/scalacheck/Parameters.scala +++ b/scalacheck/shared/src/main/scala/org/specs2/scalacheck/Parameters.scala @@ -47,7 +47,7 @@ case class Parameters(minTestsOk: Int = Test.Parameters.default. maxSize = commandLine.intOr ("scalacheck.maxsize", maxSize), workers = commandLine.intOr ("scalacheck.workers", workers), seed = commandLine.value ("scalacheck.seed").flatMap(Parameters.makeSeed).orElse(seed) - ).setVerbosity(commandLine.intOr ("scalacheck.verbosity", prettyParams.verbosity)) + ).setVerbosity(commandLine.intOr ("scalacheck.verbosity", prettyParams.verbosity)) if (commandLine.boolOr("scalacheck.verbose", false)) updated.verbose else updated diff --git a/version.sbt b/version.sbt index cfeb9e691f..b299d56a5c 100644 --- a/version.sbt +++ b/version.sbt @@ -1,2 +1,2 @@ -ThisBuild / version := "4.11.0" +ThisBuild / version := "4.11.1" ThisBuild / versionScheme := Some("semver-spec")