aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/cli/clean.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/clean.rb')
-rw-r--r--lib/bundler/cli/clean.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb
index 5eba09c6bc..4a407fbae7 100644
--- a/lib/bundler/cli/clean.rb
+++ b/lib/bundler/cli/clean.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Clean
attr_reader :options
@@ -15,12 +16,10 @@ module Bundler
protected
def require_path_or_force
- if !Bundler.settings[:path] && !options[:force]
- Bundler.ui.error "Cleaning all the gems on your system is dangerous! " \
- "If you're sure you want to remove every system gem not in this " \
- "bundle, run `bundle clean --force`."
- exit 1
- end
+ return unless Bundler.use_system_gems? && !options[:force]
+ raise InvalidOption, "Cleaning all the gems on your system is dangerous! " \
+ "If you're sure you want to remove every system gem not in this " \
+ "bundle, run `bundle clean --force`."
end
end
end