diff options
author | Hemant Kumar <gethemant@gmail.com> | 2013-07-26 22:50:19 +0530 |
---|---|---|
committer | Hemant Kumar <gethemant@gmail.com> | 2013-07-26 22:50:19 +0530 |
commit | 9ffd8882d04ff9458793b51ac51a9cb4e04a238a (patch) | |
tree | 52fcb8ea9c486ce48c52ee7d303548e86b06ba47 /lib/bundler/spec_set.rb | |
parent | de6e1d57606ad40a3aaabf6a67b2839472f87d28 (diff) | |
download | bundler-9ffd8882d04ff9458793b51ac51a9cb4e04a238a.tar.gz |
Extract the mutually dependent gems from error message
On MRI and Ruby 1.9 error message pattern looks very
different from what we see on JRuby and other versions of
Ruby.
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r-- | lib/bundler/spec_set.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 41f46dba56..9292511481 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -112,13 +112,21 @@ module Bundler begin @sorted ||= ([rake] + tsort).compact.uniq rescue TSort::Cyclic => error - gemstr = error.message.scan(/@name="(.*?)"/).flatten.join(" and ") + gemstr = extract_circular_gems(error) raise CyclicDependencyError, "Your Gemfile includes gems #{gemstr}" \ " that each depend on other, so it's not possible to to install this" \ " bundle. Remove one of the gems from your Gemfile to continue." end end + def extract_circular_gems(error) + if Bundler.current_ruby.mri? && Bundler.current_ruby.on_19? + error.message.scan(/(\w+) \([^)]/).flatten.join(" and ") + else + error.message.scan(/@name="(.*?)"/).flatten.join(" and ") + end + end + def lookup @lookup ||= begin lookup = Hash.new { |h,k| h[k] = [] } |