Class: Resolver
- Inherits:
-
Object
- Object
- Resolver
- Defined in:
- lib/jlauncher/repos.rb
Instance Method Summary collapse
- #get(coordinates) ⇒ Object
-
#initialize(local_maven_repo, local_ivy_repo, remote, verbose) ⇒ Resolver
constructor
A new instance of Resolver.
Constructor Details
#initialize(local_maven_repo, local_ivy_repo, remote, verbose) ⇒ Resolver
Returns a new instance of Resolver.
4 5 6 7 8 9 10 |
# 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 |
Instance Method Details
#get(coordinates) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 |