Module: LockJar::Runtime::Install

Included in:
LockJar::Runtime
Defined in:
lib/lock_jar/runtime/install.rb

Instance Method Summary collapse

Instance Method Details

#install(jarfile_lock, groups = ['default'], opts = {}, &blk) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lock_jar/runtime/install.rb', line 6

def install(jarfile_lock, groups = ['default'], opts = {}, &blk)
  deps = list(jarfile_lock, groups, { with_locals: false }.merge(opts), &blk)

  lockfile = LockJar::Domain::Lockfile.read(jarfile_lock)
  if opts[:local_repo].nil? && lockfile.local_repository
    opts[:local_repo] = lockfile.local_repository
  end

  # Older Jarfile expected the defaul maven repo, but did not write
  # it to the lockfile
  resolver(opts).clear_remote_repositories if lockfile.version.to_f >= 0.11

  lockfile.remote_repositories.each do |repo|
    resolver(opts).add_remote_repository(repo)
  end

  files = resolver(opts).download(deps)

  files
end