Class: CukeCommander::CLGenerator
- Inherits:
-
Object
- Object
- CukeCommander::CLGenerator
- Defined in:
- lib/cuke_commander/cl_generator.rb
Overview
The object responsible for generating Cucumber command lines.
Instance Method Summary collapse
-
#generate_command_line(options = {}) ⇒ Object
Generates a Cucumber command line.
Instance Method Details
#generate_command_line(options = {}) ⇒ Object
Generates a Cucumber command line.
Most option values are either an Array or a boolean value. In the case of the former, a String can be used instead of an Array when only a single value is needed. Some option values come in pairs (e.g. formatters and their output locations). These option values are taken as a Hash where a key is the first part of the pair and the key’s value is the second part.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cuke_commander/cl_generator.rb', line 15 def generate_command_line( = {}) () command_line = 'cucumber' (command_line, ([:profiles]), flag_for(:profiles, [:long_flags])) if [:profiles] (command_line, ([:names]), flag_for(:names, [:long_flags])) if [:names] (command_line, ([:tags]), flag_for(:tags, [:long_flags])) if [:tags] (command_line, ([:file_paths])) if [:file_paths] (command_line, ([:excludes]), flag_for(:excludes, [:long_flags])) if [:excludes] (command_line, ([:requires]), flag_for(:requires, [:long_flags])) if [:requires] append_option(command_line, flag_for(:no_source, [:long_flags])) if [:no_source] if [:formatters] [:formatters].each do |format, output_location| append_option(command_line, format, flag_for(:format, [:long_flags])) append_option(command_line, output_location,flag_for(:output, [:long_flags])) unless output_location.to_s.empty? end end append_option(command_line, flag_for(:no_color,[:long_flags])) if [:no_color] append_option(command_line, flag_for(:color,[:long_flags])) if [:color] append_option(command_line, flag_for(:backtrace,[:long_flags])) if [:backtrace] append_option(command_line, flag_for(:dry_run,[:long_flags])) if [:dry_run] append_option(command_line, flag_for(:no_profile,[:long_flags])) if [:no_profile] append_option(command_line, flag_for(:guess,[:long_flags])) if [:guess] append_option(command_line, flag_for(:wip,[:long_flags])) if [:wip] append_option(command_line, flag_for(:quiet,[:long_flags])) if [:quiet] append_option(command_line, flag_for(:verbose,[:long_flags])) if [:verbose] append_option(command_line, flag_for(:version,[:long_flags])) if [:version] append_option(command_line, flag_for(:help,[:long_flags])) if [:help] append_option(command_line, flag_for(:expand,[:long_flags])) if [:expand] append_option(command_line, flag_for(:strict,[:long_flags])) if [:strict] (command_line, ([:options])) if [:options] command_line end |