Debian Codegraph @

lib/bundler/cli/clean.rb

raw
1 # frozen_string_literal: true
2
3 module Bundler
4 class CLI::Clean
5 attr_reader :options
6
7 def initialize(options)
8 @options = options
9 end
10
11 def run
12 require_path_or_force unless options[:"dry-run"]
13 Bundler.load.clean(options[:"dry-run"])
14 end
15
16 protected
17
18 def require_path_or_force
19 return unless Bundler.use_system_gems? && !options[:force]
20 raise InvalidOption, "Cleaning all the gems on your system is dangerous! " \
21 "If you're sure you want to remove every system gem not in this " \
22 "bundle, run `bundle clean --force`."
23 end
24 end
25 end