class Resolver
Public Class Methods
new(local_maven_repo, local_ivy_repo, remote, verbose)
click to toggle source
# File lib/jlauncher/repos.rb, line 4 def initialize(local_maven_repo, local_ivy_repo, remote, verbose) @local_maven_repo = local_maven_repo @local_ivy_repo = local_ivy_repo @remote = remote @verbose = verbose end
Public Instance Methods
get(coordinates)
click to toggle source
# File lib/jlauncher/repos.rb, line 12 def get(coordinates) path = @local_maven_repo.local_path(coordinates) if File.exists?(path) STDERR.puts("'#{coordinates}' found in local maven repo at #{path}") if @verbose return path end path = @local_ivy_repo.local_path(coordinates) if File.exists?(path) STDERR.puts("'#{coordinates}' found in local ivy repo at #{path}") if @verbose return path end path = @local_ivy_repo.cache_path(coordinates) if File.exists?(path) STDERR.puts("'#{coordinates}' found in ivy cache at #{path}") if @verbose return path end STDERR.puts "'#{coordinates} not found in cache, trying to get them from remote..." if @verbose FileUtils.makedirs(File.dirname(path)) content = @remote.get(coordinates) open(path, "wb") do |file| file.write(content) end path end