Skip to content
Myr

deploy

This file

Path

examples/deploy

45 lines · 1.2 KiB

Last changed by

fixed ordering againTJ Holowaychukbefore adoption8f2a305

History of this file

Take it

Initial commitTj Holowaychukbefore adoption672c7d0

lines 1–15
1#!/usr/bin/env node
23/**4 * Module dependencies.5 */67var program = require('../');89program10 .version('0.0.1')11 .option('-C, --chdir <path>', 'change the working directory')12 .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')13 .option('-T, --no-tests', 'ignore test hook')1415program

optional descriptionsTj Holowaychukbefore adoption3636e5e

lines 16–17why, one step back
16 .command('setup [env]')
17 .description('run setup commands for all envs')

Add options for subcommandsItay Neemanbefore adoption2454486

lines 18–20why, one step back
18 .option("-s, --setup_mode [mode]", "Which setup mode to use")
19 .action(function(env, options){20 var mode = options.setup_mode || "normal";

optional descriptionsTj Holowaychukbefore adoption3636e5e

line 21why, one step back
21 env = env || 'all';

Add options for subcommandsItay Neemanbefore adoption2454486

line 22why, one step back
22 console.log('setup for %s env(s) with %s mode', env, mode);

Initial commitTj Holowaychukbefore adoption672c7d0

lines 23–26
23 });
2425program26 .command('exec <cmd>')

optional descriptionsTj Holowaychukbefore adoption3636e5e

line 27why, one step back
27 .description('execute the given remote cmd')

Add options for subcommandsItay Neemanbefore adoption2454486

lines 28–30why, one step back
28 .option("-e, --exec_mode <mode>", "Which exec mode to use")
29 .action(function(cmd, options){30 console.log('exec "%s" using %s mode', cmd, options.exec_mode);

merged / tweakedTJ Holowaychukbefore adoption6ccb639

lines 31–32why, one step back
31 }).on('--help', function() {
32 console.log(' Examples:');

fixed ordering againTJ Holowaychukbefore adoption8f2a305

line 33why, one step back
33 console.log();

merged / tweakedTJ Holowaychukbefore adoption6ccb639

lines 34–35why, one step back
34 console.log(' $ deploy exec sequential');
35 console.log(' $ deploy exec async');

fixed ordering againTJ Holowaychukbefore adoption8f2a305

line 36why, one step back
36 console.log();

Initial commitTj Holowaychukbefore adoption672c7d0

lines 37–45
37 });
3839program40 .command('*')41 .action(function(env){42 console.log('deploying "%s"', env);43 });4445program.parse(process.argv);