class Textigniter::Scrub
The Scrub
Class deletes the textigniter environment leaving intact any files and folders that you have added at the base level. It will remove any files that you have added to the public_html folder so be sure to back those up.
Public Class Methods
new(args)
click to toggle source
# File lib/textigniter/scrub.rb, line 6 def initialize(args) # Output start message STDOUT.puts "Scrubbing textigniter environment".yellow_on_black end
Public Instance Methods
scrub()
click to toggle source
Scrub
the directory
# File lib/textigniter/scrub.rb, line 12 def scrub # Scrub the directory, no turning back scrub_directory("#{$twd}") scrub_directory("#{$base_path}/plugins") scrub_directory("#{$owd}") # Files to delete as well files = [ "#{$base_path}/README.textile", "#{$base_path}/config.yml" ] # Remove files specified FileUtils.rm files, :force => true # Output success message puts "Textigniter enivorment has been scrubbed ".yellow_on_black + "[OK]".green_on_black end
scrub_directory(directory=nil)
click to toggle source
Recursively remove directory and contents
# File lib/textigniter/scrub.rb, line 26 def scrub_directory(directory=nil) begin # remove the files and directories Find.find(directory) do |path| FileUtils.remove_dir(path, true) Find.prune end rescue end end