confr-upload
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -18,4 +18,2 @@ 'use strict'; | ||
var verbosity = LOG_LEVEL[process.env.LOG_LEVEL || 'info']; | ||
function info() { | ||
@@ -43,2 +41,3 @@ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
var method = undefined; | ||
var verbosity = LOG_LEVEL[process.env.LOG_LEVEL || 'info']; | ||
@@ -45,0 +44,0 @@ if (LOG_LEVEL[severity] > verbosity) { |
@@ -43,3 +43,3 @@ 'use strict'; | ||
_commander2['default'].version(require('../package.json').version).option('-u, --url [url]', 'Url to confr-backend', CONFR_BACKEND).option('-e, --env [env]', 'Enviromnent for environment-less files. Comma-separated values', getEnvironmentsFromRancherProfiles()).option('-d, --dir [dir]', 'Stack files directory [default: cwd]', process.cwd()).option('-s, --stack [stack]', 'Override stack name [default: directory name]').option('-f, --filter [filter]', 'Filter only services').parse(process.argv); | ||
_commander2['default'].version(require('../package.json').version).option('--debug [debug]', 'Debug mode').option('-u, --url [url]', 'Url to confr-backend', CONFR_BACKEND).option('-e, --env [env]', 'Enviromnent for environment-less files. Comma-separated values', getEnvironmentsFromRancherProfiles()).option('-d, --dir [dir]', 'Stack files directory [default: cwd]', process.cwd()).option('-s, --stack [stack]', 'Override stack name [default: directory name]').option('-f, --filter [filter]', 'Filter only services').parse(process.argv); | ||
@@ -52,4 +52,5 @@ (function callee$0$0(_ref) { | ||
var filter = _ref.filter; | ||
var debug = _ref.debug; | ||
var byFile, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, f, list, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, d, uploads, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, filePath; | ||
var environments, byFile, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step$value, f, list, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, d, uploads, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, filePath; | ||
@@ -59,2 +60,3 @@ return _regeneratorRuntime.async(function callee$0$0$(context$1$0) { | ||
case 0: | ||
process.env.LOG_LEVEL = debug; | ||
if (!stack) { | ||
@@ -66,7 +68,9 @@ stack = _path2['default'].basename(dir); | ||
(0, _assert2['default'])(url, '-u, --url [url] is missing'); | ||
environments = env.split(',').map(function (s) { | ||
return s.trim(); | ||
}); | ||
context$1$0.next = 7; | ||
return _regeneratorRuntime.awrap((0, _serviceAggregator2['default'])({ dir: dir, stack: stack, serviceFilter: filter, envFilter: environments })); | ||
context$1$0.next = 5; | ||
return _regeneratorRuntime.awrap((0, _serviceAggregator2['default'])(dir, stack, filter)); | ||
case 5: | ||
case 7: | ||
byFile = context$1$0.sent; | ||
@@ -78,8 +82,8 @@ | ||
_iteratorError = undefined; | ||
context$1$0.prev = 10; | ||
context$1$0.prev = 12; | ||
_iterator = _getIterator((0, _lodash.pairs)(byFile)); | ||
case 12: | ||
case 14: | ||
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { | ||
context$1$0.next = 67; | ||
context$1$0.next = 69; | ||
break; | ||
@@ -96,8 +100,8 @@ } | ||
_iteratorError2 = undefined; | ||
context$1$0.prev = 20; | ||
context$1$0.prev = 22; | ||
_iterator2 = _getIterator(list); | ||
case 22: | ||
case 24: | ||
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) { | ||
context$1$0.next = 49; | ||
context$1$0.next = 51; | ||
break; | ||
@@ -107,8 +111,6 @@ } | ||
d = _step2.value; | ||
context$1$0.next = 26; | ||
return _regeneratorRuntime.awrap(d.upload({ environments: env.split(',').map(function (s) { | ||
return s.trim(); | ||
}), backend: url })); | ||
context$1$0.next = 28; | ||
return _regeneratorRuntime.awrap(d.upload({ environments: environments, backend: url })); | ||
case 26: | ||
case 28: | ||
uploads = context$1$0.sent; | ||
@@ -118,3 +120,3 @@ _iteratorNormalCompletion3 = true; | ||
_iteratorError3 = undefined; | ||
context$1$0.prev = 30; | ||
context$1$0.prev = 32; | ||
// if file have env dont override | ||
@@ -126,14 +128,14 @@ for (_iterator3 = _getIterator(uploads); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
} | ||
context$1$0.next = 38; | ||
context$1$0.next = 40; | ||
break; | ||
case 34: | ||
context$1$0.prev = 34; | ||
context$1$0.t0 = context$1$0['catch'](30); | ||
case 36: | ||
context$1$0.prev = 36; | ||
context$1$0.t0 = context$1$0['catch'](32); | ||
_didIteratorError3 = true; | ||
_iteratorError3 = context$1$0.t0; | ||
case 38: | ||
context$1$0.prev = 38; | ||
context$1$0.prev = 39; | ||
case 40: | ||
context$1$0.prev = 40; | ||
context$1$0.prev = 41; | ||
@@ -144,7 +146,7 @@ if (!_iteratorNormalCompletion3 && _iterator3['return']) { | ||
case 41: | ||
context$1$0.prev = 41; | ||
case 43: | ||
context$1$0.prev = 43; | ||
if (!_didIteratorError3) { | ||
context$1$0.next = 44; | ||
context$1$0.next = 46; | ||
break; | ||
@@ -155,26 +157,26 @@ } | ||
case 44: | ||
return context$1$0.finish(41); | ||
case 46: | ||
return context$1$0.finish(43); | ||
case 45: | ||
return context$1$0.finish(38); | ||
case 47: | ||
return context$1$0.finish(40); | ||
case 46: | ||
case 48: | ||
_iteratorNormalCompletion2 = true; | ||
context$1$0.next = 22; | ||
context$1$0.next = 24; | ||
break; | ||
case 49: | ||
context$1$0.next = 55; | ||
case 51: | ||
context$1$0.next = 57; | ||
break; | ||
case 51: | ||
context$1$0.prev = 51; | ||
context$1$0.t1 = context$1$0['catch'](20); | ||
case 53: | ||
context$1$0.prev = 53; | ||
context$1$0.t1 = context$1$0['catch'](22); | ||
_didIteratorError2 = true; | ||
_iteratorError2 = context$1$0.t1; | ||
case 55: | ||
context$1$0.prev = 55; | ||
context$1$0.prev = 56; | ||
case 57: | ||
context$1$0.prev = 57; | ||
context$1$0.prev = 58; | ||
@@ -185,7 +187,7 @@ if (!_iteratorNormalCompletion2 && _iterator2['return']) { | ||
case 58: | ||
context$1$0.prev = 58; | ||
case 60: | ||
context$1$0.prev = 60; | ||
if (!_didIteratorError2) { | ||
context$1$0.next = 61; | ||
context$1$0.next = 63; | ||
break; | ||
@@ -196,29 +198,29 @@ } | ||
case 61: | ||
return context$1$0.finish(58); | ||
case 63: | ||
return context$1$0.finish(60); | ||
case 62: | ||
return context$1$0.finish(55); | ||
case 64: | ||
return context$1$0.finish(57); | ||
case 63: | ||
case 65: | ||
(0, _log.info)('--------------------'); | ||
case 64: | ||
case 66: | ||
_iteratorNormalCompletion = true; | ||
context$1$0.next = 12; | ||
context$1$0.next = 14; | ||
break; | ||
case 67: | ||
context$1$0.next = 73; | ||
case 69: | ||
context$1$0.next = 75; | ||
break; | ||
case 69: | ||
context$1$0.prev = 69; | ||
context$1$0.t2 = context$1$0['catch'](10); | ||
case 71: | ||
context$1$0.prev = 71; | ||
context$1$0.t2 = context$1$0['catch'](12); | ||
_didIteratorError = true; | ||
_iteratorError = context$1$0.t2; | ||
case 73: | ||
context$1$0.prev = 73; | ||
context$1$0.prev = 74; | ||
case 75: | ||
context$1$0.prev = 75; | ||
context$1$0.prev = 76; | ||
@@ -229,7 +231,7 @@ if (!_iteratorNormalCompletion && _iterator['return']) { | ||
case 76: | ||
context$1$0.prev = 76; | ||
case 78: | ||
context$1$0.prev = 78; | ||
if (!_didIteratorError) { | ||
context$1$0.next = 79; | ||
context$1$0.next = 81; | ||
break; | ||
@@ -240,13 +242,13 @@ } | ||
case 79: | ||
return context$1$0.finish(76); | ||
case 81: | ||
return context$1$0.finish(78); | ||
case 80: | ||
return context$1$0.finish(73); | ||
case 82: | ||
return context$1$0.finish(75); | ||
case 81: | ||
case 83: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, _this, [[10, 69, 73, 81], [20, 51, 55, 63], [30, 34, 38, 46], [39,, 41, 45], [56,, 58, 62], [74,, 76, 80]]); | ||
}, null, _this, [[12, 71, 75, 83], [22, 53, 57, 65], [32, 36, 40, 48], [41,, 43, 47], [58,, 60, 64], [76,, 78, 82]]); | ||
})(_commander2['default'])['catch'](function (err) { | ||
@@ -253,0 +255,0 @@ (0, _log.error)(err); |
@@ -27,3 +27,10 @@ 'use strict'; | ||
exports['default'] = function aggregateStackFiles(dir, stack, serviceFilter) { | ||
var _log = require('./log'); | ||
exports['default'] = function aggregateStackFiles(_ref) { | ||
var dir = _ref.dir; | ||
var stack = _ref.stack; | ||
var serviceFilter = _ref.serviceFilter; | ||
var envFilter = _ref.envFilter; | ||
var descriptors, services, stackLevelFilesPath, stackLevelFiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, f, filePath, _filePath$replace$split, _filePath$replace$split2, __, fileName, _Descriptor$parseFileName, version, environment, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, service, serviceLevelFilesPath, serviceLevelFiles, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _filePath$replace$split3, _filePath$replace$split32, _service, _Descriptor$parseFileName2, byFile, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _step3$value, list, sorted; | ||
@@ -56,3 +63,3 @@ | ||
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { | ||
context$1$0.next = 28; | ||
context$1$0.next = 31; | ||
break; | ||
@@ -71,4 +78,13 @@ } | ||
if (!(envFilter.indexOf(environment) < 0)) { | ||
context$1$0.next = 23; | ||
break; | ||
} | ||
(0, _log.debug)('>>>> ' + filePath + ' ignored due to env filter: ' + envFilter); | ||
return context$1$0.abrupt('continue', 28); | ||
case 23: | ||
if (!_fs2['default'].statSync(filePath).isFile()) { | ||
context$1$0.next = 25; | ||
context$1$0.next = 28; | ||
break; | ||
@@ -78,14 +94,14 @@ } | ||
if (!fileName.match(/compose.*\.yml$/)) { | ||
context$1$0.next = 24; | ||
context$1$0.next = 27; | ||
break; | ||
} | ||
console.log('>>>> ' + filePath + ' ignored'); | ||
return context$1$0.abrupt('continue', 25); | ||
(0, _log.debug)('>>>> ' + filePath + ' ignored'); | ||
return context$1$0.abrupt('continue', 28); | ||
case 24: | ||
case 27: | ||
descriptors.push(_descriptor.Descriptor.forFile(filePath, { stack: stack, environment: environment, version: version, filePath: filePath })); | ||
case 25: | ||
case 28: | ||
_iteratorNormalCompletion = true; | ||
@@ -95,8 +111,8 @@ context$1$0.next = 10; | ||
case 28: | ||
context$1$0.next = 34; | ||
case 31: | ||
context$1$0.next = 37; | ||
break; | ||
case 30: | ||
context$1$0.prev = 30; | ||
case 33: | ||
context$1$0.prev = 33; | ||
context$1$0.t0 = context$1$0['catch'](8); | ||
@@ -106,5 +122,5 @@ _didIteratorError = true; | ||
case 34: | ||
context$1$0.prev = 34; | ||
context$1$0.prev = 35; | ||
case 37: | ||
context$1$0.prev = 37; | ||
context$1$0.prev = 38; | ||
@@ -115,7 +131,7 @@ if (!_iteratorNormalCompletion && _iterator['return']) { | ||
case 37: | ||
context$1$0.prev = 37; | ||
case 40: | ||
context$1$0.prev = 40; | ||
if (!_didIteratorError) { | ||
context$1$0.next = 40; | ||
context$1$0.next = 43; | ||
break; | ||
@@ -126,18 +142,18 @@ } | ||
case 40: | ||
case 43: | ||
return context$1$0.finish(40); | ||
case 44: | ||
return context$1$0.finish(37); | ||
case 41: | ||
return context$1$0.finish(34); | ||
case 42: | ||
case 45: | ||
_iteratorNormalCompletion2 = true; | ||
_didIteratorError2 = false; | ||
_iteratorError2 = undefined; | ||
context$1$0.prev = 45; | ||
context$1$0.prev = 48; | ||
_iterator2 = _getIterator(services); | ||
case 47: | ||
case 50: | ||
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) { | ||
context$1$0.next = 92; | ||
context$1$0.next = 95; | ||
break; | ||
@@ -152,8 +168,8 @@ } | ||
_iteratorError4 = undefined; | ||
context$1$0.prev = 54; | ||
context$1$0.prev = 57; | ||
_iterator4 = _getIterator(serviceLevelFiles); | ||
case 56: | ||
case 59: | ||
if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) { | ||
context$1$0.next = 75; | ||
context$1$0.next = 78; | ||
break; | ||
@@ -174,3 +190,3 @@ } | ||
if (!_fs2['default'].statSync(filePath).isFile()) { | ||
context$1$0.next = 72; | ||
context$1$0.next = 75; | ||
break; | ||
@@ -180,3 +196,3 @@ } | ||
if (!fileName.match(/compose.*\.yml$/)) { | ||
context$1$0.next = 71; | ||
context$1$0.next = 74; | ||
break; | ||
@@ -186,5 +202,5 @@ } | ||
console.log('>>>> ' + filePath + ' ignored'); | ||
return context$1$0.abrupt('continue', 72); | ||
return context$1$0.abrupt('continue', 75); | ||
case 71: | ||
case 74: | ||
descriptors.push(_descriptor.Descriptor.forFile(filePath, { | ||
@@ -198,20 +214,20 @@ stack: stack, | ||
case 72: | ||
case 75: | ||
_iteratorNormalCompletion4 = true; | ||
context$1$0.next = 56; | ||
context$1$0.next = 59; | ||
break; | ||
case 75: | ||
context$1$0.next = 81; | ||
case 78: | ||
context$1$0.next = 84; | ||
break; | ||
case 77: | ||
context$1$0.prev = 77; | ||
context$1$0.t1 = context$1$0['catch'](54); | ||
case 80: | ||
context$1$0.prev = 80; | ||
context$1$0.t1 = context$1$0['catch'](57); | ||
_didIteratorError4 = true; | ||
_iteratorError4 = context$1$0.t1; | ||
case 81: | ||
context$1$0.prev = 81; | ||
context$1$0.prev = 82; | ||
case 84: | ||
context$1$0.prev = 84; | ||
context$1$0.prev = 85; | ||
@@ -222,7 +238,7 @@ if (!_iteratorNormalCompletion4 && _iterator4['return']) { | ||
case 84: | ||
context$1$0.prev = 84; | ||
case 87: | ||
context$1$0.prev = 87; | ||
if (!_didIteratorError4) { | ||
context$1$0.next = 87; | ||
context$1$0.next = 90; | ||
break; | ||
@@ -233,26 +249,26 @@ } | ||
case 87: | ||
case 90: | ||
return context$1$0.finish(87); | ||
case 91: | ||
return context$1$0.finish(84); | ||
case 88: | ||
return context$1$0.finish(81); | ||
case 89: | ||
case 92: | ||
_iteratorNormalCompletion2 = true; | ||
context$1$0.next = 47; | ||
context$1$0.next = 50; | ||
break; | ||
case 92: | ||
context$1$0.next = 98; | ||
case 95: | ||
context$1$0.next = 101; | ||
break; | ||
case 94: | ||
context$1$0.prev = 94; | ||
context$1$0.t2 = context$1$0['catch'](45); | ||
case 97: | ||
context$1$0.prev = 97; | ||
context$1$0.t2 = context$1$0['catch'](48); | ||
_didIteratorError2 = true; | ||
_iteratorError2 = context$1$0.t2; | ||
case 98: | ||
context$1$0.prev = 98; | ||
context$1$0.prev = 99; | ||
case 101: | ||
context$1$0.prev = 101; | ||
context$1$0.prev = 102; | ||
@@ -263,7 +279,7 @@ if (!_iteratorNormalCompletion2 && _iterator2['return']) { | ||
case 101: | ||
context$1$0.prev = 101; | ||
case 104: | ||
context$1$0.prev = 104; | ||
if (!_didIteratorError2) { | ||
context$1$0.next = 104; | ||
context$1$0.next = 107; | ||
break; | ||
@@ -274,9 +290,9 @@ } | ||
case 104: | ||
case 107: | ||
return context$1$0.finish(104); | ||
case 108: | ||
return context$1$0.finish(101); | ||
case 105: | ||
return context$1$0.finish(98); | ||
case 106: | ||
case 109: | ||
byFile = (0, _lodash.groupBy)(descriptors, function (d) { | ||
@@ -288,3 +304,3 @@ return _descriptor.Descriptor.cleanFileName(d.filePath); | ||
_iteratorError3 = undefined; | ||
context$1$0.prev = 110; | ||
context$1$0.prev = 113; | ||
@@ -310,14 +326,14 @@ for (_iterator3 = _getIterator((0, _lodash.pairs)(byFile)); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
context$1$0.next = 118; | ||
context$1$0.next = 121; | ||
break; | ||
case 114: | ||
context$1$0.prev = 114; | ||
context$1$0.t3 = context$1$0['catch'](110); | ||
case 117: | ||
context$1$0.prev = 117; | ||
context$1$0.t3 = context$1$0['catch'](113); | ||
_didIteratorError3 = true; | ||
_iteratorError3 = context$1$0.t3; | ||
case 118: | ||
context$1$0.prev = 118; | ||
context$1$0.prev = 119; | ||
case 121: | ||
context$1$0.prev = 121; | ||
context$1$0.prev = 122; | ||
@@ -328,7 +344,7 @@ if (!_iteratorNormalCompletion3 && _iterator3['return']) { | ||
case 121: | ||
context$1$0.prev = 121; | ||
case 124: | ||
context$1$0.prev = 124; | ||
if (!_didIteratorError3) { | ||
context$1$0.next = 124; | ||
context$1$0.next = 127; | ||
break; | ||
@@ -339,16 +355,16 @@ } | ||
case 124: | ||
case 127: | ||
return context$1$0.finish(124); | ||
case 128: | ||
return context$1$0.finish(121); | ||
case 125: | ||
return context$1$0.finish(118); | ||
case 126: | ||
case 129: | ||
return context$1$0.abrupt('return', byFile); | ||
case 127: | ||
case 130: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, this, [[8, 30, 34, 42], [35,, 37, 41], [45, 94, 98, 106], [54, 77, 81, 89], [82,, 84, 88], [99,, 101, 105], [110, 114, 118, 126], [119,, 121, 125]]); | ||
}, null, this, [[8, 33, 37, 45], [38,, 40, 44], [48, 97, 101, 109], [57, 80, 84, 92], [85,, 87, 91], [102,, 104, 108], [113, 117, 121, 129], [122,, 124, 128]]); | ||
}; | ||
@@ -355,0 +371,0 @@ |
{ | ||
"name": "confr-upload", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Directory-to-`confr-backend` uploader", | ||
@@ -5,0 +5,0 @@ "author": "Nick Delitski", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35131
835
8