Class: Pushwagner::Maven

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

Defined Under Namespace

Classes: Artifact, Deployer, Repository

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maven, version) ⇒ Maven

Returns a new instance of Maven.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pushwagner/maven.rb', line 11

def initialize(maven, version)
  required("Need maven configuration") unless maven

  if version && !version.empty?
    @version = version
  else
    required("Deployment version for artifacts is required")
  end

  @repository = Repository.new(maven['repositories'])
  @artifacts = Hash[(maven['artifacts'] || required("Requires at least one maven artifact")).map { |k,h| [k, Artifact.new(h['artifact_id'], h['group_id'], h['version'] || version)] }]

  (artifacts && repository) || required("Could not initialize maven configuration")
end

Instance Attribute Details

#artifactsObject (readonly)

Returns the value of attribute artifacts.



10
11
12
# File 'lib/pushwagner/maven.rb', line 10

def artifacts
  @artifacts
end

#repositoryObject (readonly)

Returns the value of attribute repository.



10
11
12
# File 'lib/pushwagner/maven.rb', line 10

def repository
  @repository
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/pushwagner/maven.rb', line 30

def any?
  artifacts && repository
end

#required(msg) ⇒ Object

Raises:

  • (StandardError)


26
27
28
# File 'lib/pushwagner/maven.rb', line 26

def required(msg)
  raise StandardError.new(msg)
end