Class: Jasmine::Headless::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine/headless/command_line.rb

Class Method Summary collapse

Class Method Details

.run!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jasmine/headless/command_line.rb', line 4

def run!
  require 'coffee-script'
  require 'rainbow'

  begin
    options = Options.from_command_line
    runner = Runner.new(options)

    if options[:do_list]
      FilesList.reset!

      files_list = 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
end