add a keep option

This commit is contained in:
John Bintz 2011-05-09 16:03:37 -04:00
parent f6f975a8c9
commit fd05415c38
3 changed files with 8 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -1,7 +1,7 @@
module Jasmine
module Headless
module Webkit
VERSION = "0.0.4"
VERSION = "0.1.0"
end
end
end