Sha256: 5249472a14954158eb713354640a46779c055fd34321617ac0e7b8f7643d1950
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
require_relative 'configuration_checker' module MavenHelperScript class ArgumentParser def initialize(file) @projectPom = File.join(file, "pom.xml") @configChecker = MavenHelperScript::ConfigurationChecker.new(file) end public def parse(args) resultingCommands = Array[] specialtyCommands = @configChecker.checkForArguments() result = "" processingCommand = true args.each do |arg| if isSpecialtyCommand arg specialtyCommands << arg else if processingCommand result << "mvn " << @configChecker.checkForCommand(arg) processingCommand = false else foundModule = @configChecker.checkForModule(arg) result << " -pl " << foundModule << " -f " << @projectPom resultingCommands << result result = "" processingCommand = true end end end applySpecialtyCommandsTo(specialtyCommands, resultingCommands) resultingCommands end private def applySpecialtyCommandsTo(specialtyCommands, resultingCommands) specialtyCommands.each do |command| resultingCommands.each do |it| it = it << " " << command end end end def isSpecialtyCommand(command) if command.start_with?('-') return true end false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maven-helper-script-0.1.1 | lib/argument_parser.rb |
maven-helper-script-0.1.0 | lib/argument_parser.rb |