Class: VimPK::Commands::Remove
- Inherits:
-
Object
- Object
- VimPK::Commands::Remove
- Defined in:
- lib/vimpk/commands/remove.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name, options) ⇒ Remove
constructor
A new instance of Remove.
Constructor Details
#initialize(name, options) ⇒ Remove
Returns a new instance of Remove.
6 7 8 9 |
# File 'lib/vimpk/commands/remove.rb', line 6 def initialize(name, ) @name = name || raise(ArgumentError, "Package name is required") @path = .path end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vimpk/commands/remove.rb', line 11 def call glob = Dir.glob(File.join(@path, "*", "{start,opt}", @name)) if glob.empty? raise PackageNotFoundError, "Package #{@name} not found in #{@path}." else glob.each do |dir| FileUtils.rm_rf(dir) end end end |