Skip to content

Commit

Permalink
Add working DEBUG and DEBUG_RESOLVER modes
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Mar 21, 2010
1 parent eb3533d commit 86ca09a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/bundler/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ def initialize(index, source_requirements)
end

def debug
puts yield if defined?($debug) && $debug
if ENV['DEBUG_RESOLVER']
debug_info = yield
debug_info = debug_info.inpsect unless debug_info.is_a?(String)
$stderr.puts debug_info
end
end

def resolve(reqs, activated)
# If the requirements are empty, then we are in a success state. Aka, all
# gem dependencies have been resolved.
throw :success, activated if reqs.empty?

debug { STDIN.gets ; print "\e[2J\e[f" ; "==== Iterating ====\n\n" }
debug { print "\e[2J\e[f" ; "==== Iterating ====\n\n" }

# Sort dependencies so that the ones that are easiest to resolve are first.
# Easiest to resolve is defined by:
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def initialize(shell)
@shell = shell
end

# TODO: Add debug mode
def debug(msg)
@shell.say(msg) if ENV['DEBUG']
end

def info(msg)
Expand Down

0 comments on commit 86ca09a

Please sign in to comment.