require 'fileutils' def rmf_if_exist(path) FileUtils.rm_r(path, secure: true, verbose: true) if File.exist?(path) end desc 'Uninstall Capistrano, capup uninstall' task :uninstall do approot = Rake.original_dir||Dir.pwd rmf_if_exist File.join(approot, 'Capfile') rmf_if_exist File.join(approot, 'config/deploy.rb') rmf_if_exist File.join(approot, 'config/deploy') puts "Uninstall cap files" end