Class: NexusCli::Artifact

Inherits:
Object
  • Object
show all
Defined in:
lib/nexus_cli/artifact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coordinates) ⇒ Array<String>

Constructs an artifact object from Maven co-ordinates See maven.apache.org/pom.html#Maven_coordinatess for more information on maven coordinatess

Parameters:

  • coordinates (String)

    the Maven identifier



13
14
15
# File 'lib/nexus_cli/artifact.rb', line 13

def initialize(coordinates)
  @group_id, @artifact_id, @extension, @classifier, @version = parse_coordinates(coordinates)
end

Instance Attribute Details

#artifact_idObject (readonly)

Returns the value of attribute artifact_id.



3
4
5
# File 'lib/nexus_cli/artifact.rb', line 3

def artifact_id
  @artifact_id
end

#classifierObject (readonly)

Returns the value of attribute classifier.



3
4
5
# File 'lib/nexus_cli/artifact.rb', line 3

def classifier
  @classifier
end

#extensionObject (readonly)

Returns the value of attribute extension.



3
4
5
# File 'lib/nexus_cli/artifact.rb', line 3

def extension
  @extension
end

#group_idObject (readonly)

Returns the value of attribute group_id.



3
4
5
# File 'lib/nexus_cli/artifact.rb', line 3

def group_id
  @group_id
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/nexus_cli/artifact.rb', line 4

def version
  @version
end

Instance Method Details

#file_nameObject



17
18
19
20
21
22
23
# File 'lib/nexus_cli/artifact.rb', line 17

def file_name
  if classifier.nil?
    "#{artifact_id}-#{version}.#{extension}"
  else
    "#{artifact_id}-#{version}-#{classifier}.#{extension}"
  end
end