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
-
#dump_pom(file = nil) ⇒ 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_split_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
441
442
443
|
# File 'lib/maven/model/model.rb', line 441
def build
@build ||= Build.new
end
|
#dependency_management(&block) ⇒ Object
489
490
491
492
493
494
495
|
# File 'lib/maven/model/model.rb', line 489
def dependency_management(&block)
@dependency_management ||= DependencyManagement.new
if block
block.call(@dependency_management)
end
@dependency_management
end
|
#description(val = nil) ⇒ Object
396
397
398
399
|
# File 'lib/maven/model/model.rb', line 396
def description(val = nil)
self.description = val if val
@description
end
|
#description=(val) ⇒ Object
401
402
403
|
# File 'lib/maven/model/model.rb', line 401
def description=(val)
@description = "<![CDATA[#{val}]]>"
end
|
#developers(&block) ⇒ Object
445
446
447
448
449
450
451
|
# File 'lib/maven/model/model.rb', line 445
def developers(&block)
@developers ||= DeveloperHash.new
if block
block.call(@developers)
end
@developers
end
|
#dump_pom(file = nil) ⇒ Object
377
378
379
380
|
# File 'lib/maven/model/model.rb', line 377
def dump_pom( file = nil )
@dump_pom = file if file
@dump_pom
end
|
#execute_in_phase(phase, name = nil, &block) ⇒ Object
418
419
420
421
422
423
|
# File 'lib/maven/model/model.rb', line 418
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
425
426
427
|
# File 'lib/maven/model/model.rb', line 425
def executions_in_phase
@executions_in_phase ||= {}
end
|
#licenses(&block) ⇒ Object
453
454
455
456
457
458
459
|
# File 'lib/maven/model/model.rb', line 453
def licenses(&block)
@licenses ||= LicenseHash.new
if block
block.call(@licenses)
end
@licenses
end
|
#name(val = nil) ⇒ Object
387
388
389
390
|
# File 'lib/maven/model/model.rb', line 387
def name(val = nil)
self.name = val if val
@name
end
|
#name=(val) ⇒ Object
392
393
394
|
# File 'lib/maven/model/model.rb', line 392
def name=(val)
@name = "<![CDATA[#{val}]]>"
end
|
#parent(*args, &block) ⇒ Object
405
406
407
408
409
|
# File 'lib/maven/model/model.rb', line 405
def parent(*args, &block)
@parent ||= Parent.new(*args)
block.call( @parent ) if block
@parent
end
|
#plugin(*args, &block) ⇒ Object
429
430
431
|
# File 'lib/maven/model/model.rb', line 429
def plugin(*args, &block)
build.plugins.get(*args, &block)
end
|
#plugin?(name) ⇒ Boolean
433
434
435
|
# File 'lib/maven/model/model.rb', line 433
def plugin?(name)
build.plugin?(name)
end
|
#plugin_repositories(&block) ⇒ Object
475
476
477
478
479
480
481
|
# File 'lib/maven/model/model.rb', line 475
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
483
484
485
486
487
|
# File 'lib/maven/model/model.rb', line 483
def plugin_repository(id, url = nil, &block)
repo = plugin_repositories.get(id, &block)
repo.url = url if url
repo
end
|
#profile(id, &block) ⇒ Object
437
438
439
|
# File 'lib/maven/model/model.rb', line 437
def profile(*args, &block)
profiles.get(*args, &block)
end
|
#profiles(&block) ⇒ Object
514
515
516
517
518
519
520
|
# File 'lib/maven/model/model.rb', line 514
def profiles(&block)
@profiles ||= ModelHash.new(Profile)
if block
block.call(@profiles)
end
@profiles
end
|
#properties ⇒ Object
497
498
499
500
|
# File 'lib/maven/model/model.rb', line 497
def properties
@properties ||= Properties.new
@properties.map
end
|
#properties=(props) ⇒ Object
502
503
504
505
506
507
508
|
# File 'lib/maven/model/model.rb', line 502
def properties=(props)
if props.is_a? Hash
@properties = Properties.new(props)
else
@properties = props
end
end
|
#repositories(&block) ⇒ Object
461
462
463
464
465
466
467
|
# File 'lib/maven/model/model.rb', line 461
def repositories(&block)
@repositories ||= ModelHash.new(Repository)
if block
block.call(@repositories)
end
@repositories
end
|
#repository(id, url = nil, &block) ⇒ Object
469
470
471
472
473
|
# File 'lib/maven/model/model.rb', line 469
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
411
412
413
414
415
|
# File 'lib/maven/model/model.rb', line 411
def source_control(&block)
@scm ||= SourceControl.new
block.call( @scm ) if block
@scm
end
|
#version(val = nil) ⇒ Object
382
383
384
385
|
# File 'lib/maven/model/model.rb', line 382
def version(val = nil)
self.version = val if val
@version ||= (@parent.nil? ? '0.0.0' : @parent.version)
end
|