Class: VagrantPlugins::Unison::CommandCleanup

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-unison2/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



120
121
122
# File 'lib/vagrant-unison2/command.rb', line 120

def self.synopsis
  "remove all unison supporting state on local and remote system"
end

Instance Method Details

#executeObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/vagrant-unison2/command.rb', line 124

def execute
  with_target_vms do |machine|
    guest_path = UnisonPaths.new(@env, machine).guest

    command = "rm -rf ~/Library/'Application Support'/Unison/*"
    @env.ui.info "Running #{command} on host"
    system(command)

    command = "rm -rf #{guest_path}/* #{guest_path}/..?* #{guest_path}/.[!.]*"
    @env.ui.info "Running #{command} on guest VM (delete all files from directory including hidden ones)"
    machine.communicate.sudo(command)

    command = "rm -rf ~/.unison"
    @env.ui.info "Running #{command} on guest VM"
    machine.communicate.execute(command)
  end

  0
end