class Librarian::Action::Resolve

Public Instance Methods

run() click to toggle source
# File lib/librarian/action/resolve.rb, line 11
def run
  if force? || !lockfile_path.exist?
    spec = specfile.read
    manifests = []
  else
    lock = lockfile.read
    spec = specfile.read(lock.sources)
    changes = spec_change_set(spec, lock)
    if changes.same?
      debug { "The specfile is unchanged: nothing to do." }
      return
    end
    manifests = changes.analyze
  end

  spec.dependencies, duplicated = Dependency.remove_duplicate_dependencies(spec.dependencies)
  duplicated.each do |name, dependencies_same_name|
    environment.logger.info { "Dependency '#{name}' duplicated for module, merging: #{dependencies_same_name.map{|d| d.to_s}}" }
  end

  resolution = resolver.resolve(spec, manifests)
  persist_resolution(resolution)
  resolution
end

Private Instance Methods

force?() click to toggle source
# File lib/librarian/action/resolve.rb, line 38
def force?
  options[:force]
end
resolver() click to toggle source
# File lib/librarian/action/resolve.rb, line 42
def resolver
  Resolver.new(environment)
end
spec_change_set(spec, lock) click to toggle source
# File lib/librarian/action/resolve.rb, line 46
def spec_change_set(spec, lock)
  SpecChangeSet.new(environment, spec, lock)
end