class Novika::Capabilities::Impl::Disk
- Novika::Capabilities::Impl::Disk
- Novika::Capabilities::IDisk
- Reference
- Object
Defined in:
novika/capabilities/impl/disk.crInstance Method Summary
-
#can_read?(engine, path : Quote) : Boolean
Returns whether path exists and is readable.
-
#copy(engine, src : Quote, dst : Quote) : Bool
Copies source src (quote path to a file, symlink, or directory) to destination dst (also a quote).
-
#dir_empty?(engine, path : Quote) : Boolean | Nil
Returns whether directory pointed to by path is empty.
-
#has?(engine, path : Quote) : Boolean
Returns whether path exists.
-
#has_dir?(engine, path : Quote) : Boolean
Returns whether path exists and points to a directory.
-
#has_file?(engine, path : Quote) : Boolean
Returns whether path exists and points to a file.
-
#has_symlink?(engine, path : Quote) : Boolean
Returns whether path exists and points to a symlink.
-
#home(engine) : Quote
Returns current user's home directory.
-
#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.
-
#mkdir(engine, path : Quote)
Creates an empty directory at path, including any non-existing intermediate directories.
-
#pwd(engine) : Quote
Returns the working directory.
-
#read?(engine, path : Quote) : Quote | Nil
Reads and returns the contents of file at path.
-
#touch(engine, path : Quote)
Creates an empty file at path.
-
#write?(engine, content : Quote, path : Quote) : Bool
(Over)writes content of file at path with content quote.
-
#write?(engine, content : Byteslice, path : Quote) : Bool
(Over)writes content of file at path with content byteslice.
Instance methods inherited from class Novika::Capabilities::IDisk
can_read?(engine, path : Quote) : Boolean
can_read?,
copy(engine, src : Quote, dst : Quote) : Bool
copy,
dir_empty?(engine, path : Quote) : Boolean | Nil
dir_empty?,
has?(engine, path : Quote) : Boolean
has?,
has_dir?(engine, path : Quote) : Boolean
has_dir?,
has_file?(engine, path : Quote) : Boolean
has_file?,
has_symlink?(engine, path : Quote) : Boolean
has_symlink?,
home(engine) : Quote
home,
inject(into target : Block)
inject,
join(engine, base : Quote, child : Quote) : Quote
join,
mkdir(engine, path : Quote)
mkdir,
pwd(engine) : Quote
pwd,
read?(engine, path : Quote) : Quote | Nil
read?,
touch(engine, path : Quote)
touch,
write?(engine, content : Quote, path : Quote) : Boolwrite?(engine, content : Byteslice, path : Quote) : Bool write?
Class methods inherited from class Novika::Capabilities::IDisk
id : String
id,
on_by_default? : Bool
on_by_default?,
purpose : String
purpose
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
Instance Method Detail
Returns whether path exists and is readable.
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.
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.
Returns whether path exists and points to a directory.
Returns whether path exists and points to a file.
Returns whether path exists and points to a symlink.
Returns path quote which is the result of joining base path and child path quotes using the platform-specific path separator.
Creates an empty directory at path, including any non-existing intermediate directories. Does nothing if path already exists.
Reads and returns the contents of file at path. Returns nil if there is no file at path.
Creates an empty file at path. Does nothing if path already exists.
(Over)writes content of file at path with content quote. Returns nil if path doesn't exist or doesn't point to a file.
(Over)writes content of file at path with content byteslice. Returns nil if path doesn't exist or doesn't point to a file.