jasmine-headless-webkit/bin/jasmine-headless-webkit

32 lines
812 B
Ruby
Executable File

#!/usr/bin/env ruby
require 'rubygems'
require 'rainbow'
def gem_dir
File.expand_path('../..', __FILE__)
end
$:.unshift(File.join(gem_dir, 'lib'))
require 'jasmine-headless-webkit'
begin
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
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