Class: UISpecRunner::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/uispecrunner/application.rb

Class Method Summary collapse

Class Method Details

.run!(*arguments) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/uispecrunner/application.rb', line 6

def self.run!(*arguments)
  options = UISpecRunner::Options.new(arguments)
  
  if options[:invalid_argument]
    $stderr.puts options[:invalid_argument]
    options[:show_help] = true
  end

  if options[:command] == :help
    $stderr.puts options.opts
    return 1
  end
  
  if options[:command] == :version
    version_path = File.join(File.dirname(__FILE__), '..', '..', 'VERSION')
    version = File.read(version_path)
    $stdout.puts version
    return 0
  end
  
  # Read standard arguments from uispec.opts
  options_file = File.join(Dir.getwd, 'uispec.opts')
  if File.exists?(options_file)
    options = UISpecRunner::Options.from_file(options_file).merge(options)
  end
  
  runner = UISpecRunner.new(options)
  runner.run!
  return 0
end