Class: Jars::JarDetails

Inherits:
Array
  • Object
show all
Defined in:
lib/jars/lock.rb

Instance Method Summary collapse

Instance Method Details

#artifact_idObject



20
21
22
# File 'lib/jars/lock.rb', line 20

def artifact_id
  self[1]
end

#classifierObject



28
29
30
31
32
# File 'lib/jars/lock.rb', line 28

def classifier
  return nil if size == 5

  self[2]
end

#fileObject



11
12
13
14
# File 'lib/jars/lock.rb', line 11

def file
  file = self[-1].strip
  file.empty? ? path : file
end

#gacvObject



34
35
36
# File 'lib/jars/lock.rb', line 34

def gacv
  classifier ? self[0..3] : self[0..2]
end

#group_idObject



16
17
18
# File 'lib/jars/lock.rb', line 16

def group_id
  self[0]
end

#pathObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/jars/lock.rb', line 38

def path
  if scope == :system
    # replace maven like system properties embedded into the string
    self[-1].gsub(/\$\{[a-zA-Z.]+\}/) do |a|
      ENV_JAVA[a[2..-2]] || a
    end
  else
    File.join(Jars.home, group_id.gsub(/[.]/, '/'), artifact_id, version, "#{gacv[1..].join('-')}.jar")
  end
end

#scopeObject



7
8
9
# File 'lib/jars/lock.rb', line 7

def scope
  self[-2].to_sym
end

#versionObject



24
25
26
# File 'lib/jars/lock.rb', line 24

def version
  self[-3]
end