Run optimize (#275)

* fixes #269

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update demo

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* refactor and comments

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update readme

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* updated and refactored

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update readme

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* trying to fix tests

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update documentation

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* update to config.mode = test

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* finaly everything works

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* 1.8.0

* update test

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>

* add test for run

Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
Varun Gupta
2018-06-08 23:43:41 +05:30
committed by Jeffrey Warren
parent a0f7e6c766
commit 10c6ad5865
13 changed files with 118 additions and 42 deletions

View File

@@ -115,11 +115,21 @@ ImageSequencer = function ImageSequencer(options) {
return this;
}
function run(spinnerObj,t_image,t_from) {
let progressObj;
if(arguments[0] != 'test'){
progressObj = spinnerObj
delete arguments['0']
// Config is an object which contains the runtime configuration like progress bar
// information and index from which the sequencer should run
function run(config,t_image,t_from) {
let progressObj,index=0;
config = config || {mode: 'no-arg'};
if(config.index) index = config.index;
if(config.mode != 'test'){
if(config.mode != "no-arg" && typeof config != 'function'){
if(config.progressObj) progressObj = config.progressObj;
delete arguments['0'];
}
}
else{
arguments['0'] = config.mode;
}
var this_ = (this.name == "ImageSequencer")?this:this.sequencer;
@@ -133,7 +143,7 @@ ImageSequencer = function ImageSequencer(options) {
var json_q = formatInput.call(this_,args,"r");
require('./Run')(this_, json_q, callback,progressObj);
require('./Run')(this_, json_q, callback,index,progressObj);
return true;
}
@@ -265,7 +275,7 @@ ImageSequencer = function ImageSequencer(options) {
function importString(str){
let sequencer = this;
if(this.name != "ImageSequencer")
sequencer = this.sequencer;
sequencer = this.sequencer;
var stepsFromString = stringToJSON(str);
stepsFromString.forEach(function eachStep(stepObj) {
sequencer.addSteps(stepObj.name,stepObj.options);
@@ -276,7 +286,7 @@ ImageSequencer = function ImageSequencer(options) {
function importJSON(obj){
let sequencer = this;
if(this.name != "ImageSequencer")
sequencer = this.sequencer;
sequencer = this.sequencer;
obj.forEach(function eachStep(stepObj) {
sequencer.addSteps(stepObj.name,stepObj.options);
});