Sha256: 72612f16193c57c7ecad401cb2f85f2eed31293f397d1b8337685f773600b3d8
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
module Hypercuke class CLI # I take information extracted the Parser and use it to build a # 'cucumber' command line class Builder def initialize(options) @options = options @cuke_args = [] build_cuke_args end def cucumber_command_line(prepend_bundler = false) cmd = prepend_bundler ? 'bundle exec ' : '' cmd << cuke_args.join(' ') cmd end private attr_reader :options, :cuke_args def build_cuke_args add_base_command add_layer_tag_for_mode add_profile_unless_already_present pass_through_all_other_args end def add_base_command cuke_args << 'cucumber' end def add_layer_tag_for_mode cuke_args << "--tags #{layer_tag_for_mode}" end def layer_tag_for_mode layer = options.fetch(:layer_name) mode = options[:mode] blank_or_ok = ->(e) { e.to_s =~ /^(\s*|ok)$/ } '@' + [ layer, mode ].reject(&blank_or_ok).join('_') end def add_profile_unless_already_present if profile_specified? add_profile options[:profile] else if options[:mode] == 'wip' add_profile 'wip' end end end def profile_specified? options[:profile].to_s !~ /^\s*$/ end def add_profile(profile_name) cuke_args << '--profile' cuke_args << profile_name end def pass_through_all_other_args cuke_args.concat( options[:other_args] ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hypercuke-0.5.0 | lib/hypercuke/cli/builder.rb |