Class: Brute::Tools::FSRemove
Instance Method Summary
collapse
Methods inherited from Brute::Tool
#call, description, #description, param, param_definitions, params, #params, #params_schema
Instance Method Details
#execute(path:) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/brute/tools/fs_remove.rb', line 17
def execute(path:)
target = File.expand_path(path)
Brute::Tools::FS::FileMutationQueue.serialize(target) do
raise "Path not found: #{target}" unless File.exist?(target)
Brute::Tools::FS::SnapshotStore.save(target) if File.file?(target)
if File.directory?(target)
Dir.rmdir(target)
else
File.delete(target)
end
{success: true, path: target}
end
end
|
#name ⇒ Object
15
|
# File 'lib/brute/tools/fs_remove.rb', line 15
def name; "remove"; end
|