Generate JS

This commit is contained in:
Kostas Lekkas 2017-03-10 13:55:04 +00:00
parent 73dd625ede
commit 19c51929a9
No known key found for this signature in database
GPG Key ID: 7742375E5EDF01C3
7 changed files with 105 additions and 88 deletions

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.12.4
(function() {
var Docker, Promise, _, chalk, filterOutSupervisorContainer, form;
var Docker, Promise, _, chalk, dockerPort, dockerTimeout, filterOutSupervisorContainer, form;
Promise = require('bluebird');
@ -12,7 +12,11 @@
chalk = require('chalk');
filterOutSupervisorContainer = function(container) {
exports.dockerPort = dockerPort = 2375;
exports.dockerTimeout = dockerTimeout = 2000;
exports.filterOutSupervisorContainer = filterOutSupervisorContainer = function(container) {
var i, len, name, ref;
ref = container.Names;
for (i = 0, len = ref.length; i < len; i++) {
@ -24,16 +28,15 @@
return true;
};
module.exports = {
filterOutSupervisorContainer: filterOutSupervisorContainer,
selectContainerFromDevice: Promise.method(function(deviceIp, filterSupervisor) {
exports.selectContainerFromDevice = Promise.method(function(deviceIp, filterSupervisor) {
var docker;
if (filterSupervisor == null) {
filterSupervisor = false;
}
docker = new Docker({
host: deviceIp,
port: 2375
port: dockerPort,
timeout: dockerTimeout
});
return docker.listContainersAsync({
all: true
@ -61,13 +64,14 @@
})
});
});
}),
pipeContainerStream: Promise.method(function(arg) {
});
exports.pipeContainerStream = Promise.method(function(arg) {
var container, deviceIp, docker, follow, name, outStream, ref;
deviceIp = arg.deviceIp, name = arg.name, outStream = arg.outStream, follow = (ref = arg.follow) != null ? ref : false;
docker = new Docker({
host: deviceIp,
port: 2375
port: dockerPort
});
container = docker.getContainer(name);
return container.inspectAsync().then(function(containerInfo) {
@ -89,8 +93,9 @@
}
throw err;
});
}),
getSubShellCommand: function(command) {
});
exports.getSubShellCommand = function(command) {
var os;
os = require('os');
if (os.platform() === 'win32') {
@ -104,7 +109,6 @@
args: ['-c', command]
};
}
}
};
}).call(this);

View File

@ -34,6 +34,7 @@ limitations under the License.
alias: 'a'
}
],
root: true,
action: function(params, options, done) {
var Promise, forms, pipeContainerStream, ref, selectContainerFromDevice;
Promise = require('bluebird');

View File

@ -34,6 +34,7 @@ limitations under the License.
alias: 'p'
}
],
root: true,
action: function(params, options, done) {
var Promise, _, child_process, forms, getSubShellCommand, verbose;
child_process = require('child_process');

View File

@ -29,6 +29,8 @@ limitations under the License.
resinPush.primary = true;
resinPush.root = true;
module.exports = resinPush;
}).call(this);

View File

@ -41,14 +41,16 @@ limitations under the License.
}
],
primary: true,
root: true,
action: function(params, options, done) {
var Docker, Promise, SpinnerPromise, _, discover, prettyjson;
var Docker, Promise, SpinnerPromise, _, discover, dockerPort, dockerTimeout, prettyjson, ref;
Promise = require('bluebird');
_ = require('lodash');
prettyjson = require('prettyjson');
Docker = require('docker-toolbelt');
discover = require('resin-sync').discover;
SpinnerPromise = require('resin-cli-visuals').SpinnerPromise;
ref = require('./common'), dockerPort = ref.dockerPort, dockerTimeout = ref.dockerTimeout;
if (options.timeout != null) {
options.timeout *= 1000;
}
@ -59,13 +61,17 @@ limitations under the License.
stopMessage: 'Reporting scan results'
});
}).filter(function(arg) {
var address, docker;
var address;
address = arg.address;
return Promise["try"](function() {
var docker;
docker = new Docker({
host: address,
port: 2375
port: dockerPort,
timeout: dockerTimeout
});
return docker.infoAsync()["return"](true).catchReturn(false);
return docker.pingAsync();
})["return"](true).catchReturn(false);
}).tap(function(devices) {
if (_.isEmpty(devices)) {
throw new Error('Could not find any resinOS devices in the local network');
@ -75,7 +81,8 @@ limitations under the License.
host = arg.host, address = arg.address;
docker = new Docker({
host: address,
port: 2375
port: dockerPort,
timeout: dockerTimeout
});
return Promise.props({
dockerInfo: docker.infoAsync().catchReturn('Could not get Docker info'),

View File

@ -45,6 +45,7 @@ limitations under the License.
alias: 'p'
}
],
root: true,
action: function(params, options, done) {
var Promise, _, child_process, forms, getSubShellCommand, ref, selectContainerFromDevice, verbose;
child_process = require('child_process');

View File

@ -33,6 +33,7 @@ limitations under the License.
alias: 'a'
}
],
root: true,
action: function(params, options, done) {
var Promise, ResinLocalDockerUtils, chalk, config, filterOutSupervisorContainer, forms, ref, ref1, selectContainerFromDevice;
Promise = require('bluebird');