Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / version / version.controller.js
index fea4045..28b0e5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe45a=['root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xe45a,0x19c));var _0xae45=function(_0x43d187,_0x5d7568){_0x43d187=_0x43d187-0x0;var _0x31db94=_0xe45a[_0x43d187];return _0x31db94;};'use strict';var Umzug=require(_0xae45('0x0'));var path=require(_0xae45('0x1'));var fs=require('fs');var _=require(_0xae45('0x2'));var pkginfo=require(_0xae45('0x3'))(module,_0xae45('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xae45('0x5'))[_0xae45('0x6')];var db=require(_0xae45('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xae45('0x8'));var logger=require(_0xae45('0x9'))(_0xae45('0xa'));var git=require(_0xae45('0xb'))(config[_0xae45('0xc')]);exports[_0xae45('0xd')]=function(_0x377e62,_0xc778b){var _0x225941={'current':module[_0xae45('0xe')]['version'],'phonebar':0x2};if(_0x377e62[_0xae45('0xf')]&&_0x377e62[_0xae45('0xf')]['latest']){return git[_0xae45('0x10')]()[_0xae45('0x11')](function(_0x358bf0,_0x3e1828){_0x225941[_0xae45('0x12')]=(_0x358bf0?module[_0xae45('0xe')][_0xae45('0x4')]:_0x3e1828[_0xae45('0x12')])||_0xae45('0x13');return _0xc778b[_0xae45('0x14')](0xc8)[_0xae45('0x15')](_0x225941);});}else{return _0xc778b[_0xae45('0x14')](0xc8)['json'](_0x225941);}};exports['fetch']=function(_0x38c190,_0x2c0c5a){return git['fetch']([_0xae45('0x16'),_0xae45('0x17')],function(_0x2e400d){if(_0x2e400d){logger[_0xae45('0x18')](_0x2e400d);return _0x2c0c5a[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x2e400d);}logger[_0xae45('0x19')](_0xae45('0x1a'));return _0x2c0c5a[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x1b')});});};exports[_0xae45('0x1c')]=function(_0x3b4f2b,_0x3c26c2){return git[_0xae45('0x1c')](['--hard',_0xae45('0x1d')],function(_0x383df5){if(_0x383df5){logger['error'](_0x383df5);return _0x3c26c2[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x383df5);}logger['info'](_0xae45('0x1e'));return _0x3c26c2[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xae45('0x1f')]=function(_0x1c66f0,_0x37cde0){exec(_0xae45('0x20'),function(_0x23f4f8,_0x15b560,_0x1540fa){logger['info'](_0x15b560);logger[_0xae45('0x19')](_0x1540fa);if(_0x23f4f8){logger[_0xae45('0x18')](_0x23f4f8);return _0x37cde0[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x23f4f8);}return _0x37cde0[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0x15b560});});};exports[_0xae45('0x21')]=function(_0x41d951,_0x4e60f0){return pm2['restart']('motion2')['then'](function(_0x145be0){logger[_0xae45('0x19')]('pm2\x20restart\x20motion\x20%s',_0x145be0);return _0x4e60f0['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x22')});})[_0xae45('0x23')](function(_0x242bbb){logger['error'](_0x242bbb);return _0x4e60f0[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x242bbb);});};exports['migrations']=function(_0x2bd985,_0x18a08f){var _0x26ffa0=fs[_0xae45('0x24')](path[_0xae45('0x25')](config[_0xae45('0xc')],_0xae45('0x26'),'migrations'));var _0x5b9ea2=[];for(var _0x2ce848=0x0;_0x2ce848<_0x26ffa0[_0xae45('0x27')];_0x2ce848++){var _0x3c7a5d=_0x26ffa0[_0x2ce848][_0xae45('0x28')](_0xae45('0x29'),'');if(compareVersions(module[_0xae45('0xe')]['version'],_0x3c7a5d)===-0x1){_0x5b9ea2[_0xae45('0x2a')](_0x3c7a5d);}}if(_0x5b9ea2[_0xae45('0x27')]){var _0x35de72=_0x5b9ea2['sort'](compareVersions);var _0x404cfc=new Umzug({'storage':_0xae45('0x2b'),'storageOptions':{'model':db[_0xae45('0x2c')],'modelName':_0xae45('0x2c'),'columnName':_0xae45('0x4')},'migrations':{'params':[db['sequelize'][_0xae45('0x2d')](),db[_0xae45('0x2b')]['constructor'],function(){throw new Error(_0xae45('0x2e'));}],'path':path[_0xae45('0x25')](config[_0xae45('0xc')],_0xae45('0x26'),_0xae45('0x2f')),'pattern':/\.js$/}});_0x404cfc['up']({'migrations':_['map'](_0x35de72,function(_0x56c9e9){return _0x56c9e9+_0xae45('0x29');})})[_0xae45('0x30')](function(){return _0x18a08f['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x31')+module[_0xae45('0xe')][_0xae45('0x4')]+'\x20to\x20'+_[_0xae45('0x32')](_0x35de72),'migrations':_[_0xae45('0x25')](_0x35de72)});})[_0xae45('0x23')](function(_0x50e8d6){if(_0x50e8d6 instanceof db['sequelize'][_0xae45('0x33')]){return _0x18a08f[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x34')});}else{return _0x18a08f['status'](0x1f4)[_0xae45('0x15')](_0x50e8d6);}});}else{return _0x18a08f['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x34')});}};
\ No newline at end of file
+var _0xa190=['Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','push','sequelize'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xa190,0x19b));var _0x0a19=function(_0x23f693,_0x51d5fb){_0x23f693=_0x23f693-0x0;var _0x1a2228=_0xa190[_0x23f693];return _0x1a2228;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x0a19('0x0'));var pkginfo=require(_0x0a19('0x1'))(module,'version');var compareVersions=require(_0x0a19('0x2'));var exec=require(_0x0a19('0x3'))['exec'];var db=require(_0x0a19('0x4'))['db'];var config=require(_0x0a19('0x5'));var pm2=require(_0x0a19('0x6'));var logger=require(_0x0a19('0x7'))(_0x0a19('0x8'));var git=require(_0x0a19('0x9'))(config[_0x0a19('0xa')]);exports['index']=function(_0xa053ff,_0x25d188){var _0x535683={'current':module[_0x0a19('0xb')][_0x0a19('0xc')],'phonebar':0x2};if(_0xa053ff[_0x0a19('0xd')]&&_0xa053ff[_0x0a19('0xd')][_0x0a19('0xe')]){return git[_0x0a19('0xf')]()[_0x0a19('0x10')](function(_0x782b5a,_0xdc31aa){_0x535683[_0x0a19('0xe')]=(_0x782b5a?module['exports']['version']:_0xdc31aa[_0x0a19('0xe')])||'2.0.0';return _0x25d188[_0x0a19('0x11')](0xc8)['json'](_0x535683);});}else{return _0x25d188['status'](0xc8)[_0x0a19('0x12')](_0x535683);}};exports[_0x0a19('0xf')]=function(_0x41db13,_0x2d5c32){return git[_0x0a19('0xf')](['origin',_0x0a19('0x13')],function(_0x2a4c9e){if(_0x2a4c9e){logger[_0x0a19('0x14')](_0x2a4c9e);return _0x2d5c32[_0x0a19('0x11')](0x1f4)[_0x0a19('0x12')](_0x2a4c9e);}logger[_0x0a19('0x15')]('git\x20fetch');return _0x2d5c32['status'](0xc8)[_0x0a19('0x12')]({'output':_0x0a19('0x16')});});};exports[_0x0a19('0x17')]=function(_0x3a2a62,_0xd4adc1){return git[_0x0a19('0x17')]([_0x0a19('0x18'),'FETCH_HEAD'],function(_0x48a84f){if(_0x48a84f){logger[_0x0a19('0x14')](_0x48a84f);return _0xd4adc1[_0x0a19('0x11')](0x1f4)[_0x0a19('0x12')](_0x48a84f);}logger[_0x0a19('0x15')](_0x0a19('0x19'));return _0xd4adc1['status'](0xc8)[_0x0a19('0x12')]({'output':_0x0a19('0x1a')});});};exports['pull']=function(_0x1aa5ee,_0x289b3c){exec('npm\x20install\x20--production',function(_0x17900d,_0x19254f,_0x3a09dc){logger[_0x0a19('0x15')](_0x19254f);logger['info'](_0x3a09dc);if(_0x17900d){logger[_0x0a19('0x14')](_0x17900d);return _0x289b3c['status'](0x1f4)[_0x0a19('0x12')](_0x17900d);}return _0x289b3c['status'](0xc8)[_0x0a19('0x12')]({'output':_0x19254f});});};exports[_0x0a19('0x1b')]=function(_0x3ce4f8,_0x305991){return pm2[_0x0a19('0x1b')](_0x0a19('0x1c'))[_0x0a19('0x1d')](function(_0x3fb8f1){logger[_0x0a19('0x15')](_0x0a19('0x1e'),_0x3fb8f1);return _0x305991['status'](0xc8)[_0x0a19('0x12')]({'output':_0x0a19('0x1f')});})[_0x0a19('0x20')](function(_0x535049){logger[_0x0a19('0x14')](_0x535049);return _0x305991[_0x0a19('0x11')](0x1f4)[_0x0a19('0x12')](_0x535049);});};exports[_0x0a19('0x21')]=function(_0x23be89,_0xcff75b){var _0x2614de=fs['readdirSync'](path['join'](config[_0x0a19('0xa')],_0x0a19('0x22'),_0x0a19('0x21')));var _0x2f33b4=[];for(var _0xcb5228=0x0;_0xcb5228<_0x2614de[_0x0a19('0x23')];_0xcb5228++){var _0x433865=_0x2614de[_0xcb5228][_0x0a19('0x24')]('.js','');if(compareVersions(module[_0x0a19('0xb')][_0x0a19('0xc')],_0x433865)===-0x1){_0x2f33b4[_0x0a19('0x25')](_0x433865);}}if(_0x2f33b4[_0x0a19('0x23')]){var _0x33f2e4=_0x2f33b4['sort'](compareVersions);var _0x477ad2=new Umzug({'storage':_0x0a19('0x26'),'storageOptions':{'model':db[_0x0a19('0x27')],'modelName':'Migration','columnName':_0x0a19('0xc')},'migrations':{'params':[db[_0x0a19('0x26')][_0x0a19('0x28')](),db[_0x0a19('0x26')][_0x0a19('0x29')],function(){throw new Error(_0x0a19('0x2a'));}],'path':path[_0x0a19('0x2b')](config[_0x0a19('0xa')],_0x0a19('0x22'),_0x0a19('0x21')),'pattern':/\.js$/}});_0x477ad2['up']({'migrations':_[_0x0a19('0x2c')](_0x33f2e4,function(_0x2f216c){return _0x2f216c+'.js';})})['then'](function(){return _0xcff75b['status'](0xc8)['json']({'output':_0x0a19('0x2d')+module[_0x0a19('0xb')]['version']+_0x0a19('0x2e')+_[_0x0a19('0x2f')](_0x33f2e4),'migrations':_['join'](_0x33f2e4)});})[_0x0a19('0x20')](function(_0x3ac46b){if(_0x3ac46b instanceof db['sequelize'][_0x0a19('0x30')]){return _0xcff75b['status'](0xc8)[_0x0a19('0x12')]({'output':_0x0a19('0x31')});}else{return _0xcff75b[_0x0a19('0x11')](0x1f4)[_0x0a19('0x12')](_0x3ac46b);}});}else{return _0xcff75b[_0x0a19('0x11')](0xc8)[_0x0a19('0x12')]({'output':'Database\x20already\x20up-to-date'});}};
\ No newline at end of file