-
Notifications
You must be signed in to change notification settings - Fork 15
File operations
Pake includes various utulities for common operations. Here are they:
Checks if $path directory exists, and if it doesn’t, creates $path directory recursively. You don’t need to do additional file_exists() or is_dir() calls. Just call pake_mkdirs(“foo/bar/baz”) and everything will be done automatically
Again, Pake will do all required checks and will even create target directory for you, if it doesn’t exist. By default, pake will only copy file if $origin_file is newer than $target_file. You can override it by giving array(‘override’ => true) as the last parameter.
Renames file specified as the first parameter to the name specified by the second parameter.
Copies all files and directories which correspond to the $arg rule from $origin_dir to $target_dir. Options parameter is forwarded to pake_copy(), which is used internally.
Deletes all files and directories which correspond to the $arg rule from $target_dir
Updates “modified time” of files, which correspond to the $arg rule in $target_dir
TODO
TODO
Creates symlink from $origin_dir to $target_dir. if $copy_on_windows is set to TRUE, then pake_mirror() will be used, in case when symlink functionality is not supported by OS.
Applies new POSIX mode to files found by $arg rule in $target_dir. Notice: it is not safe to rely on umask in multithreaded environment.
Parse all files found by $arg rule in $target_dir and, if those are php-files, removes comments from them.
Executes shell-command. STDOUT is not shown, but is returned instead. STDERR still goes straight to the screen, which allows to show password-request dialogs, for example.
This function shows the question and then waits for input from the user. As soon as user presses Enter-key input is returned from this function. It works like this:
<?php
$age = pake_input("How old are you?");
pake_echo_comment('Your age is: '.$age);
?>
How old are you? [>] 18 # Your age is: 18
This is a standard mean for outputting progress information to the user. Resulting string is divided in 2 columns (each of those is left-aligned). It looks like this:
>> section action text goes here
Deliever commenting-message to the user (it will be yellow, if user’s terminal supports colors)
Deliever error-message to the user (it will be red and alarming, if user’s terminal supports colors)
This one just prints free-form message to the user (that is, if she want to see messages). No need to add “\n”
<?php
pake_echo("Hello!");
pake_echo("World!");
?>