summaryrefslogtreecommitdiff
path: root/lib/bundler/spec_set.rb
diff options
context:
space:
mode:
authorHemant Kumar <gethemant@gmail.com>2013-07-26 10:33:40 +0530
committerHemant Kumar <gethemant@gmail.com>2013-07-26 10:33:40 +0530
commitde6e1d57606ad40a3aaabf6a67b2839472f87d28 (patch)
tree2b3a5bf10e02fb461c8958e48b6578d307b673c6 /lib/bundler/spec_set.rb
parent896d954c7733052610514a1b582a78cc1eb05d57 (diff)
downloadbundler-de6e1d57606ad40a3aaabf6a67b2839472f87d28.tar.gz
Extract error message from TSort::Cyclic and print
Also updated test case to include check on error message
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r--lib/bundler/spec_set.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index 74c9dde41e..41f46dba56 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -111,9 +111,10 @@ module Bundler
rake = @specs.find { |s| s.name == 'rake' }
begin
@sorted ||= ([rake] + tsort).compact.uniq
- rescue TSort::Cyclic
- raise CyclicDependencyError, "Unfortunately, your Gemfile contains gems" \
- " that each depend on each other, so it's not possible to to install this " \
+ rescue TSort::Cyclic => error
+ gemstr = error.message.scan(/@name="(.*?)"/).flatten.join(" and ")
+ 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