Class: Jstdutil::Cli
- Inherits:
-
Object
- Object
- Jstdutil::Cli
- Defined in:
- lib/jstdutil/cli.rb
Overview
Jstdutil::Cli
is a tiny wrapper to the JsTestDriver jar, simply allowing you to avoid the clunkiness of `java -jar FILE [ARGS]`
The wrapper also formats output with JsRedGreen
, yielding beautiful test reports.
In addition to the JsTestDriver arguments you can specify the path to the jar file by –jar. This kinda defeats the purpose, though, so a better solution is to set the environment variable $JSTESTDRIVER_HOME to where the jar file lives (see JsTestDriver.jar
).
Class Method Summary collapse
Class Method Details
.run(args = []) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jstdutil/cli.rb', line 17 def self.run(args = []) args = args.join(" ") jar = (args.match(/--jar\s+([^\s]+)/) || [])[1] || Jstdutil.jar format_type = args.match(/--html/) ? Jstdutil::ColorfulHtml : Jstdutil::RedGreen report = Jstdutil.run("#{args.gsub(/(--jar\s+[^\s]+|--html)/, '')}", jar) Jstdutil::Formatter.format(report, format_type) end |