fix(dependencies): update
This commit is contained in:
@ -26,7 +26,10 @@ export let run = () => {
|
||||
plugins.beautylog.ok('Allright. We are now in Docker!');
|
||||
plugins.beautylog.log('now trying to run your specified command');
|
||||
let configArg = await ConfigModule.run();
|
||||
await plugins.smartshell.exec(configArg.command).then(response => {
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
})
|
||||
await smartshellInstance.exec(configArg.command).then(response => {
|
||||
if (response.exitCode !== 0) {
|
||||
process.exit(1);
|
||||
}
|
||||
@ -37,28 +40,34 @@ export let run = () => {
|
||||
plugins.beautylog.ora.start();
|
||||
plugins.beautylog.ora.text('cleaning up docker env...');
|
||||
if (argvArg.all) {
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
})
|
||||
plugins.beautylog.ora.text('killing any running docker containers...');
|
||||
await plugins.smartshell.exec(`docker kill $(docker ps -q)`);
|
||||
await smartshellInstance.exec(`docker kill $(docker ps -q)`);
|
||||
|
||||
plugins.beautylog.ora.text('removing stopped containers...');
|
||||
await plugins.smartshell.exec(`docker rm $(docker ps -a -q)`);
|
||||
await smartshellInstance.exec(`docker rm $(docker ps -a -q)`);
|
||||
|
||||
plugins.beautylog.ora.text('removing images...');
|
||||
await plugins.smartshell.exec(`docker rmi $(docker images -q -f dangling=true)`);
|
||||
await smartshellInstance.exec(`docker rmi $(docker images -q -f dangling=true)`);
|
||||
|
||||
plugins.beautylog.ora.text('removing all other images...');
|
||||
await plugins.smartshell.exec(`docker rmi $(docker images -a -q)`);
|
||||
await smartshellInstance.exec(`docker rmi $(docker images -a -q)`);
|
||||
|
||||
plugins.beautylog.ora.text('removing all volumes...');
|
||||
await plugins.smartshell.exec(`docker volume rm $(docker volume ls -f dangling=true -q)`);
|
||||
await smartshellInstance.exec(`docker volume rm $(docker volume ls -f dangling=true -q)`);
|
||||
}
|
||||
plugins.beautylog.ora.endOk('docker environment now is clean!');
|
||||
});
|
||||
|
||||
npmdockerCli.addCommand('speedtest').subscribe(async argvArg => {
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
})
|
||||
plugins.beautylog.figletSync('npmdocker');
|
||||
plugins.beautylog.ok('Starting speedtest');
|
||||
await plugins.smartshell.exec(
|
||||
await smartshellInstance.exec(
|
||||
`docker pull tianon/speedtest && docker run --rm tianon/speedtest`
|
||||
);
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import * as plugins from './npmdocker.plugins';
|
||||
import * as paths from './npmdocker.paths';
|
||||
|
||||
// interfaces
|
||||
import { IKeyValueObject } from 'qenv';
|
||||
import { IKeyValueObject } from '@pushrocks/qenv';
|
||||
|
||||
export interface IConfig {
|
||||
baseImage: string;
|
||||
|
@ -2,6 +2,10 @@ import * as plugins from './npmdocker.plugins';
|
||||
import * as paths from './npmdocker.paths';
|
||||
import * as snippets from './npmdocker.snippets';
|
||||
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
})
|
||||
|
||||
// interfaces
|
||||
import { IConfig } from './npmdocker.config';
|
||||
|
||||
@ -22,9 +26,10 @@ let dockerData = {
|
||||
* check if docker is available
|
||||
*/
|
||||
let checkDocker = () => {
|
||||
let done = plugins.q.defer();
|
||||
let done = plugins.smartpromise.defer();
|
||||
plugins.beautylog.ora.text('checking docker...');
|
||||
if (plugins.smartshell.which('docker')) {
|
||||
|
||||
if (smartshellInstance.exec('which docker')) {
|
||||
plugins.beautylog.ok('Docker found!');
|
||||
done.resolve();
|
||||
} else {
|
||||
@ -37,7 +42,7 @@ let checkDocker = () => {
|
||||
* builds the Dockerfile according to the config in the project
|
||||
*/
|
||||
let buildDockerFile = () => {
|
||||
let done = plugins.q.defer();
|
||||
let done = plugins.smartpromise.defer();
|
||||
plugins.beautylog.ora.text('building Dockerfile...');
|
||||
let dockerfile: string = snippets.dockerfileSnippet({
|
||||
baseImage: config.baseImage,
|
||||
@ -57,9 +62,9 @@ let buildDockerFile = () => {
|
||||
*/
|
||||
let buildDockerImage = async () => {
|
||||
plugins.beautylog.info('pulling latest base image from registry...');
|
||||
await plugins.smartshell.exec(`docker pull ${config.baseImage}`);
|
||||
await smartshellInstance.exec(`docker pull ${config.baseImage}`);
|
||||
plugins.beautylog.ora.text('building Dockerimage...');
|
||||
let execResult = await plugins.smartshell.execSilent(
|
||||
let execResult = await smartshellInstance.execSilent(
|
||||
`docker build -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
|
||||
);
|
||||
if (execResult.exitCode !== 0) {
|
||||
@ -98,11 +103,11 @@ let buildDockerSockString = async () => {
|
||||
* creates a container by running the built Dockerimage
|
||||
*/
|
||||
let runDockerImage = async () => {
|
||||
let done = plugins.q.defer();
|
||||
let done = plugins.smartpromise.defer();
|
||||
plugins.beautylog.ora.text('starting Container...');
|
||||
plugins.beautylog.ora.end();
|
||||
plugins.beautylog.log('now running Dockerimage');
|
||||
config.exitCode = (await plugins.smartshell.exec(
|
||||
config.exitCode = (await smartshellInstance.exec(
|
||||
`docker run ${dockerData.dockerProjectMountString} ${dockerData.dockerSockString} ${
|
||||
dockerData.dockerEnvString
|
||||
} --name ${dockerData.containerName} ${dockerData.imageTag}`
|
||||
@ -113,14 +118,14 @@ let runDockerImage = async () => {
|
||||
* cleans up: deletes the test container
|
||||
*/
|
||||
let deleteDockerContainer = async () => {
|
||||
await plugins.smartshell.execSilent(`docker rm -f ${dockerData.containerName}`);
|
||||
await smartshellInstance.execSilent(`docker rm -f ${dockerData.containerName}`);
|
||||
};
|
||||
|
||||
/**
|
||||
* cleans up deletes the test image
|
||||
*/
|
||||
let deleteDockerImage = async () => {
|
||||
await plugins.smartshell.execSilent(`docker rmi ${dockerData.imageTag}`).then(async response => {
|
||||
await smartshellInstance.execSilent(`docker rmi ${dockerData.imageTag}`).then(async response => {
|
||||
if (response.exitCode !== 0) {
|
||||
console.log(response.stdout);
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
import * as beautylog from 'beautylog';
|
||||
import * as npmextra from 'npmextra';
|
||||
import * as npmextra from '@pushrocks/npmextra';
|
||||
import * as path from 'path';
|
||||
import * as projectinfo from 'projectinfo';
|
||||
import * as q from '@pushrocks/smartpromise';
|
||||
import * as qenv from 'qenv';
|
||||
import * as projectinfo from '@pushrocks/projectinfo';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as qenv from '@pushrocks/qenv';
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as smartstring from 'smartstring';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
|
||||
export {
|
||||
beautylog,
|
||||
npmextra,
|
||||
path,
|
||||
projectinfo,
|
||||
q,
|
||||
smartpromise,
|
||||
qenv,
|
||||
smartcli,
|
||||
smartfile,
|
||||
|
Reference in New Issue
Block a user