Class: Maven::Tools::DSL::JarsLock

Inherits:
Object
  • Object
show all
Defined in:
lib/maven/tools/dsl/jars_lock.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, file = 'Jars.lock') ⇒ JarsLock

Returns a new instance of JarsLock.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/maven/tools/dsl/jars_lock.rb', line 26

def initialize( parent, file = 'Jars.lock' )
  file = File.join( parent.basedir, file )
  if File.exists?(file)
    parent.profile File.basename(file) do
      parent.activation do
        parent.file( :exists => File.basename(file) )
      end
      File.read(file).each_line do |line|
        data = line.sub(/-\ /, '').strip.split(':')
        case data.size
        when 3
          data = Hash[ [:groupId, :artifactId, :version].zip( data ) ]
          parent.jar data[:groupId], data[:artifactId], data[:version], :scope => :compile
        when 4
          data = Hash[ [:groupId, :artifactId, :version, :scope].zip( data ) ]
          parent.jar data[:groupId], data[:artifactId], data[:version], :scope => data[:scope]
        when 5
          data = Hash[ [:groupId, :artifactId, :classifier, :version, :scope].zip( data ) ]
          parent.jar data[:groupId], data[:artifactId], data[:version], :classifier => data[:classifier], :scope => data[:scope]
        else
          warn "can not parse: #{line}"
        end
      end
    end
  end
end

Instance Method Details

#helpObject



53
54
55
# File 'lib/maven/tools/dsl/jars_lock.rb', line 53

def help
  warn "\n# jars.lock(file) - default JArs.lock #\n"
end