17: def options(argv=ARGV)
18: options = MSpecOptions.new "mspec run [options] (FILE|DIRECTORY|GLOB)+", 30, config
19:
20: options.doc " Ask yourself:"
21: options.doc " 1. What specs to run?"
22: options.doc " 2. How to modify the execution?"
23: options.doc " 3. How to modify the guard behavior?"
24: options.doc " 4. How to display the output?"
25: options.doc " 5. What action to perform?"
26: options.doc " 6. When to perform it?"
27:
28: options.doc "\n What specs to run"
29: options.filters
30:
31: options.doc "\n How to modify the execution"
32: options.chdir
33: options.prefix
34: options.configure { |f| load f }
35: options.name
36: options.randomize
37: options.pretend
38: options.background
39: options.interrupt
40:
41: options.doc "\n How to modify the guard behavior"
42: options.unguarded
43: options.verify
44:
45: options.doc "\n How to display their output"
46: options.formatters
47: options.verbose
48:
49: options.doc "\n What action to perform"
50: options.actions
51:
52: options.doc "\n When to perform it"
53: options.action_filters
54:
55: options.doc "\n Help!"
56: options.debug
57: options.version MSpec::VERSION
58: options.help
59:
60: options.doc "\n Custom options"
61: custom_options options
62:
63: options.doc "\n How might this work in the real world?"
64: options.doc "\n 1. To simply run some specs"
65: options.doc "\n $ mspec path/to/the/specs"
66: options.doc " mspec path/to/the_file_spec.rb"
67: options.doc "\n 2. To run specs tagged with 'fails'"
68: options.doc "\n $ mspec -g fails path/to/the_file_spec.rb"
69: options.doc "\n 3. To start the debugger before the spec matching 'this crashes'"
70: options.doc "\n $ mspec --spec-debug -S 'this crashes' path/to/the_file_spec.rb"
71: options.doc ""
72:
73: patterns = options.parse argv
74: patterns = config[:files] if patterns.empty?
75: if patterns.empty?
76: puts options
77: puts "No files specified."
78: exit 1
79: end
80: @files = files patterns
81: end