diff options
Diffstat (limited to 'lib/bundler/cli/clean.rb')
| -rw-r--r-- | lib/bundler/cli/clean.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb index 5eba09c6bc..c6b0968e3e 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 @@ -12,15 +13,13 @@ module Bundler Bundler.load.clean(options[:"dry-run"]) end - protected + 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 |
