Class: Maven::Model::Plugin

Inherits:
Coordinate show all
Includes:
Dependencies
Defined in:
lib/maven/model/model.rb

Instance Method Summary collapse

Methods included from Dependencies

#dependencies, #detect_gem, #gem, #gem?, included, #jar, #jar?, #pom, #pom?, #test_jar, #test_jar?

Methods inherited from Coordinate

#==, #hash, #version?

Methods included from Tools::Coordinate

#gav, #group_artifact, #to_coordinate, #to_split_coordinate, #to_version

Methods inherited from Tag

#_name, _tags, #comment, prepend_tags, tags, #to_xml

Constructor Details

#initialize(*args, &block) ⇒ Plugin

Returns a new instance of Plugin.



139
140
141
142
143
144
145
146
# File 'lib/maven/model/model.rb', line 139

def initialize(*args, &block)
  super(*args)
  raise "plugin version must be a concrete version" if version =~ /^[\[\(].+,.*[\]\)]$/
  if block
    block.call(self)
  end
  self
end

Instance Method Details

#configuration(c = nil) ⇒ Object



173
174
175
176
# File 'lib/maven/model/model.rb', line 173

def configuration(c = nil)
  @configuration = Configuration.new(c) if c
  @configuration ||= Configuration.new({})
end

#execute_goal(goal) ⇒ Object



161
162
163
# File 'lib/maven/model/model.rb', line 161

def execute_goal(goal)
  execution.execute_goal(goal)
end

#execution(name = nil, &block) ⇒ Object



169
170
171
# File 'lib/maven/model/model.rb', line 169

def execution(name = nil, &block)
  executions.get(name, &block)
end

#executionsObject



165
166
167
# File 'lib/maven/model/model.rb', line 165

def executions
  @executions ||= ModelHash.new(Execution)
end

#in_phase(phase, name = nil, &block) ⇒ Object



152
153
154
155
156
157
158
159
# File 'lib/maven/model/model.rb', line 152

def in_phase(phase, name = nil, &block)
  name = "in_phase_#{phase.to_s.gsub(/-/,'_')}" unless name
  self.executions.get(name) do |exe|
    exe.phase = phase
    block.call(exe) if block
    exe
  end
end

#with(config) ⇒ Object



148
149
150
# File 'lib/maven/model/model.rb', line 148

def with(config)
  self.configuration config
end