summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2013-03-25 21:20:03 -0700
committerAndre Arko <andre@arko.net>2013-03-25 21:20:03 -0700
commit93003471ce5af70979301e87a37b35aada4d158f (patch)
treee77707fd95f8f4ca186b58c80085fff16a4c3f13
parent26307ea7a50328feaa2c87ba935c92710633ab26 (diff)
parentfa909d662d9ab034439f7eaa6a8426f639928491 (diff)
downloadbundler-93003471ce5af70979301e87a37b35aada4d158f.tar.gz
Merge pull request #2418 from chief/resolver_progress_indicator
Add indicator progress in resolver
-rw-r--r--CONTRIBUTE.md6
-rw-r--r--lib/bundler/resolver.rb29
2 files changed, 26 insertions, 9 deletions
diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md
index cd2abe1985..a12d541e1f 100644
--- a/CONTRIBUTE.md
+++ b/CONTRIBUTE.md
@@ -6,7 +6,7 @@ You can start learning about Bundler by reading [the documentation](http://gembu
## Core Team
-The Bundler core team consists of André Arko ([@indirect](http://github.com/indirect)) and Terence Lee ([@hone](http://github.com/hone)), with support and advice from original Bundler author Yehuda Katz ([@wycats](http://github.com/wycats)).
+The Bundler core team consists of André Arko ([@indirect](http://github.com/indirect)), Terence Lee ([@hone](http://github.com/hone)), and Jessica Lynn Suttles ([@jlsuttles](http://github.com/jlsuttles)), with support and advice from original Bundler author Yehuda Katz ([@wycats](http://github.com/wycats)).
# Adding new features
@@ -71,7 +71,7 @@ Bundler has two main sources of documentation: the built-in help (including usag
If you’d like to submit a patch to the man pages, follow the steps for adding a feature above. All of the man pages are located in the `man` directory. Just use the “Documentation” heading when you describe what you did in the changelog.
-If you have a suggestion or proposed change for [gembundler.com](http://gembundler.com), please open an issue or send a pull request to the [bundler-site](http://github.com/carlhuda/bundler-site) repository.
+If you have a suggestion or proposed change for [gembundler.com](http://gembundler.com), please open an issue or send a pull request to the [bundler-site-middleman](https://github.com/bundler/bundler-site-middleman) repository.
# Community
@@ -80,7 +80,7 @@ Community is an important part of all we do. If you’d like to be part of the B
It would be tremendously helpful to have more people answering questions about Bundler (and often simply about Rubygems or Ruby itself) in our [issue tracker](https://github.com/carlhuda/bundler/issues) or on [Stack Overflow](http://stackoverflow.com/questions/tagged/bundler).
-Additional documentation and explanation is always helpful, too. If you have any suggestions for the Bundler website [gembundler.com](http://www.gembundler.com), we would absolutely love it if you opened an issue or pull request on the [bundler-site repository](http://github.com/carlhuda/bundler-site).
+Additional documentation and explanation is always helpful, too. If you have any suggestions for the Bundler website [gembundler.com](http://www.gembundler.com), we would absolutely love it if you opened an issue or pull request on the [bundler-site-middleman](https://github.com/bundler/bundler-site-middleman) repository.
Finally, sharing your experiences and discoveries by writing them up is a valuable way to help others who have similar problems or experiences in the future. You can write a blog post, create an example and commit it to Github, take screenshots, or make videos.
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 25d2ec09c3..d9673a467b 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -109,7 +109,7 @@ module Bundler
end
end
- attr_reader :errors
+ attr_reader :errors, :started_at, :iteration_rate, :iteration_counter
# Figures out the best possible configuration of gems that satisfies
# the list of passed dependencies and any child dependencies without
@@ -134,7 +134,6 @@ module Bundler
end
def initialize(index, source_requirements, base)
- @iteration_counter = 0
@errors = {}
@stack = []
@base = base
@@ -142,6 +141,8 @@ module Bundler
@deps_for = {}
@missing_gems = Hash.new(0)
@source_requirements = source_requirements
+ @iteration_counter = 0
+ @started_at = Time.now
end
def debug
@@ -168,10 +169,7 @@ module Bundler
# gem dependencies have been resolved.
throw :success, successify(activated) if reqs.empty?
- @iteration_counter += 1
- if((@iteration_counter % 10000) == 0)
- Bundler.ui.info ".", false
- end
+ indicate_progress
debug { print "\e[2J\e[f" ; "==== Iterating ====\n\n" }
@@ -505,5 +503,24 @@ module Bundler
o
end
end
+
+ private
+
+ # Indicates progress by writing a '.' every iteration_rate time which is
+ # aproximately every second. iteration_rate is calculated in the first
+ # second of resolve running.
+ def indicate_progress
+ @iteration_counter += 1
+
+ if iteration_rate.nil?
+ if ((Time.now - started_at) % 3600).round >= 1
+ @iteration_rate = iteration_counter
+ end
+ else
+ if ((iteration_counter % iteration_rate) == 0)
+ Bundler.ui.info ".", false
+ end
+ end
+ end
end
end