Merge branch 'master' into spawn

This commit is contained in:
Ezekiel Warren 2018-06-28 09:01:24 -07:00 committed by GitHub
commit b31ec1821c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View file

@ -26,12 +26,14 @@ const configToArgs = config => {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const execCompose = (command, args, options) => new Promise((resolve, reject) => {
const composeArgs = configToArgs(options.config);
const cwd = options.cwd;
const env = options.env || null;
const childProc = childProcess.spawn('docker-compose', composeArgs.concat([ command ], args), { cwd }, (err, stdout, stderr) => {
const childProc = childProcess.spawn('docker-compose', composeArgs.concat([ command ], args), { cwd, env }, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
@ -53,6 +55,7 @@ const execCompose = (command, args, options) => new Promise((resolve, reject) =>
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const up = function (options) {
return execCompose('up', [ '-d' ], options);
@ -63,6 +66,7 @@ const up = function (options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const down = function (options) {
return execCompose('down', [], options);
@ -73,6 +77,7 @@ const down = function (options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const stop = function (options) {
return execCompose('stop', [], options);
@ -83,6 +88,7 @@ const stop = function (options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const kill = function (options) {
return execCompose('kill', [], options);
@ -93,6 +99,7 @@ const kill = function (options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*/
const rm = function (options) {
return execCompose('rm', [ '-f' ], options);
@ -106,6 +113,7 @@ const rm = function (options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*
* @return {object} std.out / std.err
*/
@ -121,6 +129,7 @@ const exec = function (container, command, options) {
* @param {string} options.cwd
* @param {boolean} [options.log]
* @param {?(string|string[])} [options.config]
* @param {?object} [options.env]
*
* @return {object} std.out / std.err
*/

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "docker-compose",
"version": "0.6.1",
"version": "0.7.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "docker-compose",
"version": "0.6.1",
"version": "0.7.0",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/tape test",
@ -15,6 +15,9 @@
{
"name": "Ignatiev Mikhail"
},
{
"name": "Ezekiel Warren"
},
{
"name": "Palash Mondal"
}

View file

@ -77,7 +77,7 @@ Also please add tests and make sure to run `npm run eslint`.
MIT License
Copyright (c) 2017 PDMLab
Copyright (c) 2018 PDMLab
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal