1
0
mirror of https://github.com/yldio/copilot.git synced 2024-09-21 05:43:52 +03:00

docker-compose-client initial implementation

This commit is contained in:
Sérgio Ramos 2017-05-09 18:46:33 +01:00 committed by Judit Greskovits
parent 14079028a6
commit 6365139253
17 changed files with 7917 additions and 0 deletions

View File

@ -0,0 +1,17 @@
{
"presets": [
["env", {
"spec": true,
"modules": false,
"targets": {
"browsers": ["last 2 versions", "safari >= 7"],
"node": 6
}
}]
],
"plugins": [
"babel-plugin-transform-flow-strip-types",
"external-helpers",
"istanbul"
]
}

View File

@ -0,0 +1,31 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended",
"xo-space/esnext",
"prettier",
"prettier/flowtype"
],
"plugins": [
"flowtype",
"flowtype-errors",
"prettier"
],
"rules": {
"prettier/prettier": ["error", {
"useTabs": false,
"printWidth": 80,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": true
}]
},
"env": {
"es6": true,
"node": true
}
}

View File

@ -0,0 +1,13 @@
[ignore]
.*/node_modules/.*
.*/dist/.*
.*/coverage/.*
.*/.nyc_output/.*
[include]
[libs]
flow-typed
./src/types.js
[options]

View File

@ -0,0 +1,576 @@
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var newArrowCheck = function (innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var cov_1eyosjm197 = function () {
var path = '/Users/ramitos/dev/yld/joyent-portal/spikes/docker-compose-client/src/index.js',
hash = '384e02ed4692c70a8c8d9e69b30064cdb319bdf4',
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/ramitos/dev/yld/joyent-portal/spikes/docker-compose-client/src/index.js',
statementMap: {
'0': {
start: {
line: 1,
column: 19
},
end: {
line: 1,
column: 37
}
},
'1': {
start: {
line: 2,
column: 25
},
end: {
line: 2,
column: 42
}
},
'2': {
start: {
line: 3,
column: 17
},
end: {
line: 3,
column: 40
}
},
'3': {
start: {
line: 7,
column: 4
},
end: {
line: 7,
column: 12
}
},
'4': {
start: {
line: 9,
column: 4
},
end: {
line: 9,
column: 31
}
},
'5': {
start: {
line: 10,
column: 4
},
end: {
line: 10,
column: 34
}
},
'6': {
start: {
line: 11,
column: 4
},
end: {
line: 11,
column: 60
}
},
'7': {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
'8': {
start: {
line: 13,
column: 4
},
end: {
line: 13,
column: 53
}
},
'9': {
start: {
line: 18,
column: 4
},
end: {
line: 18,
column: 45
}
},
'10': {
start: {
line: 22,
column: 4
},
end: {
line: 22,
column: 31
}
},
'11': {
start: {
line: 27,
column: 4
},
end: {
line: 27,
column: 71
}
},
'12': {
start: {
line: 31,
column: 4
},
end: {
line: 42,
column: 6
}
},
'13': {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
'14': {
start: {
line: 46,
column: 0
},
end: {
line: 46,
column: 37
}
}
},
fnMap: {
'0': {
name: '(anonymous_0)',
decl: {
start: {
line: 6,
column: 2
},
end: {
line: 6,
column: 3
}
},
loc: {
start: {
line: 6,
column: 47
},
end: {
line: 14,
column: 3
}
},
line: 6
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 11,
column: 28
},
end: {
line: 11,
column: 29
}
},
loc: {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
line: 11
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 17,
column: 2
},
end: {
line: 17,
column: 3
}
},
loc: {
start: {
line: 17,
column: 25
},
end: {
line: 19,
column: 3
}
},
line: 17
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 21,
column: 2
},
end: {
line: 21,
column: 3
}
},
loc: {
start: {
line: 21,
column: 10
},
end: {
line: 23,
column: 3
}
},
line: 21
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 25,
column: 2
},
end: {
line: 25,
column: 3
}
},
loc: {
start: {
line: 25,
column: 39
},
end: {
line: 28,
column: 3
}
},
line: 25
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 30,
column: 2
},
end: {
line: 30,
column: 3
}
},
loc: {
start: {
line: 30,
column: 45
},
end: {
line: 43,
column: 3
}
},
line: 30
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 36,
column: 44
},
end: {
line: 36,
column: 45
}
},
loc: {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
line: 36
}
},
branchMap: {
'0': {
loc: {
start: {
line: 6,
column: 14
},
end: {
line: 6,
column: 45
}
},
type: 'default-arg',
locations: [{
start: {
line: 6,
column: 25
},
end: {
line: 6,
column: 45
}
}],
line: 6
}
},
s: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
'8': 0,
'9': 0,
'10': 0,
'11': 0,
'12': 0,
'13': 0,
'14': 0
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0
},
b: {
'0': [0]
},
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
var _ref = (++cov_1eyosjm197.s[0], require('zerorpc'));
var Client = _ref.Client;
var _ref2 = (++cov_1eyosjm197.s[1], require('events'));
var EventEmitter = _ref2.EventEmitter;
var awaitify = (++cov_1eyosjm197.s[2], require('apr-awaitify'));
var DockerComposeClient = function (_EventEmitter) {
inherits(DockerComposeClient, _EventEmitter);
function DockerComposeClient() {
var _this2 = this;
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (++cov_1eyosjm197.b[0][0], 'tcp://0.0.0.0:4242');
classCallCheck(this, DockerComposeClient);
++cov_1eyosjm197.f[0];
++cov_1eyosjm197.s[3];
var _this = possibleConstructorReturn(this, (DockerComposeClient.__proto__ || Object.getPrototypeOf(DockerComposeClient)).call(this));
++cov_1eyosjm197.s[4];
_this.client = new Client();
++cov_1eyosjm197.s[5];
_this.client.connect(endpoint);
++cov_1eyosjm197.s[6];
_this.client.on('error', function (err) {
newArrowCheck(this, _this2);
++cov_1eyosjm197.f[1];
++cov_1eyosjm197.s[7];
return _this.emit('error', err);
}.bind(this));
++cov_1eyosjm197.s[8];
_this._invoke = awaitify(_this._invoke.bind(_this));
return _this;
}
// Why isn't client.connect async with error??
createClass(DockerComposeClient, [{
key: '_invoke',
value: function _invoke(name) {
var _client;
++cov_1eyosjm197.f[2];
++cov_1eyosjm197.s[9];
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return (_client = this.client).invoke.apply(_client, [name].concat(args));
}
}, {
key: 'close',
value: function close() {
++cov_1eyosjm197.f[3];
++cov_1eyosjm197.s[10];
return this.client.close();
}
}, {
key: 'provision',
value: function provision(_ref3) {
var projectName = _ref3.projectName,
manifest = _ref3.manifest;
++cov_1eyosjm197.f[4];
++cov_1eyosjm197.s[11];
// eslint-disable-next-line camelcase
return this._invoke('up', { project_name: projectName }, manifest);
}
}, {
key: 'scale',
value: function scale(_ref4) {
var _this3 = this;
var projectName = _ref4.projectName,
services = _ref4.services,
manifest = _ref4.manifest;
++cov_1eyosjm197.f[5];
++cov_1eyosjm197.s[12];
return this._invoke('scale', {
// eslint-disable-next-line camelcase
project_name: projectName,
services: Object.keys(services).map(function (name) {
newArrowCheck(this, _this3);
++cov_1eyosjm197.f[6];
++cov_1eyosjm197.s[13];
return {
name: name,
num: services[name]
};
}.bind(this))
}, manifest);
}
}]);
return DockerComposeClient;
}(EventEmitter);
++cov_1eyosjm197.s[14];
module.exports = DockerComposeClient;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZXMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCB7IENsaWVudCB9ID0gcmVxdWlyZSgnemVyb3JwYycpO1xuY29uc3QgeyBFdmVudEVtaXR0ZXIgfSA9IHJlcXVpcmUoJ2V2ZW50cycpO1xuY29uc3QgYXdhaXRpZnkgPSByZXF1aXJlKCdhcHItYXdhaXRpZnknKTtcblxuY2xhc3MgRG9ja2VyQ29tcG9zZUNsaWVudCBleHRlbmRzIEV2ZW50RW1pdHRlciB7XG4gIGNvbnN0cnVjdG9yKGVuZHBvaW50ID0gJ3RjcDovLzAuMC4wLjA6NDI0MicpIHtcbiAgICBzdXBlcigpO1xuXG4gICAgdGhpcy5jbGllbnQgPSBuZXcgQ2xpZW50KCk7XG4gICAgdGhpcy5jbGllbnQuY29ubmVjdChlbmRwb2ludCk7XG4gICAgdGhpcy5jbGllbnQub24oJ2Vycm9yJywgZXJyID0+IHRoaXMuZW1pdCgnZXJyb3InLCB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QjtVQUFaRixRQUFZLFNBQVpBLFFBQVk7Ozs7YUFDbEMsS0FBS1AsT0FBTCxDQUNMLE9BREssRUFFTDs7c0JBRWdCTSxXQUZoQjtrQkFHWUksT0FBT0MsSUFBUCxDQUFZRixRQUFaLEVBQXNCRyxHQUF0QixDQUEwQixnQkFBUzs7Ozs7c0JBQUE7aUJBRXRDSCxTQUFTUCxJQUFUOztTQUZHO09BTFAsRUFVTEssUUFWSyxDQUFQOzs7O0VBMUI4QmhCOzs7OztBQXlDbENzQixPQUFPQyxPQUFQLEdBQWlCckIsbUJBQWpCIn0=

View File

@ -0,0 +1,584 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var newArrowCheck = function (innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var cov_1eyosjm197 = function () {
var path = '/Users/ramitos/dev/yld/joyent-portal/spikes/docker-compose-client/src/index.js',
hash = '384e02ed4692c70a8c8d9e69b30064cdb319bdf4',
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/ramitos/dev/yld/joyent-portal/spikes/docker-compose-client/src/index.js',
statementMap: {
'0': {
start: {
line: 1,
column: 19
},
end: {
line: 1,
column: 37
}
},
'1': {
start: {
line: 2,
column: 25
},
end: {
line: 2,
column: 42
}
},
'2': {
start: {
line: 3,
column: 17
},
end: {
line: 3,
column: 40
}
},
'3': {
start: {
line: 7,
column: 4
},
end: {
line: 7,
column: 12
}
},
'4': {
start: {
line: 9,
column: 4
},
end: {
line: 9,
column: 31
}
},
'5': {
start: {
line: 10,
column: 4
},
end: {
line: 10,
column: 34
}
},
'6': {
start: {
line: 11,
column: 4
},
end: {
line: 11,
column: 60
}
},
'7': {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
'8': {
start: {
line: 13,
column: 4
},
end: {
line: 13,
column: 53
}
},
'9': {
start: {
line: 18,
column: 4
},
end: {
line: 18,
column: 45
}
},
'10': {
start: {
line: 22,
column: 4
},
end: {
line: 22,
column: 31
}
},
'11': {
start: {
line: 27,
column: 4
},
end: {
line: 27,
column: 71
}
},
'12': {
start: {
line: 31,
column: 4
},
end: {
line: 42,
column: 6
}
},
'13': {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
'14': {
start: {
line: 46,
column: 0
},
end: {
line: 46,
column: 37
}
}
},
fnMap: {
'0': {
name: '(anonymous_0)',
decl: {
start: {
line: 6,
column: 2
},
end: {
line: 6,
column: 3
}
},
loc: {
start: {
line: 6,
column: 47
},
end: {
line: 14,
column: 3
}
},
line: 6
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 11,
column: 28
},
end: {
line: 11,
column: 29
}
},
loc: {
start: {
line: 11,
column: 35
},
end: {
line: 11,
column: 58
}
},
line: 11
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 17,
column: 2
},
end: {
line: 17,
column: 3
}
},
loc: {
start: {
line: 17,
column: 25
},
end: {
line: 19,
column: 3
}
},
line: 17
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 21,
column: 2
},
end: {
line: 21,
column: 3
}
},
loc: {
start: {
line: 21,
column: 10
},
end: {
line: 23,
column: 3
}
},
line: 21
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 25,
column: 2
},
end: {
line: 25,
column: 3
}
},
loc: {
start: {
line: 25,
column: 39
},
end: {
line: 28,
column: 3
}
},
line: 25
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 30,
column: 2
},
end: {
line: 30,
column: 3
}
},
loc: {
start: {
line: 30,
column: 45
},
end: {
line: 43,
column: 3
}
},
line: 30
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 36,
column: 44
},
end: {
line: 36,
column: 45
}
},
loc: {
start: {
line: 36,
column: 53
},
end: {
line: 39,
column: 9
}
},
line: 36
}
},
branchMap: {
'0': {
loc: {
start: {
line: 6,
column: 14
},
end: {
line: 6,
column: 45
}
},
type: 'default-arg',
locations: [{
start: {
line: 6,
column: 25
},
end: {
line: 6,
column: 45
}
}],
line: 6
}
},
s: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
'8': 0,
'9': 0,
'10': 0,
'11': 0,
'12': 0,
'13': 0,
'14': 0
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0
},
b: {
'0': [0]
},
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
var _ref = (++cov_1eyosjm197.s[0], require('zerorpc'));
var Client = _ref.Client;
var _ref2 = (++cov_1eyosjm197.s[1], require('events'));
var EventEmitter = _ref2.EventEmitter;
var awaitify = (++cov_1eyosjm197.s[2], require('apr-awaitify'));
var DockerComposeClient = function (_EventEmitter) {
inherits(DockerComposeClient, _EventEmitter);
function DockerComposeClient() {
var _this2 = this;
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (++cov_1eyosjm197.b[0][0], 'tcp://0.0.0.0:4242');
classCallCheck(this, DockerComposeClient);
++cov_1eyosjm197.f[0];
++cov_1eyosjm197.s[3];
var _this = possibleConstructorReturn(this, (DockerComposeClient.__proto__ || Object.getPrototypeOf(DockerComposeClient)).call(this));
++cov_1eyosjm197.s[4];
_this.client = new Client();
++cov_1eyosjm197.s[5];
_this.client.connect(endpoint);
++cov_1eyosjm197.s[6];
_this.client.on('error', function (err) {
newArrowCheck(this, _this2);
++cov_1eyosjm197.f[1];
++cov_1eyosjm197.s[7];
return _this.emit('error', err);
}.bind(this));
++cov_1eyosjm197.s[8];
_this._invoke = awaitify(_this._invoke.bind(_this));
return _this;
}
// Why isn't client.connect async with error??
createClass(DockerComposeClient, [{
key: '_invoke',
value: function _invoke(name) {
var _client;
++cov_1eyosjm197.f[2];
++cov_1eyosjm197.s[9];
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return (_client = this.client).invoke.apply(_client, [name].concat(args));
}
}, {
key: 'close',
value: function close() {
++cov_1eyosjm197.f[3];
++cov_1eyosjm197.s[10];
return this.client.close();
}
}, {
key: 'provision',
value: function provision(_ref3) {
var projectName = _ref3.projectName,
manifest = _ref3.manifest;
++cov_1eyosjm197.f[4];
++cov_1eyosjm197.s[11];
// eslint-disable-next-line camelcase
return this._invoke('up', { project_name: projectName }, manifest);
}
}, {
key: 'scale',
value: function scale(_ref4) {
var _this3 = this;
var projectName = _ref4.projectName,
services = _ref4.services,
manifest = _ref4.manifest;
++cov_1eyosjm197.f[5];
++cov_1eyosjm197.s[12];
return this._invoke('scale', {
// eslint-disable-next-line camelcase
project_name: projectName,
services: Object.keys(services).map(function (name) {
newArrowCheck(this, _this3);
++cov_1eyosjm197.f[6];
++cov_1eyosjm197.s[13];
return {
name: name,
num: services[name]
};
}.bind(this))
}, manifest);
}
}]);
return DockerComposeClient;
}(EventEmitter);
++cov_1eyosjm197.s[14];
module.exports = DockerComposeClient;
})));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgudW1kLmpzIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXguanMiXSwic291cmNlc0NvbnRlbnQiOlsiY29uc3QgeyBDbGllbnQgfSA9IHJlcXVpcmUoJ3plcm9ycGMnKTtcbmNvbnN0IHsgRXZlbnRFbWl0dGVyIH0gPSByZXF1aXJlKCdldmVudHMnKTtcbmNvbnN0IGF3YWl0aWZ5ID0gcmVxdWlyZSgnYXByLWF3YWl0aWZ5Jyk7XG5cbmNsYXNzIERvY2tlckNvbXBvc2VDbGllbnQgZXh0ZW5kcyBFdmVudEVtaXR0ZXIge1xuICBjb25zdHJ1Y3RvcihlbmRwb2ludCA9ICd0Y3A6Ly8wLjAuMC4wOjQyNDInKSB7XG4gICAgc3VwZXIoKTtcblxuICAgIHRoaXMuY2xpZW50ID0gbmV3IENsaWVudCgpO1xuICAgIHRoaXMuY2xpZW50LmNvbm5lY3QoZW5kcG9pbnQpO1xuICAgIHRoaXMuY2xpZW50Lm9uKCdlcnJvcicsIGVyciA9PiB0aGlzLmVtaXQoJ2Vycm9yJywgZXJyKSk7XG5cbiAgICB0aGlzLl9pbnZva2UgPSBhd2FpdGlmeSh0aGlzLl9pbnZva2UuYmluZCh0aGlzKSk7XG4gIH1cblxuICAvLyBXaHkgaXNuJ3QgY2xpZW50LmNvbm5lY3QgYXN5bmMgd2l0aCBlcnJvcj8/XG4gIF9pbnZva2UobmFtZSwgLi4uYXJncykge1xuICAgIHJldHVybiB0aGlzLmNsaWVudC5pbnZva2UobmF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LEVBVUxLLFFBVkssQ0FBUDs7OztFQTFCOEJoQjs7Ozs7QUF5Q2xDc0IsT0FBT0MsT0FBUCxHQUFpQnJCLG1CQUFqQjs7In0=

View File

@ -0,0 +1,33 @@
// flow-typed signature: c7a9c3b7f573e1b84f9080e5c09facb8
// flow-typed version: <<STUB>>/apr-awaitify_v^1.0.2/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'apr-awaitify'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'apr-awaitify' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'apr-awaitify/index' {
declare module.exports: $Exports<'apr-awaitify'>;
}
declare module 'apr-awaitify/index.js' {
declare module.exports: $Exports<'apr-awaitify'>;
}

View File

@ -0,0 +1,283 @@
// flow-typed signature: f88809b2b328b42b18ac808a2185810a
// flow-typed version: <<STUB>>/ava_v0.19.1/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'ava'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'ava' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'ava/api' {
declare module.exports: any;
}
declare module 'ava/cli' {
declare module.exports: any;
}
declare module 'ava/lib/assert' {
declare module.exports: any;
}
declare module 'ava/lib/ava-error' {
declare module.exports: any;
}
declare module 'ava/lib/ava-files' {
declare module.exports: any;
}
declare module 'ava/lib/babel-config' {
declare module.exports: any;
}
declare module 'ava/lib/beautify-stack' {
declare module.exports: any;
}
declare module 'ava/lib/caching-precompiler' {
declare module.exports: any;
}
declare module 'ava/lib/cli' {
declare module.exports: any;
}
declare module 'ava/lib/code-excerpt' {
declare module.exports: any;
}
declare module 'ava/lib/colors' {
declare module.exports: any;
}
declare module 'ava/lib/concurrent' {
declare module.exports: any;
}
declare module 'ava/lib/enhance-assert' {
declare module.exports: any;
}
declare module 'ava/lib/extract-stack' {
declare module.exports: any;
}
declare module 'ava/lib/fork' {
declare module.exports: any;
}
declare module 'ava/lib/format-assert-error' {
declare module.exports: any;
}
declare module 'ava/lib/globals' {
declare module.exports: any;
}
declare module 'ava/lib/logger' {
declare module.exports: any;
}
declare module 'ava/lib/main' {
declare module.exports: any;
}
declare module 'ava/lib/prefix-title' {
declare module.exports: any;
}
declare module 'ava/lib/process-adapter' {
declare module.exports: any;
}
declare module 'ava/lib/reporters/improper-usage-messages' {
declare module.exports: any;
}
declare module 'ava/lib/reporters/mini' {
declare module.exports: any;
}
declare module 'ava/lib/reporters/tap' {
declare module.exports: any;
}
declare module 'ava/lib/reporters/verbose' {
declare module.exports: any;
}
declare module 'ava/lib/run-status' {
declare module.exports: any;
}
declare module 'ava/lib/runner' {
declare module.exports: any;
}
declare module 'ava/lib/sequence' {
declare module.exports: any;
}
declare module 'ava/lib/serialize-error' {
declare module.exports: any;
}
declare module 'ava/lib/test-collection' {
declare module.exports: any;
}
declare module 'ava/lib/test-worker' {
declare module.exports: any;
}
declare module 'ava/lib/test' {
declare module.exports: any;
}
declare module 'ava/lib/validate-test' {
declare module.exports: any;
}
declare module 'ava/lib/watcher' {
declare module.exports: any;
}
declare module 'ava/profile' {
declare module.exports: any;
}
declare module 'ava/types/make' {
declare module.exports: any;
}
// Filename aliases
declare module 'ava/api.js' {
declare module.exports: $Exports<'ava/api'>;
}
declare module 'ava/cli.js' {
declare module.exports: $Exports<'ava/cli'>;
}
declare module 'ava/index' {
declare module.exports: $Exports<'ava'>;
}
declare module 'ava/index.js' {
declare module.exports: $Exports<'ava'>;
}
declare module 'ava/lib/assert.js' {
declare module.exports: $Exports<'ava/lib/assert'>;
}
declare module 'ava/lib/ava-error.js' {
declare module.exports: $Exports<'ava/lib/ava-error'>;
}
declare module 'ava/lib/ava-files.js' {
declare module.exports: $Exports<'ava/lib/ava-files'>;
}
declare module 'ava/lib/babel-config.js' {
declare module.exports: $Exports<'ava/lib/babel-config'>;
}
declare module 'ava/lib/beautify-stack.js' {
declare module.exports: $Exports<'ava/lib/beautify-stack'>;
}
declare module 'ava/lib/caching-precompiler.js' {
declare module.exports: $Exports<'ava/lib/caching-precompiler'>;
}
declare module 'ava/lib/cli.js' {
declare module.exports: $Exports<'ava/lib/cli'>;
}
declare module 'ava/lib/code-excerpt.js' {
declare module.exports: $Exports<'ava/lib/code-excerpt'>;
}
declare module 'ava/lib/colors.js' {
declare module.exports: $Exports<'ava/lib/colors'>;
}
declare module 'ava/lib/concurrent.js' {
declare module.exports: $Exports<'ava/lib/concurrent'>;
}
declare module 'ava/lib/enhance-assert.js' {
declare module.exports: $Exports<'ava/lib/enhance-assert'>;
}
declare module 'ava/lib/extract-stack.js' {
declare module.exports: $Exports<'ava/lib/extract-stack'>;
}
declare module 'ava/lib/fork.js' {
declare module.exports: $Exports<'ava/lib/fork'>;
}
declare module 'ava/lib/format-assert-error.js' {
declare module.exports: $Exports<'ava/lib/format-assert-error'>;
}
declare module 'ava/lib/globals.js' {
declare module.exports: $Exports<'ava/lib/globals'>;
}
declare module 'ava/lib/logger.js' {
declare module.exports: $Exports<'ava/lib/logger'>;
}
declare module 'ava/lib/main.js' {
declare module.exports: $Exports<'ava/lib/main'>;
}
declare module 'ava/lib/prefix-title.js' {
declare module.exports: $Exports<'ava/lib/prefix-title'>;
}
declare module 'ava/lib/process-adapter.js' {
declare module.exports: $Exports<'ava/lib/process-adapter'>;
}
declare module 'ava/lib/reporters/improper-usage-messages.js' {
declare module.exports: $Exports<'ava/lib/reporters/improper-usage-messages'>;
}
declare module 'ava/lib/reporters/mini.js' {
declare module.exports: $Exports<'ava/lib/reporters/mini'>;
}
declare module 'ava/lib/reporters/tap.js' {
declare module.exports: $Exports<'ava/lib/reporters/tap'>;
}
declare module 'ava/lib/reporters/verbose.js' {
declare module.exports: $Exports<'ava/lib/reporters/verbose'>;
}
declare module 'ava/lib/run-status.js' {
declare module.exports: $Exports<'ava/lib/run-status'>;
}
declare module 'ava/lib/runner.js' {
declare module.exports: $Exports<'ava/lib/runner'>;
}
declare module 'ava/lib/sequence.js' {
declare module.exports: $Exports<'ava/lib/sequence'>;
}
declare module 'ava/lib/serialize-error.js' {
declare module.exports: $Exports<'ava/lib/serialize-error'>;
}
declare module 'ava/lib/test-collection.js' {
declare module.exports: $Exports<'ava/lib/test-collection'>;
}
declare module 'ava/lib/test-worker.js' {
declare module.exports: $Exports<'ava/lib/test-worker'>;
}
declare module 'ava/lib/test.js' {
declare module.exports: $Exports<'ava/lib/test'>;
}
declare module 'ava/lib/validate-test.js' {
declare module.exports: $Exports<'ava/lib/validate-test'>;
}
declare module 'ava/lib/watcher.js' {
declare module.exports: $Exports<'ava/lib/watcher'>;
}
declare module 'ava/profile.js' {
declare module.exports: $Exports<'ava/profile'>;
}
declare module 'ava/types/make.js' {
declare module.exports: $Exports<'ava/types/make'>;
}

View File

@ -0,0 +1,32 @@
// flow-typed signature: 20604af9a6e86cff1e7365a95b7f7b64
// flow-typed version: <<STUB>>/babelrc-rollup_v3.0.0/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'babelrc-rollup'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'babelrc-rollup' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'babelrc-rollup/dist/babelrc-rollup' {
declare module.exports: any;
}
// Filename aliases
declare module 'babelrc-rollup/dist/babelrc-rollup.js' {
declare module.exports: $Exports<'babelrc-rollup/dist/babelrc-rollup'>;
}

View File

@ -0,0 +1,67 @@
// flow-typed signature: 3cfdd2edb76d3399543bc86f7803f4ac
// flow-typed version: <<STUB>>/rollup-plugin-babel_v2.7.1/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'rollup-plugin-babel'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'rollup-plugin-babel' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs' {
declare module.exports: any;
}
declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es' {
declare module.exports: any;
}
declare module 'rollup-plugin-babel/src/constants' {
declare module.exports: any;
}
declare module 'rollup-plugin-babel/src/index' {
declare module.exports: any;
}
declare module 'rollup-plugin-babel/src/preflightCheck' {
declare module.exports: any;
}
declare module 'rollup-plugin-babel/src/utils' {
declare module.exports: any;
}
// Filename aliases
declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js' {
declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.cjs'>;
}
declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es.js' {
declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.es'>;
}
declare module 'rollup-plugin-babel/src/constants.js' {
declare module.exports: $Exports<'rollup-plugin-babel/src/constants'>;
}
declare module 'rollup-plugin-babel/src/index.js' {
declare module.exports: $Exports<'rollup-plugin-babel/src/index'>;
}
declare module 'rollup-plugin-babel/src/preflightCheck.js' {
declare module.exports: $Exports<'rollup-plugin-babel/src/preflightCheck'>;
}
declare module 'rollup-plugin-babel/src/utils.js' {
declare module.exports: $Exports<'rollup-plugin-babel/src/utils'>;
}

View File

@ -0,0 +1,143 @@
// flow-typed signature: d02c352f523e296631d9b724125d25d2
// flow-typed version: <<STUB>>/zerorpc_v^0.9.7/flow_v0.45.0
/**
* This is an autogenerated libdef stub for:
*
* 'zerorpc'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'zerorpc' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'zerorpc/lib/buffer' {
declare module.exports: any;
}
declare module 'zerorpc/lib/channel' {
declare module.exports: any;
}
declare module 'zerorpc/lib/client' {
declare module.exports: any;
}
declare module 'zerorpc/lib/events' {
declare module.exports: any;
}
declare module 'zerorpc/lib/middleware' {
declare module.exports: any;
}
declare module 'zerorpc/lib/server' {
declare module.exports: any;
}
declare module 'zerorpc/lib/socket' {
declare module.exports: any;
}
declare module 'zerorpc/lib/util' {
declare module.exports: any;
}
declare module 'zerorpc/test/buffers' {
declare module.exports: any;
}
declare module 'zerorpc/test/errors' {
declare module.exports: any;
}
declare module 'zerorpc/test/heartbeats' {
declare module.exports: any;
}
declare module 'zerorpc/test/invocation' {
declare module.exports: any;
}
declare module 'zerorpc/test/lib/testutil' {
declare module.exports: any;
}
declare module 'zerorpc/test/repro-10' {
declare module.exports: any;
}
declare module 'zerorpc/test/streams' {
declare module.exports: any;
}
declare module 'zerorpc/test/timeouts' {
declare module.exports: any;
}
// Filename aliases
declare module 'zerorpc/index' {
declare module.exports: $Exports<'zerorpc'>;
}
declare module 'zerorpc/index.js' {
declare module.exports: $Exports<'zerorpc'>;
}
declare module 'zerorpc/lib/buffer.js' {
declare module.exports: $Exports<'zerorpc/lib/buffer'>;
}
declare module 'zerorpc/lib/channel.js' {
declare module.exports: $Exports<'zerorpc/lib/channel'>;
}
declare module 'zerorpc/lib/client.js' {
declare module.exports: $Exports<'zerorpc/lib/client'>;
}
declare module 'zerorpc/lib/events.js' {
declare module.exports: $Exports<'zerorpc/lib/events'>;
}
declare module 'zerorpc/lib/middleware.js' {
declare module.exports: $Exports<'zerorpc/lib/middleware'>;
}
declare module 'zerorpc/lib/server.js' {
declare module.exports: $Exports<'zerorpc/lib/server'>;
}
declare module 'zerorpc/lib/socket.js' {
declare module.exports: $Exports<'zerorpc/lib/socket'>;
}
declare module 'zerorpc/lib/util.js' {
declare module.exports: $Exports<'zerorpc/lib/util'>;
}
declare module 'zerorpc/test/buffers.js' {
declare module.exports: $Exports<'zerorpc/test/buffers'>;
}
declare module 'zerorpc/test/errors.js' {
declare module.exports: $Exports<'zerorpc/test/errors'>;
}
declare module 'zerorpc/test/heartbeats.js' {
declare module.exports: $Exports<'zerorpc/test/heartbeats'>;
}
declare module 'zerorpc/test/invocation.js' {
declare module.exports: $Exports<'zerorpc/test/invocation'>;
}
declare module 'zerorpc/test/lib/testutil.js' {
declare module.exports: $Exports<'zerorpc/test/lib/testutil'>;
}
declare module 'zerorpc/test/repro-10.js' {
declare module.exports: $Exports<'zerorpc/test/repro-10'>;
}
declare module 'zerorpc/test/streams.js' {
declare module.exports: $Exports<'zerorpc/test/streams'>;
}
declare module 'zerorpc/test/timeouts.js' {
declare module.exports: $Exports<'zerorpc/test/timeouts'>;
}

View File

@ -0,0 +1,82 @@
{
"name": "docker-compose-client",
"version": "1.0.0",
"private": true,
"description": "",
"license": "Apache-2.0",
"author": "Sérgio Ramos <mail@sergioramos.me>",
"repository": "github:yldio/docker-compose-client",
"keywords": [],
"files": [
"dist"
],
"main": "dist/index.umd.js",
"jsnext:main": "dist/index.es.js",
"module": "dist/index.es.js",
"entry": "src/index.js",
"scripts": {
"fmt": "prettier --write --single-quote --parser flow",
"format": "fmt {src,scripts,test}/**/*.js",
"lint": "eslint {src,scripts,test}/**/*.js --fix",
"test": "npm run build && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"flow": "flow check",
"lint-staged": "lint-staged",
"build": "rollup --config scripts/rollup.config.js",
"prepublish": "npm run build",
"dev-start": "npm run build && node ."
},
"dependencies": {
"apr-awaitify": "^1.0.2",
"zerorpc": "^0.9.7"
},
"devDependencies": {
"apr-intercept": "^1.0.2",
"ava": "0.19.1",
"babel-eslint": "^7.2.3",
"babel-plugin-external-helpers": "6.22.0",
"babel-plugin-istanbul": "^4.1.3",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-env": "1.4.0",
"babel-preset-flow": "^6.23.0",
"babelrc-rollup": "3.0.0",
"cross-env": "^4.0.0",
"documentation": "4.0.0-rc.1",
"eslint": "3.19.0",
"eslint-config-prettier": "2.0.0",
"eslint-config-xo-space": "^0.16.0",
"eslint-plugin-flowtype": "2.32.1",
"eslint-plugin-flowtype-errors": "3.2.0",
"eslint-plugin-prettier": "^2.0.1",
"flow-bin": "0.45.0",
"flow-typed": "^2.1.2",
"js-yaml": "^3.8.4",
"lint-staged": "3.4.1",
"nyc": "10.3.2",
"pre-commit": "1.2.2",
"prettier": "1.3.1",
"quality-docs": "3.3.0",
"rollup": "0.41.6",
"rollup-plugin-babel": "2.7.1"
},
"pre-commit": "lint-staged",
"lint-staged": {
"*.js": [
"npm run fmt",
"eslint --fix",
"git add"
]
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"ava": {
"files": [
"test/*.js"
],
"source": [
"src/**/*.{js,jsx}"
],
"tap": true
}
}

View File

@ -0,0 +1,27 @@
# docker-compose-client
## usage
```js
const client = new DockerComposeClient();
const res = await client.provision({
projectName: 'docker-compose-client',
manifest: `
hello:
image: hello-world:latest
world:
image: consul:latest
node:
image: node:latest
`
});
```
## todo
- proper flow support
## license
Apache-2.0

View File

@ -0,0 +1,30 @@
const babel = require('rollup-plugin-babel');
const { default: babelrc } = require('babelrc-rollup');
const path = require('path');
const pkg = require('../package.json');
module.exports = {
entry: path.join(__dirname, '..', pkg.entry),
external: Object.keys(pkg.dependencies),
plugins: [
babel(
babelrc({
path: path.join(__dirname, '../.babelrc')
})
)
],
targets: [
{
dest: path.join(__dirname, '..', pkg.main),
moduleName: pkg.name,
format: 'umd',
sourceMap: 'inline'
},
{
dest: path.join(__dirname, '..', pkg.module),
format: 'es',
sourceMap: 'inline'
}
]
};

View File

@ -0,0 +1,46 @@
const { Client } = require('zerorpc');
const { EventEmitter } = require('events');
const awaitify = require('apr-awaitify');
class DockerComposeClient extends EventEmitter {
constructor(endpoint = 'tcp://0.0.0.0:4242') {
super();
this.client = new Client();
this.client.connect(endpoint);
this.client.on('error', err => this.emit('error', err));
this._invoke = awaitify(this._invoke.bind(this));
}
// Why isn't client.connect async with error??
_invoke(name, ...args) {
return this.client.invoke(name, ...args);
}
close() {
return this.client.close();
}
provision({ projectName, manifest }) {
// eslint-disable-next-line camelcase
return this._invoke('up', { project_name: projectName }, manifest);
}
scale({ projectName, services, manifest }) {
return this._invoke(
'scale',
{
// eslint-disable-next-line camelcase
project_name: projectName,
services: Object.keys(services).map(name => ({
name,
num: services[name]
}))
},
manifest
);
}
}
module.exports = DockerComposeClient;

View File

@ -0,0 +1,3 @@
export type Service = {
[string]: string
};

View File

@ -0,0 +1,122 @@
const { name } = require('../package.json');
const { safeLoad } = require('js-yaml');
const { Server } = require('zerorpc');
const intercept = require('apr-intercept');
const test = require('ava');
const DockerComposeClient = require('../');
const client = new DockerComposeClient();
const server = new Server({
up: function(options, manifest, fn) {
let m;
if (typeof options !== 'object') {
return fn(new Error('Expected options'));
}
if (typeof options.project_name !== 'string') {
return fn(new Error('Expected project name'));
}
if (typeof manifest !== 'string') {
return fn(new Error('Expected manifest'));
}
try {
m = safeLoad(manifest);
} catch (err) {
return fn(err);
}
fn(null, {
projectName: options.project_name
});
},
scale: function(options, manifest, fn) {
let m;
if (typeof options !== 'object') {
return fn(new Error('Expected options'));
}
if (typeof options.project_name !== 'string') {
return fn(new Error('Expected project name'));
}
if (!Array.isArray(options.services)) {
return fn(new Error('Expected services'));
}
if (typeof manifest !== 'string') {
return fn(new Error('Expected manifest'));
}
try {
m = safeLoad(manifest);
} catch (err) {
return fn(err);
}
fn(null, {
projectName: options.project_name,
services: options.services
});
}
});
server.bind('tcp://0.0.0.0:4242');
test('provision', async t => {
const [err, res] = await intercept(
client.provision({
projectName: name,
manifest: `
hello:
image: hello-world:latest
world:
image: consul:latest
node:
image: node:latest
`
})
);
t.ifError(err);
t.deepEqual(res, {
projectName: name
});
});
test('scale', async t => {
const [err, res] = await intercept(
client.scale({
projectName: name,
services: {
hello: 2,
world: 3
},
manifest: `
hello:
image: hello-world:latest
world:
image: consul:latest
node:
image: node:latest
`
})
);
t.ifError(err);
t.deepEqual(res, {
projectName: name,
services: [{ name: 'hello', num: 2 }, { name: 'world', num: 3 }]
});
});
test.after(() => {
client.close();
server.close();
});

File diff suppressed because it is too large Load Diff