Class: Maven::Model::Profile

Inherits:
Tag
  • Object
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 Tag

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

Constructor Details

#initialize(id, &block) ⇒ Profile

Returns a new instance of Profile.



225
226
227
228
229
230
231
# File 'lib/maven/model/model.rb', line 225

def initialize(id, &block)
  self.id id
  if block
    block.call(self)
  end
  self
end

Instance Method Details

#activation(name = nil, value = nil, &block) ⇒ Object



250
251
252
253
254
255
256
257
258
259
# File 'lib/maven/model/model.rb', line 250

def activation(name = nil, value = nil, &block)
  @activation ||= Activation.new
   if name || value
     warn "deprecated, use 'property_activation' instead"
     @activation.property(name, value)
   else
     block.call(@activation) if block
     @activation
   end
end

#buildObject



246
247
248
# File 'lib/maven/model/model.rb', line 246

def build
  @build ||= Build.new
end

#dependency_management(&block) ⇒ Object



293
294
295
296
297
298
299
# File 'lib/maven/model/model.rb', line 293

def dependency_management(&block)
  @dependency_management ||= DependencyManagement.new
  if block
    block.call(@dependency_management)
  end
  @dependency_management
end

#plugin(*args, &block) ⇒ Object



289
290
291
# File 'lib/maven/model/model.rb', line 289

def plugin(*args, &block)
  build.plugins.get(*args, &block)
end

#plugin_repositories(&block) ⇒ Object



275
276
277
278
279
280
281
# File 'lib/maven/model/model.rb', line 275

def plugin_repositories(&block)
  @plugin_repositories ||= ModelHash.new(PluginRepository)
  if block
    block.call(@plugin_repositories)
  end
  @plugin_repositories
end

#plugin_repository(id, url = nil, &block) ⇒ Object



283
284
285
286
287
# File 'lib/maven/model/model.rb', line 283

def plugin_repository(id, url = nil, &block)
  repo = plugin_repositories.get(id, &block)
  repo.url = url if url
  repo
end

#propertiesObject



233
234
235
236
# File 'lib/maven/model/model.rb', line 233

def properties
  @properties ||= Properties.new
  @properties.map
end

#properties=(props) ⇒ Object



238
239
240
241
242
243
244
# File 'lib/maven/model/model.rb', line 238

def properties=(props)
  if props.is_a? Hash
    @properties = Properties.new(props)
  else
    @properties = props
  end
end

#repositories(&block) ⇒ Object



261
262
263
264
265
266
267
# File 'lib/maven/model/model.rb', line 261

def repositories(&block)
  @repositories ||= ModelHash.new(Repository)
  if block
    block.call(@repositories)
  end
  @repositories
end

#repository(id, url = nil, &block) ⇒ Object



269
270
271
272
273
# File 'lib/maven/model/model.rb', line 269

def repository(id, url = nil, &block)
  repo = repositories.get(id, &block)
  repo.url = url if url
  repo
end