Class: Jars::JarDetails

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

Instance Method Summary collapse

Instance Method Details

#artifact_idObject



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

def artifact_id
  self[ 1 ]
end

#classifierObject



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

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

#fileObject



10
11
12
13
14
15
16
17
# File 'lib/jars/lock.rb', line 10

def file
  f = self[ -1 ].strip
  if f.empty?
    path
  else
    f
  end
end

#gacvObject



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

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

#group_idObject



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

def group_id
  self[ 0 ]
end

#pathObject



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

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



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

def scope
  self[ -2 ].to_sym
end

#versionObject



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

def version
  self[ -3 ]
end