Class: Maven::Goal

Inherits:
Base
  • Object
show all
Defined in:
lib/maven.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#skip_to, #until

Constructor Details

#initialize(parent, name) ⇒ Goal

Returns a new instance of Goal.



329
330
331
332
# File 'lib/maven.rb', line 329

def initialize(parent, name)
  @parent = parent
  @name = name.strip
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



325
326
327
# File 'lib/maven.rb', line 325

def description
  @description
end

#implementationObject

Returns the value of attribute implementation.



326
327
328
# File 'lib/maven.rb', line 326

def implementation
  @implementation
end

#languageObject

Returns the value of attribute language.



326
327
328
# File 'lib/maven.rb', line 326

def language
  @language
end

#nameObject

Returns the value of attribute name.



325
326
327
# File 'lib/maven.rb', line 325

def name
  @name
end

#parametersObject

Returns the value of attribute parameters.



327
328
329
# File 'lib/maven.rb', line 327

def parameters
  @parameters
end

Instance Method Details

#new_parameterObject



370
371
372
373
374
375
# File 'lib/maven.rb', line 370

def new_parameter
 parameter = Parameter.new(self)
 self.parameters ||= []
 self.parameters << parameter
 parameter
end

#prepareObject



334
335
336
337
# File 'lib/maven.rb', line 334

def prepare
  super
  parameters.each{|parameter| parameter.prepare}
end

#process(line) ⇒ Object



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/maven.rb', line 339

def process(line)
  case @status || :none
  when :none
    skip_to(/^Description\:/, :description)
  when :description
    if /^Implementation\: (.*?)$/ =~ line
      self.implementation = $1.strip
      @status = :language
    else
      self.description ||= []
      self.description << line.strip
    end
    self
  when :language
    key, value = *line.split(": ", 2)
    self.language = value.strip
    @status = :parameters
    skip_to(/^Parameters\:/, :parameters)
  when :parameters
    if line.strip == ""
      self
    elsif /^#{'=' * 40}/ =~ line
      parent
    else
      new_parameter
    end
  else
    raise "unimplemented"
  end
end