lib/solve/ruby_solver.rb in solve-2.0.1 vs lib/solve/ruby_solver.rb in solve-2.0.2

- old
+ new

@@ -42,10 +42,11 @@ def initialize(graph, demands, options = {}) @graph = graph @demands_array = demands @timeout_ms = self.class.timeout + @ui = options[:ui] # could be nil, but that's okay @dependency_source = options[:dependency_source] || 'user-specified dependency' @molinillo_graph = Molinillo::DependencyGraph.new @resolver = Molinillo::Resolver.new(self, self) end @@ -67,10 +68,12 @@ # given graph. # @raise [Errors::UnsortableSolutionError] when the :sorted option is true # and the demands have a solution, but the solution contains a cyclic # dependency def resolve(options = {}) + @ui = options[:ui] if options[:ui] + solved_graph = resolve_with_error_wrapping solution = solved_graph.map(&:payload) unsorted_solution = solution.inject({}) do |stringified_soln, artifact| @@ -101,24 +104,30 @@ end # Callback required by Molinillo, called when the solve starts # @return nil def before_resolution - nil + @ui.say('Starting dependency resolution') if @ui end # Callback required by Molinillo, called when the solve is complete. # @return nil def after_resolution + @ui.say('Finished dependency resolution') if @ui + end + + # Callback required by Molinillo, called when resolving every progress_rate + # @return nil + def indicate_progress nil end # Callback required by Molinillo, gives debug information about the solution # @return nil def debug(current_resolver_depth) # debug info will be returned if you call yield here, but it seems to be # broken in current Molinillo - nil + @ui.say(yield) if @ui end # Callback required by Molinillo # @return [String] the dependency's name def name_for(dependency)