abstract class Novika::Capabilities::IDisk

Included Modules

Extended Modules

Direct Known Subclasses

Defined in:

novika/capabilities/disk.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from module Novika::ICapability

capabilities : CapabilityCollection capabilities, inject(into target : Block) inject

Constructor methods inherited from module Novika::ICapability

new(capabilities) new

Class Method Detail

def self.id : String #

def self.on_by_default? : Bool #

def self.purpose : String #

Instance Method Detail

abstract def can_read?(engine, path : Quote) : Boolean #

Returns whether path exists and is readable.


abstract def copy(engine, src : Quote, dst : Quote) : Bool #

Copies source src (quote path to a file, symlink, or directory) to destination dst (also a quote).

If src is a directory, copies it recursively.

Returns whether the operation was successful.


abstract def dir_empty?(engine, path : Quote) : Boolean | Nil #

Returns whether directory pointed to by path is empty. Returns nil if path does not point to a directory, or if path does not exist.


abstract def has?(engine, path : Quote) : Boolean #

Returns whether path exists.


abstract def has_dir?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a directory.


abstract def has_file?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a file.


abstract def has_symlink?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a symlink.


abstract def home(engine) : Quote #

Returns current user's home directory.


def inject(into target : Block) #
Description copied from module Novika::ICapability

Injects the vocabulary of this capability into the target block.


abstract def join(engine, base : Quote, child : Quote) : Quote #

Returns path quote which is the result of joining base path and child path quotes using the platform-specific path separator.


abstract def mkdir(engine, path : Quote) #

Creates an empty directory at path, including any non-existing intermediate directories. Does nothing if path already exists.


abstract def pwd(engine) : Quote #

Returns the working directory.


abstract def read?(engine, path : Quote) : Quote | Nil #

Reads and returns the contents of file at path. Returns nil if there is no file at path.


abstract def touch(engine, path : Quote) #

Creates an empty file at path. Does nothing if path already exists.


abstract def write?(engine, content : Quote, path : Quote) : Bool #

(Over)writes content of file at path with content quote. Returns nil if path doesn't exist or doesn't point to a file.


abstract def write?(engine, content : Byteslice, path : Quote) : Bool #

(Over)writes content of file at path with content byteslice. Returns nil if path doesn't exist or doesn't point to a file.