Permalink
Browse files

addded option for number of instances of an app to run to the stage c…

…ommand
  • Loading branch information...
maleck13 committed Mar 14, 2012
1 parent acee17b commit e3786231ede2d1785831bef086a3d0684ab226d7
Showing with 18 additions and 7 deletions.
  1. +1 −0 .gitignore
  2. +17 −7 lib/stage.js
View
@@ -7,3 +7,4 @@ node_modules/
.project
fhc-debug.log
TAGS
+.idea/
View
@@ -2,7 +2,8 @@
module.exports = stage;
stage.usage = "\nfhc stage <appId> "
- + "\nfhc stage <appId> --live "
+ + "\nfhc stage <appId> --live "
+ +"\nfhc stage <appId> [number_of_instances] --live"
+ "\nStage is made to Live environment if the '--live' flag is used";
var log = require("./utils/log");
@@ -15,22 +16,29 @@ var ini = require('./utils/ini');
// main stage entry point
function stage (args, cb) {
- if(args.length > 3 || args.length == 0) return unknown("stage", cb);
+ if(args.length > 4 || args.length == 0) return unknown("stage", cb);
var clean = ini.get('clean');
var target = ini.get('live') ? 'live' : 'development';
- if (args[1]) target = args[1];
+ var numinstances = 1;
+ args.forEach(function (index,val) {
+ console.log(index + " "+val);
+ });
+ if (args[1] === "live" || args[1] === "develop") target = args[1];
+ else if(Number(args[1])) numinstances = Number(args[1]);
if (args[2]) clean = args[2] === 'clean';
+ if (args[3]) clean = args[3] === 'clean';
+ console.log(target);
- doStage(fhc.appId(args[0]), target, clean, cb);
+ doStage(fhc.appId(args[0]), target, clean, numinstances, cb);
};
function unknown (action, cb) {
cb("Wrong arguments for or unknown action: " + action + "\nUsage:\n" + stage.usage);
};
// do our staging..
-function doStage(app, target, clean, cb) {
+function doStage(app, target, clean, numinstances, cb) {
var type = 'stage';
log.verbose(target, 'Staging Target');
@@ -40,9 +48,11 @@ function doStage(app, target, clean, cb) {
// constuct uri and payload
var uri = "box/srv/1.1/ide/" + fhc.domain + "/app/" + type;
- var payload = {payload:{guid: app, clean: clean}};
-
+ var payload = {payload:{guid: app, clean: clean, 'numappinstances':numinstances}};
+
+ console.log(payload);
// finally do our call
+ ;
common.doApiCall(fhreq.getFeedHenryUrl(), uri, payload, "Error staging app: ", function(err, data) {
if (err) return cb(err);
async.map([data.cacheKey], common.waitFor, function(err, results) {

0 comments on commit e378623

Please sign in to comment.