lib/lock_jar/resolver.rb in lock_jar-0.15.1 vs lib/lock_jar/resolver.rb in lock_jar-0.15.2

- old
+ new

@@ -19,21 +19,21 @@ require 'fileutils' module LockJar # class Resolver - attr_reader :opts, :naether + attr_reader :config, :opts, :naether - def initialize(opts = {}) + def initialize(config, opts = {}) + @config = config || LockJar::Config.new({}) @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. - # 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 @@ -44,10 +44,13 @@ def clear_remote_repositories @naether.clear_remote_repositories end def add_remote_repository(repo) - @naether.add_remote_repository(repo) + repo_config = config.repositories[repo] || {} + username = repo_config['username'] + password = repo_config['password'] + @naether.add_remote_repository(repo, username, password) end def resolve(dependencies, download_artifacts = true) @naether.dependencies = dependencies @naether.resolve_dependencies(download_artifacts)