lib/lock_jar/resolver.rb in lock_jar-0.10.5 vs lib/lock_jar/resolver.rb in lock_jar-0.12.0
- old
+ new
@@ -18,79 +18,83 @@
require 'naether/bootstrap'
require 'fileutils'
module LockJar
class Resolver
-
+
attr_reader :opts
attr_reader :naether
-
+
def initialize( opts = {} )
@opts = opts
local_repo = opts[:local_repo] || Naether::Bootstrap.default_local_repo
-
+
# Bootstrap Naether
Naether::Bootstrap.bootstrap_local_repo( local_repo, opts )
-
- # Bootstrapping naether will create an instance from downloaded jars.
+
+ # Bootstrapping naether will create an instance from downloaded jars.
# If jars exist locally already, create manually
@naether = Naether.create
@naether.local_repo_path = local_repo if local_repo
@naether.clear_remote_repositories if opts[:offline]
end
-
+
def remote_repositories
@naether.remote_repository_urls
end
-
+
+ def clear_remote_repositories
+ @naether.clear_remote_repositories
+ end
+
def add_remote_repository( repo )
@naether.add_remote_repository( repo )
end
-
-
+
+
def resolve( dependencies, download_artifacts = true )
@naether.dependencies = dependencies
@naether.resolve_dependencies( download_artifacts )
@naether.dependencies_notation
end
-
+
def dependencies_graph
@naether.dependencies_graph
end
-
+
def download( dependencies )
@naether.download_artifacts( dependencies )
end
-
+
def to_local_paths( notations )
- paths = []
+ paths = []
notations.each do |notation|
if File.exists?(notation)
paths << notation
else
paths = paths + @naether.to_local_paths( [notation] )
end
end
-
+
paths
end
-
+
def load_to_classpath( artifacts )
- paths = []
+ paths = []
notations = []
artifacts.each do |art|
if File.exists?(art)
paths << art
else
notations << art
end
end
-
+
paths += @naether.to_local_paths( notations )
Naether::Java.load_paths( paths )
-
+
paths
end
end
-end
\ No newline at end of file
+end