a poorly drawn pomander...

Pomander

Pomander is all about tasks. We've included tasks for managing application deployments, and basic database backup and merging.


config            # Create development environment configuration
db:backup         # Perform a backup suited for merging.
db:create         # Create database.
db:destroy        # Wipe database.
db:full           # Perform a full database backup.
db:merge          # Merge a backup into environment.
deploy:cold       # First time deployment.
deploy:setup      # Setup application in environment.
deploy:update     # Update code to latest changes.
init              # Set it up
rollback          # Rollback to previous release
	

You can define new tasks, add to existing tasks, or even run tasks before or after another task.

Any defined task can be invoked from the command line.

Pomander's task system is built on top of Phake.

Defining Tasks

Provide a task name, and a callback function. The task name is how you invoke the task, and the callback can be anything that is_callable.


desc("My first task");
task('the_task_name', function($app) {
  info('the_task_name', 'I am running!');
  if(!$app->super_secret_setting)
    warn('secret', 'You forgot to set the super secret setting..');
});
	

Every task is passed $app. Use $app->env to get to the current environment, and use $app['KEY'] to access any defined command line variables.

Call desc("") just before your task definition to attach a description to it. pom -T will only show tasks that have a description.

Task Dependencies

The first string in the task method will always define the name of the task.


task('sass', function($app) {
  exec_cmd("sass stylesheets/sass:stylesheets/compiled");
});

task('coffee', function($app) {
  exec_cmd("coffee --compile --output lib/ src/");
});

desc("Compile application assets");
task('assets', 'sass', 'coffee', function($app) {
  info("assets", "compiled!");
});
	

Subsequent strings passed before the callable block are dependency tasks that are run before the main task can run.

Groups

Wrap some tasks in a group to... group tasks.


group('files', function() {
  task('sync', function($app) {   // invoked with files:sync
    info("files", "uploading files");
    put("./files/", "{$app->env->shared_dir}/files");
  });

  task('backup', function($app) { // invoked with files:backup
    info("files", "backing them up");
    get("{$app->env->shared_dir}/files/", "./files/");
  });
});
	

Group tasks are invoked by group_name:task_name.

After/Before Blocks

They look just like the task method, but they will run before/after the task you specify.


after('deploy:update', function($app) {
  info("deploy", "All done!");
});

before('db:backup', function($app) {
  if(!$app->env->db)
    abort("backup", "Please add database settings first.");
});

// $ pom db:backup
//  * abort backup Please add database settings first.
//
//
// $ pom deploy:update
//  * info deploy Deploying code..
//  * info deploy All done!
	

Helper Methods