Class: Jars::JarDetails

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

Instance Method Summary collapse

Instance Method Details

#artifact_idObject



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

def artifact_id
  self[ 1 ]
end

#classifierObject



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

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

#fileObject



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

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

#gacvObject



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

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

#group_idObject



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

def group_id
  self[ 0 ]
end

#pathObject



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

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



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

def version
  self[ -3 ]
end