aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2012-05-25 01:19:40 -0500
committerTerence Lee <hone02@gmail.com>2012-05-25 01:35:22 -0500
commitfe86387130d7b809f15d0f344a8e9ac7f6ad86e0 (patch)
tree5a32dcee5391403f91bb86ef49b34778dbfeb880 /bin
parentf96d7e75121563bf2a3a45db9d4d9d775ab0be56 (diff)
downloadbundler-fe86387130d7b809f15d0f344a8e9ac7f6ad86e0.tar.gz
extract rescue logic in bin/bundle
paired with @wycats
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bundle36
1 files changed, 9 insertions, 27 deletions
diff --git a/bin/bundle b/bin/bundle
index 2c92e2b7..323fe795 100755
--- a/bin/bundle
+++ b/bin/bundle
@@ -1,31 +1,13 @@
#!/usr/bin/env ruby
require 'bundler'
-begin
- # Check if an older version of bundler is installed
- $:.each do |path|
- if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
- err = "Please remove Bundler 0.8 versions."
- err << "This can be done by running `gem cleanup bundler`."
- abort(err)
- end
+# Check if an older version of bundler is installed
+$:.each do |path|
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
+ err = "Please remove Bundler 0.8 versions."
+ err << "This can be done by running `gem cleanup bundler`."
+ abort(err)
end
- require 'bundler/cli'
- Bundler::CLI.start
-rescue Bundler::BundlerError => e
- Bundler.ui.error e.message
- Bundler.ui.debug e.backtrace.join("\n")
- exit e.status_code
-rescue Interrupt => e
- Bundler.ui.error "\nQuitting..."
- Bundler.ui.debug e.backtrace.join("\n")
- exit 1
-rescue SystemExit => e
- exit e.status
-rescue Exception => e
- Bundler.ui.error "Unfortunately, a fatal error has occurred. " +
- "Please report this error to the Bundler issue tracker at " +
- "https://github.com/carlhuda/bundler/issues so that we can fix it. " +
- "Please include the full output of the command, your Gemfile and Gemfile.lock. " +
- "Thanks!"
- raise e
end
+require 'bundler/cli'
+require 'bundler/friendly_errors'
+Bundler.with_friendly_errors {Bundler::CLI.start }