Sha256: 39d3fedc348f4f23283a7b0adf9c3179e47f0e67f04668c6c11009a1cb993213

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

class DevSystem::DirShell < DevSystem::FileShell

  # OVERRIDES

  def self.exist? path
    log :normal, "Checking if directory exists at '#{path}'"

    directory? path
  end

  def self.size path
    log :normal, "Getting size of directory at '#{path}'"
    _raise_if_not_exists path

    Pathname.new(path).children.inject(0) { |sum, f| sum + f.size }
  end

  # CUSTOM

  def self.create path
    log :normal, "Creating directory at '#{path}'"
    _raise_if_blank path

    Pathname.new(path).mkpath
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lizarb-1.0.4 lib/dev_system/dev/controllers/shell/dir_shell.rb
lizarb-1.0.3 lib/dev_system/dev/controllers/shell/dir_shell.rb
lizarb-1.0.2 lib/dev_system/dev/controllers/shell/dir_shell.rb