mirror of
https://github.com/danbulant/docker-compose
synced 2026-05-24 12:35:32 +00:00
Merge branch 'master' into spawn
This commit is contained in:
commit
b31ec1821c
4 changed files with 16 additions and 4 deletions
11
index.js
11
index.js
|
|
@ -26,12 +26,14 @@ const configToArgs = config => {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const execCompose = (command, args, options) => new Promise((resolve, reject) => {
|
const execCompose = (command, args, options) => new Promise((resolve, reject) => {
|
||||||
const composeArgs = configToArgs(options.config);
|
const composeArgs = configToArgs(options.config);
|
||||||
const cwd = options.cwd;
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -53,6 +55,7 @@ const execCompose = (command, args, options) => new Promise((resolve, reject) =>
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const up = function (options) {
|
const up = function (options) {
|
||||||
return execCompose('up', [ '-d' ], options);
|
return execCompose('up', [ '-d' ], options);
|
||||||
|
|
@ -63,6 +66,7 @@ const up = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const down = function (options) {
|
const down = function (options) {
|
||||||
return execCompose('down', [], options);
|
return execCompose('down', [], options);
|
||||||
|
|
@ -73,6 +77,7 @@ const down = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const stop = function (options) {
|
const stop = function (options) {
|
||||||
return execCompose('stop', [], options);
|
return execCompose('stop', [], options);
|
||||||
|
|
@ -83,6 +88,7 @@ const stop = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const kill = function (options) {
|
const kill = function (options) {
|
||||||
return execCompose('kill', [], options);
|
return execCompose('kill', [], options);
|
||||||
|
|
@ -93,6 +99,7 @@ const kill = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*/
|
*/
|
||||||
const rm = function (options) {
|
const rm = function (options) {
|
||||||
return execCompose('rm', [ '-f' ], options);
|
return execCompose('rm', [ '-f' ], options);
|
||||||
|
|
@ -106,6 +113,7 @@ const rm = function (options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*
|
*
|
||||||
* @return {object} std.out / std.err
|
* @return {object} std.out / std.err
|
||||||
*/
|
*/
|
||||||
|
|
@ -121,6 +129,7 @@ const exec = function (container, command, options) {
|
||||||
* @param {string} options.cwd
|
* @param {string} options.cwd
|
||||||
* @param {boolean} [options.log]
|
* @param {boolean} [options.log]
|
||||||
* @param {?(string|string[])} [options.config]
|
* @param {?(string|string[])} [options.config]
|
||||||
|
* @param {?object} [options.env]
|
||||||
*
|
*
|
||||||
* @return {object} std.out / std.err
|
* @return {object} std.out / std.err
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docker-compose",
|
"name": "docker-compose",
|
||||||
"version": "0.6.1",
|
"version": "0.7.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docker-compose",
|
"name": "docker-compose",
|
||||||
"version": "0.6.1",
|
"version": "0.7.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./node_modules/.bin/tape test",
|
"test": "./node_modules/.bin/tape test",
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
{
|
{
|
||||||
"name": "Ignatiev Mikhail"
|
"name": "Ignatiev Mikhail"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Ezekiel Warren"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Palash Mondal"
|
"name": "Palash Mondal"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ Also please add tests and make sure to run `npm run eslint`.
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 PDMLab
|
Copyright (c) 2018 PDMLab
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue