Sorry, the diff of this file is not supported yet
| const logger = require('../../logger') | ||
| const ShellAgent = require('../Shell') | ||
| class SSHAgent { | ||
| constructor (opts = {}) { | ||
| Object.assign(this, opts) | ||
| this.shell = new ShellAgent({ | ||
| logger: logger.agent, | ||
| name: this.name || 'agent' | ||
| }) | ||
| } | ||
| async prepare () { | ||
| } | ||
| async ssh (args, opts = {}) { | ||
| opts.argsShow = args | ||
| return await this.shell.sh(['ssh', this.hostname, ...args], opts) | ||
| } | ||
| async sh (args, opts = {}) { | ||
| return await this.ssh(args, opts) | ||
| } | ||
| } | ||
| exports = module.exports = SSHAgent |
+16
-3
@@ -8,2 +8,3 @@ 'use strict' | ||
| const DockerAgent = require('./lib/agents/Docker') | ||
| const SSHAgent = require('./lib/agents/SSH') | ||
@@ -18,8 +19,8 @@ function Bert () { | ||
| const agent = new DockerAgent(Object.assign(opts, {name})) | ||
| const agent = new DockerAgent(Object.assign({}, opts, {name})) | ||
| agents[name] = agent | ||
| const originalSh = agent.sh | ||
| agent.sh = function (args, opts) { return originalSh.call(agent, args, opts/*, getStackTrace(2)*/) } | ||
| // const originalSh = agent.sh | ||
| // agent.sh = function (args, opts) { return originalSh.call(agent, args, opts/*, getStackTrace(2)*/) } | ||
@@ -31,2 +32,14 @@ this.agents = agents | ||
| Bert.prototype.remote = function (name, opts = {}) { | ||
| const remotes = this.remotes || {} | ||
| const remote = new SSHAgent(Object.assign({}, opts, {name})) | ||
| remotes[name] = remote | ||
| this.remotes = remotes | ||
| return remotes[name] | ||
| } | ||
| Bert.prototype.shell = new ShellAgent() | ||
@@ -33,0 +46,0 @@ Bert.prototype.sh = function (args, opts) { return this.shell.sh(args, opts/*, getStackTrace(1)*/) } |
@@ -14,3 +14,3 @@ const os = require('os') | ||
| class DockerAgent { | ||
| constructor (opts) { | ||
| constructor (opts = {}) { | ||
| Object.assign(this, opts) | ||
@@ -17,0 +17,0 @@ |
| const ms = require('ms') | ||
| const moment = require('moment') | ||
| const chalk = require('chalk') | ||
| /* exports */ | ||
| exports = module.exports = logger | ||
@@ -15,3 +17,3 @@ | ||
| getTimeTag(), | ||
| msg | ||
| chalk.reset(msg) | ||
| ].join(' ') | ||
@@ -22,5 +24,10 @@ } | ||
| logger.agent = agent | ||
| logger.task = startTask | ||
| logger.startTask = startTask | ||
| logger.stopTask = stopTask | ||
| logger.errTask = errTask | ||
| logger.task.start = startTask | ||
| logger.task.stop = stopTask | ||
| logger.task.error = errTask | ||
| logger.task.err = errTask | ||
@@ -27,0 +34,0 @@ function shell (args) { |
+5
-3
| { | ||
| "name": "bert.js", | ||
| "version": "0.0.17", | ||
| "description": "A task manager inspired on Gulp.", | ||
| "version": "0.0.18", | ||
| "description": "A child process async.", | ||
| "main": "index.js", | ||
@@ -21,3 +21,5 @@ "engines": { | ||
| }, | ||
| "keywords": [], | ||
| "keywords": [ | ||
| "child_process" | ||
| ], | ||
| "author": "Jonathan Delgado <hi@jon.soy>", | ||
@@ -24,0 +26,0 @@ "license": "MIT", |
+7
-5
@@ -1,10 +0,12 @@ | ||
| # 🍹 Bert | ||
| A task manager inspired on Gulp. | ||
| # 🍹 bert | ||
| A child process async. | ||
|  | ||
| #f1e05a | ||
|  | ||
| ## Features | ||
| - [x] Structure to cli `> bert [command]`. | ||
| - [x] Structure to cli `> bert [...tasks]`. | ||
| - [x] **DotBert**: How to read and how to work. | ||
| - [x] Run process with: `<engine>.sh`. | ||
| - [x] Run process with: `agent.sh()`. | ||
| - [x] Run this process on gulp. | ||
@@ -11,0 +13,0 @@ |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
24
4.35%520
7.22%137
1.48%50279
-4.26%