Class: Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/specss/parser.rb

Overview

Parse arguments that are passed when running specs

Class Method Summary collapse

Class Method Details

.parse(options) ⇒ Object



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
36
# File 'lib/specss/parser.rb', line 8

def self.parse(options)

  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: specss [option]"

    opts.on("-c", "--condensed", "Run specs of files opened for edit only") do |n|
      Executor.main('condensed')
    end

    opts.on("-e", "--extended", "Run specs of files opened for edit and dependents") do |n|
      Executor.main('extended')
    end

    opts.on("-l", "--list", "Prints a list of specs for files opened for edit") do |n|
      Executor.main('list')
    end

    opts.on("-v", "--version", "Smarter Specs Version") do |n|
      puts "Specss #{Specss::VERSION}"
    end

    opts.on("-h", "--help", "Prints this help") do
      puts opts
      exit
    end
  end

  opt_parser.parse!(options)
end