Method: Thor::Actions#remove_file
- Defined in:
- lib/thor/actions/file_manipulation.rb
permalink #remove_file(path, config = {}) ⇒ Object Also known as: remove_dir
Removes a file at the given location.
Parameters
- path<String>
-
path of the file to be changed
- config<Hash>
-
give :verbose => false to not log the status.
Example
remove_file 'README'
remove_file 'app/controllers/application_controller.rb'
325 326 327 328 329 330 331 332 333 334 |
# File 'lib/thor/actions/file_manipulation.rb', line 325 def remove_file(path, config = {}) return unless behavior == :invoke path = File.(path, destination_root) say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) if ![:pretend] && (File.exist?(path) || File.symlink?(path)) require "fileutils" ::FileUtils.rm_rf(path) end end |