Class: Jars::JarDetails

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

Instance Method Summary collapse

Instance Method Details

#artifact_idObject



18
19
20
# File 'lib/jars/lock.rb', line 18

def artifact_id
  self[1]
end

#classifierObject



26
27
28
# File 'lib/jars/lock.rb', line 26

def classifier
  size == 5 ? nil : self[2]
end

#fileObject



9
10
11
12
# File 'lib/jars/lock.rb', line 9

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

#gacvObject



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

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

#group_idObject



14
15
16
# File 'lib/jars/lock.rb', line 14

def group_id
  self[0]
end

#pathObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/jars/lock.rb', line 34

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..-1].join('-') + '.jar')
  end
end

#scopeObject



5
6
7
# File 'lib/jars/lock.rb', line 5

def scope
  self[-2].to_sym
end

#versionObject



22
23
24
# File 'lib/jars/lock.rb', line 22

def version
  self[-3]
end