-
Notifications
You must be signed in to change notification settings - Fork 11
Reference task
kohkimakimoto edited this page Mar 13, 2013
·
8 revisions
task(string $name, [array $options,] callback $function)
Defines a new task.
-
name
-
options
-
function
host('192.168.0.11', "dev");
host('192.168.0.12', "dev");
host('192.168.0.13', "dev");
/**
* Deploy development application from git repository.
*/
desc('Deploy development applications.');
task('deploy',array('roles' => 'dev'), function($host, $args){
run('cd /var/applications/myapp; git pull;', array('user' => 'root'));
});
You can execute this task as the following command
$ altax deploy
Example for the callback function arguments (host, args)
task('deploy', function($host, $args){
if (count($args) < 1) {
echo "\n";
echo "You must pass 1 argument that is stage name for deployment [dev or prod].\n";
echo "\n";
return;
}
if ($args[0] == 'dev') {
// deploy code for development stage
} else if ($args[0] == 'prod') {
// deploy code for production stage
} else {
echo "\n";
echo "Unknown stage name.\n";
echo "\n";
return;
}
});
You can execute this task as the following command
$ altax deploy dev