Sha256: 54ac416869d33a63482aac9d204c9d4137ba0af74cdaf5e3c34cef734d50a858

Contents?: true

Size: 967 Bytes

Versions: 14

Compression:

Stored size: 967 Bytes

Contents

require "jstdutil"

module Jstdutil
  #
  # <tt>Jstdutil::Cli</tt> is a tiny wrapper to the JsTestDriver
  # jar, simply allowing you to avoid the clunkiness of <tt>`java -jar FILE [ARGS]`</tt>
  #
  # The wrapper also formats output with <tt>JsRedGreen</tt>, 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 <tt>JsTestDriver.jar</tt>).
  #
  class Cli
    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
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
jstdutil-0.3.13 lib/jstdutil/cli.rb
jstdutil-0.3.12 lib/jstdutil/cli.rb
jstdutil-0.3.11 lib/jstdutil/cli.rb
jstdutil-0.3.10 lib/jstdutil/cli.rb
jstdutil-0.3.9 lib/jstdutil/cli.rb
jstdutil-0.3.8 lib/jstdutil/cli.rb
jstdutil-0.3.7 lib/jstdutil/cli.rb
jstdutil-0.3.6 lib/jstdutil/cli.rb
jstdutil-0.3.5 lib/jstdutil/cli.rb
jstdutil-0.3.4 lib/jstdutil/cli.rb
jstdutil-0.3.3 lib/jstdutil/cli.rb
jstdutil-0.3.2 lib/jstdutil/cli.rb
jstdutil-0.3.1 lib/jstdutil/cli.rb
jstdutil-0.3.0 lib/jstdutil/cli.rb