lib/cuketagger/tagger.rb
# Performs tagging based on the provided arguments
Performs tagging based on the provided arguments
Performs tagging based on the provided arguments
def execute(args)
      abort(USAGE) if args.empty? || args.first =~ /^(-h|--help)$/
      force = false
      args.each do |arg|
        case arg
          when /^-v|--version$/
            puts CukeTagger::Version
          when /^(.+?\.feature)((:\d+)*)$/
            add_feature Regexp.last_match(1), Regexp.last_match(2).to_s
          when /^(add|remove):(.+?)$/
            alterations << [Regexp.last_match(1).to_sym, Regexp.last_match(2)]
          when /^(replace):(.+?):(.+)$/
            alterations << [Regexp.last_match(1).to_sym, [Regexp.last_match(2), Regexp.last_match(3)]]
          when /^(-f|--force)$/
            force = true
          else
            abort(USAGE)
        end
      end
      alterations.uniq!
      files = features_to_change.map { |file, _line| file }.uniq
      files.each { |file| parse file, force }
    end
def execute ( args ) abort ( USAGE ) if args . empty? || args . first =~ / ^(-h|--help)$ / force = false args . each do | arg | case arg when / ^-v|--version$ / puts CukeTagger :: Version when / ^(.+? \. feature)((: \d +)*)$ / add_feature Regexp . last_match ( 1 ) , Regexp . last_match ( 2 ) . to_s when / ^(add|remove):(.+?)$ / alterations << [ Regexp . last_match ( 1 ) . to_sym , Regexp . last_match ( 2 ) ] when / ^(replace):(.+?):(.+)$ / alterations << [ Regexp . last_match ( 1 ) . to_sym , [ Regexp . last_match ( 2 ) , Regexp . last_match ( 3 ) ] ] when / ^(-f|--force)$ / force = true else abort ( USAGE ) end end alterations . uniq! files = features_to_change . map { | file , _line | file } . uniq files . each { | file | parse file , force } end
Performs tagging based on the provided arguments
Performs tagging based on the provided arguments
args
<not_specific>