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 #

[View source]
def self.on_by_default? : Bool #

[View source]
def self.purpose : String #

[View source]

Instance Method Detail

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

Returns whether path exists and is readable.


[View source]
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.


[View source]
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.


[View source]
abstract def has?(engine, path : Quote) : Boolean #

Returns whether path exists.


[View source]
abstract def has_dir?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a directory.


[View source]
abstract def has_file?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a file.


[View source]
abstract def has_symlink?(engine, path : Quote) : Boolean #

Returns whether path exists and points to a symlink.


[View source]
abstract def home(engine) : Quote #

Returns current user's home directory.


[View source]
def inject(into target : Block) #
Description copied from module Novika::ICapability

Injects the vocabulary of this capability into the target block.


[View source]
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.


[View source]
abstract def mkdir(engine, path : Quote) #

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


[View source]
abstract def pwd(engine) : Quote #

Returns the working directory.


[View source]
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.


[View source]
abstract def touch(engine, path : Quote) #

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


[View source]
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.


[View source]
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.


[View source]