Permalink
Browse files

example: use taskSpawn

  • Loading branch information...
1 parent cc6f2ad commit 50f8eb7a2141005d13b94e3f7f67620e994556c7 Russell Haering committed Dec 13, 2011
Showing with 10 additions and 34 deletions.
  1. +10 −34 example/stacks/tapkick.js
@@ -8,48 +8,24 @@ var misc = require('util/misc');
var sprintf = require('util/sprintf');
var git = require('util/git');
-function execute(baton, args, cmd, opts, msg, callback) {
- cmdStr = cmd.join(' ');
- baton.log.info(cmd)
- if (args.dryrun) {
- baton.log.infof('dry run, skipping command: ${cmd}', {
- cmd: cmdStr
- });
- callback();
- return;
- }
-
- baton.log.infof('executing command: ${cmd}', {
- cmd: cmdStr
- });
-
- misc.spawn(cmd, opts, function(err, stdout) {
- if (err) {
- baton.log.error('error executing command', {
- cmd: cmdStr,
- err: err,
- stdout: stdout
- })
- } else {
- baton.log.info(msg, {
- cmd: cmdStr,
- stdout: stdout
- })
- }
- callback(err);
- });
-};
exports.get_deployedRevision = function(args, callback) {
git.revParse(this.config.tapkick_dir, 'HEAD', function(err, stdout) {
callback(null, stdout);
});
};
+
exports.task_deploy = function(stack, baton, args, callback) {
- cmd = ['git', 'pull', 'origin', 'master']
- opts = { cwd: stack.config.tapkick_dir, env: process.env }
- execute(baton, args, cmd, opts, 'run git pull', callback);
+ var cmd = ['git', 'pull', 'origin', 'master'],
+ opts = {cwd: stack.config.tapkick_dir, env: process.env};
+
+ misc.taskSpawn(baton, args, cmd, opts, function(err, stdout) {
+ if (!err) {
+ baton.log.info('ran git pull');
+ }
+ callback(err);
+ });
};
exports.targets = {

0 comments on commit 50f8eb7

Please sign in to comment.