jasmine-headless-webkit/bin/jasmine-headless-webkit
2011-11-16 15:28:02 -05:00

33 lines
797 B
Ruby
Executable File

#!/usr/bin/env ruby
require 'rubygems'
def gem_dir
File.expand_path('../..', __FILE__)
end
$:.unshift(File.join(gem_dir, 'lib'))
require 'jasmine-headless-webkit'
require 'coffee-script'
require 'rainbow'
begin
options = Jasmine::Headless::Options.from_command_line
runner = Jasmine::Headless::Runner.new(options)
if options[:do_list]
files_list = Jasmine::Headless::FilesList.new(:config => runner.jasmine_config)
files_list.files.each { |file| puts file }
else
exit runner.run
end
rescue CoffeeScript::CompilationError
exit 1
rescue StandardError => e
$stderr.puts "[%s] %s (%s)" % [ "jasmine-headless-webkit".color(:red), e.message.color(:white), e.class.name.color(:yellow) ]
$stderr.puts e.backtrace.collect { |line| " #{line}" }.join("\n")
exit 1
end