From fd05415c38fd7d46406ebc3c63c059deb3740183 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 9 May 2011 16:03:37 -0400 Subject: [PATCH] add a keep option --- README.md | 1 + bin/jasmine-headless-webkit | 9 ++++++--- lib/jasmine-headless-webkit/version.rb | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3338030..3026cdd 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Current supported options: * `-c`/`--colors` enables color output * `--no-colors` disables color output +* `--keep` preserves the temporary HTML document if an error occurs in testing These options can also be placed into a `.jasmine-headless-webkit` file in your project root. diff --git a/bin/jasmine-headless-webkit b/bin/jasmine-headless-webkit index f83d07d..121a969 100755 --- a/bin/jasmine-headless-webkit +++ b/bin/jasmine-headless-webkit @@ -22,10 +22,11 @@ include Jasmine::CLI opts = GetoptLong.new( [ '--colors', '-c', GetoptLong::NO_ARGUMENT ], - [ '--no-colors', GetoptLong::NO_ARGUMENT ] + [ '--no-colors', GetoptLong::NO_ARGUMENT ], + [ '--keep', GetoptLong::NO_ARGUMENT ] ) -options = { :colors => false } +options = { :colors => false, :remove_html_file => true } @process_options = lambda { |*args| opt = args.flatten.shift @@ -34,6 +35,8 @@ options = { :colors => false } options[:colors] = true when '--no-colors', '-nc' options[:colors] = false + when '--keep', '-k' + options[:remove_html_file] = false end } @@ -111,7 +114,7 @@ HTML File.open(target = "specrunner.#{$$}.html", 'w') { |fh| fh.print output } system %{#{File.join(gem_dir, 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner')} #{options[:colors] ? '-c' : ''} #{target}} status = $?.exitstatus -FileUtils.rm_f target +FileUtils.rm_f target if options[:remove_html_file] || (status == 0) exit status diff --git a/lib/jasmine-headless-webkit/version.rb b/lib/jasmine-headless-webkit/version.rb index f9e3dce..b341be9 100644 --- a/lib/jasmine-headless-webkit/version.rb +++ b/lib/jasmine-headless-webkit/version.rb @@ -1,7 +1,7 @@ module Jasmine module Headless module Webkit - VERSION = "0.0.4" + VERSION = "0.1.0" end end end