Class: Nexus::Gav

Inherits:
Object
  • Object
show all
Defined in:
lib/nexus_client/gav.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gav_string) ⇒ Gav

Returns a new instance of Gav.



6
7
8
9
10
11
# File 'lib/nexus_client/gav.rb', line 6

def initialize(gav_string)
  raise(err) if gav_match.match(gav_string).nil?
  @group,@artifact,@version,@repo,@classifier,@extension = gav_string.split(":")
  @gav_value = gav_string
  @attributes = {}
end

Instance Attribute Details

#artifactObject

Returns the value of attribute artifact.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def artifact
  @artifact
end

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def attributes
  @attributes
end

#classifierObject

Returns the value of attribute classifier.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def classifier
  @classifier
end

#extensionObject

Returns the value of attribute extension.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def extension
  @extension
end

#gav_valueObject (readonly)

Returns the value of attribute gav_value.



4
5
6
# File 'lib/nexus_client/gav.rb', line 4

def gav_value
  @gav_value
end

#groupObject

Returns the value of attribute group.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def group
  @group
end

#repoObject

Returns the value of attribute repo.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def repo
  @repo
end

#sha1Object

Returns the value of attribute sha1.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def sha1
  @sha1
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/nexus_client/gav.rb', line 3

def version
  @version
end

Instance Method Details

#dir_locationObject

returns a directory location given the gav ie. /org/glassfish/main/external/ant/



30
31
32
# File 'lib/nexus_client/gav.rb', line 30

def dir_location
  File.join(group.gsub('.', '/'), artifact)
end

#filenameObject



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

def filename
  if classifier.empty?
    "#{artifact}-#{version}.#{extension}"
  else
    "#{artifact}-#{version}-#{classifier}.#{extension}"
  end
end

#to_hashObject



25
26
27
# File 'lib/nexus_client/gav.rb', line 25

def to_hash
  {:g => group, :a => artifact, :v => version, :r => repo, :c => classifier, :e => extension}
end

#to_sObject



13
14
15
# File 'lib/nexus_client/gav.rb', line 13

def to_s
  gav_value
end