Class: Net::SFTP::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/depengine/publisher/dweb.rb

Overview

rubocop:disable Style/ClassAndModuleChildren

Instance Method Summary collapse

Instance Method Details

#rm_r!(path, options = {}) ⇒ Object



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/depengine/publisher/dweb.rb', line 209

def rm_r!(path, options = {})
  @rm_depth = 0 if @rm_depth.nil?
  dir.entries(path).each do |entry|

    next if entry.name == '.' or entry.name == '..'

    child_path = File.join(path, entry.name)

    if self.lstat!(child_path).directory?

      @rm_depth = @rm_depth + 1
      self.rm_r!(child_path)
      @rm_depth = @rm_depth - 1
    else
      self.remove!(child_path)
    end
  end

  self.rmdir!(path) if @rm_depth != 0 or options[:delete_root]
end