2011-04-11 10:38:47 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2011-05-10 13:25:55 +00:00
|
|
|
require 'rubygems'
|
2011-06-19 19:08:18 +00:00
|
|
|
require 'rainbow'
|
2011-05-10 13:25:55 +00:00
|
|
|
|
2011-05-29 16:30:19 +00:00
|
|
|
def gem_dir
|
|
|
|
File.expand_path('../..', __FILE__)
|
|
|
|
end
|
|
|
|
|
2011-05-06 18:05:15 +00:00
|
|
|
$:.unshift(File.join(gem_dir, 'lib'))
|
2011-09-01 14:39:29 +00:00
|
|
|
require 'jasmine-headless-webkit'
|
2011-09-02 14:49:15 +00:00
|
|
|
|
2011-06-19 19:08:18 +00:00
|
|
|
require 'jasmine/headless/errors'
|
|
|
|
require 'jasmine/headless/runner'
|
|
|
|
require 'jasmine/headless/options'
|
2011-05-06 18:05:15 +00:00
|
|
|
|
2011-06-17 14:27:00 +00:00
|
|
|
begin
|
2011-08-22 17:26:48 +00:00
|
|
|
options = Jasmine::Headless::Options.from_command_line
|
|
|
|
runner = Jasmine::Headless::Runner.new(options)
|
|
|
|
|
|
|
|
if options[:do_list]
|
|
|
|
files_list = Jasmine::FilesList.new(
|
|
|
|
:config => runner.jasmine_config
|
|
|
|
)
|
|
|
|
|
|
|
|
files_list.files.each { |file| puts file }
|
|
|
|
else
|
|
|
|
puts "Running Jasmine specs...".color(:white)
|
|
|
|
exit runner.run
|
|
|
|
end
|
2011-06-19 19:08:18 +00:00
|
|
|
rescue CoffeeScript::CompilationError
|
|
|
|
exit 1
|
2011-06-17 14:27:00 +00:00
|
|
|
rescue StandardError => e
|
2011-06-19 19:08:18 +00:00
|
|
|
$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")
|
2011-06-17 14:27:00 +00:00
|
|
|
exit 1
|
|
|
|
end
|
2011-04-11 10:38:47 +00:00
|
|
|
|