Class: Thor::Actions::EmptyDirectory

Inherits:
Object
  • Object
show all
Defined in:
lib/thor-ssh/actions/empty_directory.rb

Instance Method Summary collapse

Instance Method Details

#exists?Boolean

Checks if the directory exists on the detination server

Returns:

  • (Boolean)


5
6
7
# File 'lib/thor-ssh/actions/empty_directory.rb', line 5

def exists?
  @base.destination_files.exists?(destination)
end

#invoke!Object



9
10
11
12
13
# File 'lib/thor-ssh/actions/empty_directory.rb', line 9

def invoke!
  invoke_with_conflict_check do
    @base.destination_files.mkdir_p(destination)
  end
end

#revoke!Object



15
16
17
18
19
# File 'lib/thor-ssh/actions/empty_directory.rb', line 15

def revoke!
  say_status :remove, :red
  @base.destination_files.rm_rf(destination) if !pretend? && exists?
  given_destination
end