fix other half of #19, better error reporting and exceptions
This commit is contained in:
parent
3b71a0355b
commit
d4b886099c
@ -1,19 +1,25 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
require 'rainbow'
|
||||||
|
|
||||||
def gem_dir
|
def gem_dir
|
||||||
File.expand_path('../..', __FILE__)
|
File.expand_path('../..', __FILE__)
|
||||||
end
|
end
|
||||||
|
|
||||||
$:.unshift(File.join(gem_dir, 'lib'))
|
$:.unshift(File.join(gem_dir, 'lib'))
|
||||||
|
require 'jasmine/headless/errors'
|
||||||
|
require 'jasmine/headless/runner'
|
||||||
|
require 'jasmine/headless/options'
|
||||||
|
|
||||||
puts "Running Jasmine specs..."
|
|
||||||
|
|
||||||
require 'jasmine/headless/cli'
|
|
||||||
begin
|
begin
|
||||||
exit Jasmine::Headless::CLI.run
|
puts "Running Jasmine specs...".color(:white)
|
||||||
|
exit Jasmine::Headless::Runner.run(Jasmine::Headless::Options.from_command_line)
|
||||||
|
rescue CoffeeScript::CompilationError
|
||||||
|
exit 1
|
||||||
rescue StandardError => e
|
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
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
require 'jasmine'
|
begin
|
||||||
|
require 'jasmine'
|
||||||
|
rescue NameError => e
|
||||||
|
if e.message['ActiveSupport::Concern']
|
||||||
|
$stderr.puts "[%s] %s (%s)" % [ "jasmine-gem".color(:red), e.message.color(:white), e.class.name.color(:yellow) ]
|
||||||
|
$stderr.puts "#{'Jasmine'.color(:red)} believes Rails 3 is available. Try using #{'Bundler'.color(:green)} and running via #{'bundle exec'.color(:green)}."
|
||||||
|
else
|
||||||
|
raise e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Jasmine
|
module Jasmine
|
||||||
class FilesList
|
class FilesList
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
require 'jasmine/headless/runner'
|
|
||||||
require 'jasmine/headless/options'
|
|
||||||
require 'getoptlong'
|
|
||||||
|
|
||||||
module Jasmine
|
|
||||||
module Headless
|
|
||||||
class CLI
|
|
||||||
def self.run
|
|
||||||
Runner.run(Options.from_command_line)
|
|
||||||
rescue NoRunnerError
|
|
||||||
puts "The Qt WebKit widget is not compiled! Try re-installing this gem."
|
|
||||||
1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
|||||||
module Jasmine
|
module Jasmine
|
||||||
module Headless
|
module Headless
|
||||||
class NoRunnerError < StandardError
|
class NoRunnerError < StandardError
|
||||||
|
def message
|
||||||
|
"The jasmine-headless-webkit specrunner (jasmine-webkit-specrunner) could not be found! Try reinstalling the gem."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
require 'forwardable'
|
require 'forwardable'
|
||||||
|
require 'getoptlong'
|
||||||
|
|
||||||
module Jasmine
|
module Jasmine
|
||||||
module Headless
|
module Headless
|
||||||
|
@ -1 +0,0 @@
|
|||||||
|
|
Loading…
Reference in New Issue
Block a user