Class: Maven::Model::Project
Instance Method Summary
collapse
-
#_name ⇒ Object
-
#build ⇒ Object
-
#dependency_management(&block) ⇒ Object
-
#description(val = nil) ⇒ Object
-
#description=(val) ⇒ Object
-
#developers(&block) ⇒ Object
-
#execute_in_phase(phase, name = nil, &block) ⇒ Object
-
#executions_in_phase ⇒ Object
-
#initialize(*args, &block) ⇒ Project
constructor
A new instance of Project.
-
#licenses(&block) ⇒ Object
-
#name(val = nil) ⇒ Object
-
#name=(val) ⇒ Object
-
#parent(*args, &block) ⇒ Object
-
#plugin(*args, &block) ⇒ Object
-
#plugin?(name) ⇒ Boolean
-
#plugin_repositories(&block) ⇒ Object
-
#plugin_repository(id, url = nil, &block) ⇒ Object
-
#profile(id, &block) ⇒ Object
-
#profiles(&block) ⇒ Object
-
#properties ⇒ Object
-
#properties=(props) ⇒ Object
-
#repositories(&block) ⇒ Object
-
#repository(id, url = nil, &block) ⇒ Object
-
#source_control(&block) ⇒ Object
(also: #scm)
-
#version(val = nil) ⇒ Object
#dependencies, #detect_gem, #gem, #gem?, included, #jar, #jar?, #pom, #pom?, #test_jar, #test_jar?
Methods inherited from Coordinate
#==, #hash, #version?
#gav, #group_artifact, #to_coordinate, #to_version
Methods inherited from Tag
_tags, #comment, prepend_tags, tags, #to_xml
Constructor Details
#initialize(*args, &block) ⇒ Project
Returns a new instance of Project.
364
365
366
367
368
369
370
371
|
# File 'lib/maven/model/model.rb', line 364
def initialize(*args, &block)
super(*args)
model_version "4.0.0"
if block
block.call(self)
end
self
end
|
Instance Method Details
#_name ⇒ Object
373
374
375
|
# File 'lib/maven/model/model.rb', line 373
def _name
'project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"'
end
|
#build ⇒ Object
436
437
438
|
# File 'lib/maven/model/model.rb', line 436
def build
@build ||= Build.new
end
|
#dependency_management(&block) ⇒ Object
484
485
486
487
488
489
490
|
# File 'lib/maven/model/model.rb', line 484
def dependency_management(&block)
@dependency_management ||= DependencyManagement.new
if block
block.call(@dependency_management)
end
@dependency_management
end
|
#description(val = nil) ⇒ Object
391
392
393
394
|
# File 'lib/maven/model/model.rb', line 391
def description(val = nil)
self.description = val if val
@description
end
|
#description=(val) ⇒ Object
396
397
398
|
# File 'lib/maven/model/model.rb', line 396
def description=(val)
@description = "<![CDATA[#{val}]]>"
end
|
#developers(&block) ⇒ Object
440
441
442
443
444
445
446
|
# File 'lib/maven/model/model.rb', line 440
def developers(&block)
@developers ||= DeveloperHash.new
if block
block.call(@developers)
end
@developers
end
|
#execute_in_phase(phase, name = nil, &block) ⇒ Object
413
414
415
416
417
418
|
# File 'lib/maven/model/model.rb', line 413
def execute_in_phase(phase, name = nil, &block)
gem_plugin = plugin("gem")
gem_plugin.in_phase(phase.to_s, name).execute_goal("execute_in_phase").with(:file => File.basename('Mavenfile'), :phase => phase)
executions_in_phase[phase.to_s] = block
gem_plugin
end
|
#executions_in_phase ⇒ Object
420
421
422
|
# File 'lib/maven/model/model.rb', line 420
def executions_in_phase
@executions_in_phase ||= {}
end
|
#licenses(&block) ⇒ Object
448
449
450
451
452
453
454
|
# File 'lib/maven/model/model.rb', line 448
def licenses(&block)
@licenses ||= LicenseHash.new
if block
block.call(@licenses)
end
@licenses
end
|
#name(val = nil) ⇒ Object
382
383
384
385
|
# File 'lib/maven/model/model.rb', line 382
def name(val = nil)
self.name = val if val
@name
end
|
#name=(val) ⇒ Object
387
388
389
|
# File 'lib/maven/model/model.rb', line 387
def name=(val)
@name = "<![CDATA[#{val}]]>"
end
|
#parent(*args, &block) ⇒ Object
400
401
402
403
404
|
# File 'lib/maven/model/model.rb', line 400
def parent(*args, &block)
@parent ||= Parent.new(*args)
block.call( @parent ) if block
@parent
end
|
#plugin(*args, &block) ⇒ Object
424
425
426
|
# File 'lib/maven/model/model.rb', line 424
def plugin(*args, &block)
build.plugins.get(*args, &block)
end
|
#plugin?(name) ⇒ Boolean
428
429
430
|
# File 'lib/maven/model/model.rb', line 428
def plugin?(name)
build.plugin?(name)
end
|
#plugin_repositories(&block) ⇒ Object
470
471
472
473
474
475
476
|
# File 'lib/maven/model/model.rb', line 470
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
478
479
480
481
482
|
# File 'lib/maven/model/model.rb', line 478
def plugin_repository(id, url = nil, &block)
repo = plugin_repositories.get(id, &block)
repo.url = url if url
repo
end
|
#profile(id, &block) ⇒ Object
432
433
434
|
# File 'lib/maven/model/model.rb', line 432
def profile(*args, &block)
profiles.get(*args, &block)
end
|
#profiles(&block) ⇒ Object
509
510
511
512
513
514
515
|
# File 'lib/maven/model/model.rb', line 509
def profiles(&block)
@profiles ||= ModelHash.new(Profile)
if block
block.call(@profiles)
end
@profiles
end
|
#properties ⇒ Object
492
493
494
495
|
# File 'lib/maven/model/model.rb', line 492
def properties
@properties ||= Properties.new
@properties.map
end
|
#properties=(props) ⇒ Object
497
498
499
500
501
502
503
|
# File 'lib/maven/model/model.rb', line 497
def properties=(props)
if props.is_a? Hash
@properties = Properties.new(props)
else
@properties = props
end
end
|
#repositories(&block) ⇒ Object
456
457
458
459
460
461
462
|
# File 'lib/maven/model/model.rb', line 456
def repositories(&block)
@repositories ||= ModelHash.new(Repository)
if block
block.call(@repositories)
end
@repositories
end
|
#repository(id, url = nil, &block) ⇒ Object
464
465
466
467
468
|
# File 'lib/maven/model/model.rb', line 464
def repository(id, url = nil, &block)
repo = repositories.get(id, &block)
repo.url = url if url
repo
end
|
#source_control(&block) ⇒ Object
Also known as:
scm
406
407
408
409
410
|
# File 'lib/maven/model/model.rb', line 406
def source_control(&block)
@scm ||= SourceControl.new
block.call( @scm ) if block
@scm
end
|
#version(val = nil) ⇒ Object
377
378
379
380
|
# File 'lib/maven/model/model.rb', line 377
def version(val = nil)
self.version = val if val
@version ||= (@parent.nil? ? '0.0.0' : @parent.version)
end
|