Built motion from commit 4c579f6b.|2.5.32
[motion2.git] / server / api / version / version.controller.js
index 6e2c0b2..c2af2d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1fa=['status','origin','master','error','json','git\x20fetch','reset','--hard','FETCH_HEAD','info','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','replace','.js','length','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','version','../../config/pm2','root','exports','query','latest','fetch','tags','2.0.0'];(function(_0x5488de,_0x2fc798){var _0x215bf5=function(_0x377cd7){while(--_0x377cd7){_0x5488de['push'](_0x5488de['shift']());}};_0x215bf5(++_0x2fc798);}(_0xb1fa,0x9e));var _0xab1f=function(_0x427a46,_0x1428e4){_0x427a46=_0x427a46-0x0;var _0x5d6331=_0xb1fa[_0x427a46];return _0x5d6331;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xab1f('0x0'));var pkginfo=require('pkginfo')(module,_0xab1f('0x1'));var compareVersions=require('compare-versions');var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xab1f('0x2'));var logger=require('../../config/logger')('update');var git=require('simple-git')(config[_0xab1f('0x3')]);exports['index']=function(_0x17e178,_0x2fbc7e){var _0x5213a4={'current':module[_0xab1f('0x4')]['version'],'phonebar':0x2};if(_0x17e178['query']&&_0x17e178[_0xab1f('0x5')][_0xab1f('0x6')]){return git[_0xab1f('0x7')]()[_0xab1f('0x8')](function(_0x3f0f7e,_0x5643e7){_0x5213a4[_0xab1f('0x6')]=(_0x3f0f7e?module['exports']['version']:_0x5643e7[_0xab1f('0x6')])||_0xab1f('0x9');return _0x2fbc7e['status'](0xc8)['json'](_0x5213a4);});}else{return _0x2fbc7e[_0xab1f('0xa')](0xc8)['json'](_0x5213a4);}};exports[_0xab1f('0x7')]=function(_0x53bb5b,_0x68b4e4){return git['fetch']([_0xab1f('0xb'),_0xab1f('0xc')],function(_0x27327c){if(_0x27327c){logger[_0xab1f('0xd')](_0x27327c);return _0x68b4e4['status'](0x1f4)[_0xab1f('0xe')](_0x27327c);}logger['info'](_0xab1f('0xf'));return _0x68b4e4[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xab1f('0x10')]=function(_0x44e80b,_0x558c52){return git[_0xab1f('0x10')]([_0xab1f('0x11'),_0xab1f('0x12')],function(_0x231ce7){if(_0x231ce7){logger[_0xab1f('0xd')](_0x231ce7);return _0x558c52['status'](0x1f4)[_0xab1f('0xe')](_0x231ce7);}logger[_0xab1f('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x558c52[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x3103e1,_0x3ce90b){exec(_0xab1f('0x14'),function(_0x425b61,_0x1bd51b,_0x2915b9){logger[_0xab1f('0x13')](_0x1bd51b);logger['info'](_0x2915b9);if(_0x425b61){logger[_0xab1f('0xd')](_0x425b61);return _0x3ce90b[_0xab1f('0xa')](0x1f4)[_0xab1f('0xe')](_0x425b61);}return _0x3ce90b[_0xab1f('0xa')](0xc8)['json']({'output':_0x1bd51b});});};exports[_0xab1f('0x15')]=function(_0x219f01,_0x4061fb){return pm2[_0xab1f('0x15')]('motion2')[_0xab1f('0x16')](function(_0x3d993d){logger[_0xab1f('0x13')](_0xab1f('0x17'),_0x3d993d);return _0x4061fb[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':_0xab1f('0x18')});})['catch'](function(_0x2216ca){logger['error'](_0x2216ca);return _0x4061fb[_0xab1f('0xa')](0x1f4)['json'](_0x2216ca);});};exports[_0xab1f('0x19')]=function(_0xf55a53,_0x2e9ac4){var _0x449e16=fs[_0xab1f('0x1a')](path[_0xab1f('0x1b')](config[_0xab1f('0x3')],_0xab1f('0x1c'),_0xab1f('0x19')));var _0x5d924b=[];for(var _0x355706=0x0;_0x355706<_0x449e16['length'];_0x355706++){var _0x1c1bce=_0x449e16[_0x355706][_0xab1f('0x1d')](_0xab1f('0x1e'),'');if(compareVersions(module[_0xab1f('0x4')][_0xab1f('0x1')],_0x1c1bce)===-0x1){_0x5d924b['push'](_0x1c1bce);}}if(_0x5d924b[_0xab1f('0x1f')]){var _0x3c11d7=_0x5d924b[_0xab1f('0x20')](compareVersions);var _0x5e1cf0=new Umzug({'storage':_0xab1f('0x21'),'storageOptions':{'model':db['Migration'],'modelName':_0xab1f('0x22'),'columnName':'version'},'migrations':{'params':[db[_0xab1f('0x21')]['getQueryInterface'](),db[_0xab1f('0x21')][_0xab1f('0x23')],function(){throw new Error(_0xab1f('0x24'));}],'path':path[_0xab1f('0x1b')](config['root'],'server',_0xab1f('0x19')),'pattern':/\.js$/}});_0x5e1cf0['up']({'migrations':_['map'](_0x3c11d7,function(_0x329d89){return _0x329d89+_0xab1f('0x1e');})})[_0xab1f('0x16')](function(){return _0x2e9ac4[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':_0xab1f('0x25')+module['exports'][_0xab1f('0x1')]+_0xab1f('0x26')+_['last'](_0x3c11d7),'migrations':_['join'](_0x3c11d7)});})[_0xab1f('0x27')](function(_0x454155){if(_0x454155 instanceof db[_0xab1f('0x21')][_0xab1f('0x28')]){return _0x2e9ac4[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2e9ac4[_0xab1f('0xa')](0x1f4)[_0xab1f('0xe')](_0x454155);}});}else{return _0x2e9ac4[_0xab1f('0xa')](0xc8)[_0xab1f('0xe')]({'output':_0xab1f('0x29')});}};
\ No newline at end of file
+var _0xa4c7=['.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','length','replace'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xa4c7,0x138));var _0x7a4c=function(_0x5c4334,_0xe2759a){_0x5c4334=_0x5c4334-0x0;var _0x2da25e=_0xa4c7[_0x5c4334];return _0x2da25e;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x7a4c('0x0'));var compareVersions=require('compare-versions');var exec=require(_0x7a4c('0x1'))['exec'];var db=require(_0x7a4c('0x2'))['db'];var config=require(_0x7a4c('0x3'));var pm2=require(_0x7a4c('0x4'));var logger=require(_0x7a4c('0x5'))(_0x7a4c('0x6'));var git=require(_0x7a4c('0x7'))(config[_0x7a4c('0x8')]);exports[_0x7a4c('0x9')]=function(_0x554448,_0x54101a){var _0x409c81={'current':module[_0x7a4c('0xa')][_0x7a4c('0x0')],'phonebar':0x2};if(_0x554448[_0x7a4c('0xb')]&&_0x554448[_0x7a4c('0xb')]['latest']){return git['fetch']()[_0x7a4c('0xc')](function(_0x201c8f,_0x20d7bc){_0x409c81[_0x7a4c('0xd')]=(_0x201c8f?module['exports'][_0x7a4c('0x0')]:_0x20d7bc[_0x7a4c('0xd')])||_0x7a4c('0xe');return _0x54101a[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')](_0x409c81);});}else{return _0x54101a[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')](_0x409c81);}};exports['fetch']=function(_0x50c4e3,_0x2bd8a9){return git[_0x7a4c('0x11')]([_0x7a4c('0x12'),_0x7a4c('0x13')],function(_0x325c37){if(_0x325c37){logger[_0x7a4c('0x14')](_0x325c37);return _0x2bd8a9[_0x7a4c('0xf')](0x1f4)[_0x7a4c('0x10')](_0x325c37);}logger[_0x7a4c('0x15')](_0x7a4c('0x16'));return _0x2bd8a9[_0x7a4c('0xf')](0xc8)['json']({'output':_0x7a4c('0x17')});});};exports[_0x7a4c('0x18')]=function(_0x5a3d3c,_0x55a942){return git[_0x7a4c('0x18')]([_0x7a4c('0x19'),'FETCH_HEAD'],function(_0x3c26da){if(_0x3c26da){logger[_0x7a4c('0x14')](_0x3c26da);return _0x55a942[_0x7a4c('0xf')](0x1f4)['json'](_0x3c26da);}logger[_0x7a4c('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x55a942[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')]({'output':_0x7a4c('0x1a')});});};exports[_0x7a4c('0x1b')]=function(_0x349ce1,_0x2c85b8){exec('npm\x20install\x20--production',function(_0x3c0450,_0x388af5,_0x209524){logger['info'](_0x388af5);logger[_0x7a4c('0x15')](_0x209524);if(_0x3c0450){logger['error'](_0x3c0450);return _0x2c85b8['status'](0x1f4)[_0x7a4c('0x10')](_0x3c0450);}return _0x2c85b8[_0x7a4c('0xf')](0xc8)['json']({'output':_0x388af5});});};exports[_0x7a4c('0x1c')]=function(_0x4a4db8,_0xe9b4d0){return pm2[_0x7a4c('0x1c')](_0x7a4c('0x1d'))[_0x7a4c('0x1e')](function(_0x12d3b8){logger[_0x7a4c('0x15')](_0x7a4c('0x1f'),_0x12d3b8);return _0xe9b4d0['status'](0xc8)[_0x7a4c('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7a4c('0x20')](function(_0x588bc6){logger[_0x7a4c('0x14')](_0x588bc6);return _0xe9b4d0['status'](0x1f4)['json'](_0x588bc6);});};exports[_0x7a4c('0x21')]=function(_0x304b49,_0x3aa98d){var _0x4019e5=fs['readdirSync'](path[_0x7a4c('0x22')](config[_0x7a4c('0x8')],_0x7a4c('0x23'),_0x7a4c('0x21')));var _0x30a4a3=[];for(var _0x5e886c=0x0;_0x5e886c<_0x4019e5[_0x7a4c('0x24')];_0x5e886c++){var _0x293363=_0x4019e5[_0x5e886c][_0x7a4c('0x25')](_0x7a4c('0x26'),'');if(compareVersions(module[_0x7a4c('0xa')]['version'],_0x293363)===-0x1){_0x30a4a3[_0x7a4c('0x27')](_0x293363);}}if(_0x30a4a3[_0x7a4c('0x24')]){var _0x2eccf1=_0x30a4a3[_0x7a4c('0x28')](compareVersions);var _0x243ac4=new Umzug({'storage':_0x7a4c('0x29'),'storageOptions':{'model':db[_0x7a4c('0x2a')],'modelName':_0x7a4c('0x2a'),'columnName':_0x7a4c('0x0')},'migrations':{'params':[db[_0x7a4c('0x29')][_0x7a4c('0x2b')](),db[_0x7a4c('0x29')][_0x7a4c('0x2c')],function(){throw new Error(_0x7a4c('0x2d'));}],'path':path[_0x7a4c('0x22')](config[_0x7a4c('0x8')],'server',_0x7a4c('0x21')),'pattern':/\.js$/}});_0x243ac4['up']({'migrations':_['map'](_0x2eccf1,function(_0x5bb0ce){return _0x5bb0ce+_0x7a4c('0x26');})})[_0x7a4c('0x1e')](function(){return _0x3aa98d[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')]({'output':_0x7a4c('0x2e')+module[_0x7a4c('0xa')][_0x7a4c('0x0')]+_0x7a4c('0x2f')+_['last'](_0x2eccf1),'migrations':_[_0x7a4c('0x22')](_0x2eccf1)});})[_0x7a4c('0x20')](function(_0x4cbf4f){if(_0x4cbf4f instanceof db[_0x7a4c('0x29')][_0x7a4c('0x30')]){return _0x3aa98d[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')]({'output':_0x7a4c('0x31')});}else{return _0x3aa98d[_0x7a4c('0xf')](0x1f4)['json'](_0x4cbf4f);}});}else{return _0x3aa98d[_0x7a4c('0xf')](0xc8)[_0x7a4c('0x10')]({'output':_0x7a4c('0x31')});}};
\ No newline at end of file