#!/usr/bin/env jruby require 'rubygems' require 'optparse' require 'rspec' require 'rbconfig' require 'operawatir' require 'operawatir/helper' @options = { :ng => false, :color_enabled => Config::CONFIG['host_os'] =~ /mswin|mingw|bccwin|wince|emx/ ? false : true, :check_syntax => false, :format => 'progress' } # TODO # Should steal https://github.com/rspec/rspec-core/blob/master/lib/rspec/core/option_parser.rb begin OptionParser.new do |opts| opts.banner = < e abort "operawatir: Unknown option `#{e.to_s.sub(/invalid option:\s+/, '')}'" end if ARGV.empty? abort 'operawatir: You need to specify at least one test file to run' else @options[:files_to_run] = ARGV end #abort 'operawatir: --ng and --check-syntax are disabled for now' if @options[:ng] || @options[:check_syntax] # TODO Be smarter about figuring out the Opera/Launcher path warn 'operawatir: Launch path is not specified.' if !ENV['OPERA_LAUNCHER'] && !@options[:launcher] warn 'operawatir: Browser path is not specified.' if !ENV['OPERA_PATH'] && !@options[:path] OperaWatir::Helper.run! @options