Merge pull request #453 from resin-io/41-select-os-version

Closes #451
This commit is contained in:
Eugene Mirotin 2017-03-23 01:32:15 +03:00 committed by GitHub
commit 65b2347b57
43 changed files with 2778 additions and 2773 deletions

View File

@ -10,3 +10,7 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[package.json]
indent_style = space
indent_size = 2

10
.gitignore vendored
View File

@ -13,9 +13,6 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
@ -27,10 +24,9 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
bin/node
release/build
npm-shrinkwrap.json
.resinconf
resinrc.yml
.idea
.vscode

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions;
commandOptions = require('./command-options');
@ -111,5 +109,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.login = {
signature: 'login',
description: 'login to resin.io',
@ -160,5 +158,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var _;
_ = require('lodash');
@ -80,5 +78,3 @@ limitations under the License.
boolean: true,
alias: 'f'
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions;
commandOptions = require('./command-options');
@ -238,5 +236,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions;
commandOptions = require('./command-options');
@ -323,5 +321,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions;
commandOptions = require('./command-options');
@ -131,5 +129,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var _, capitano, columnify, command, general, indent, messages, parse, print;
_ = require('lodash');
@ -133,5 +131,3 @@ limitations under the License.
}
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
wizard: require('./wizard'),
app: require('./app'),
@ -35,5 +33,3 @@ limitations under the License.
sync: require('./sync'),
ssh: require('./ssh')
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.version = {
signature: 'version',
description: 'output the version number',
@ -28,5 +26,3 @@ limitations under the License.
return done();
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions;
commandOptions = require('./command-options');
@ -94,5 +92,3 @@ limitations under the License.
}).then(_.partial(resin.models.key.create, params.name)).nodeify(done);
}
};
}).call(this);

View File

@ -1,5 +1,4 @@
// Generated by CoffeeScript 1.12.4
(function() {
var Docker, Promise, _, chalk, dockerPort, dockerTimeout, filterOutSupervisorContainer, form;
Promise = require('bluebird');
@ -110,5 +109,3 @@
};
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var CONFIGURATION_SCHEMA;
CONFIGURATION_SCHEMA = {
@ -129,5 +127,3 @@ limitations under the License.
}).asCallback(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'local flash <image>',
description: 'Flash an image to a drive',
@ -125,5 +123,3 @@ limitations under the License.
}).asCallback(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.configure = require('./configure');
exports.flash = require('./flash');
@ -32,5 +30,3 @@ limitations under the License.
exports.push = require('./push');
exports.stop = require('./stop');
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'local logs [deviceIp]',
description: 'Get or attach to logs of a running container on a resinOS device',
@ -65,5 +63,3 @@ limitations under the License.
})(this));
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'local promote [deviceIp]',
description: 'Promote a resinOS device',
@ -61,5 +59,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,22 +15,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var _, resinPush, resinPushHelp;
(function() {
var resinPush;
_ = require('lodash');
resinPush = require('resin-sync').capitano('resin-toolbox');
resinPush.signature = 'local push [deviceIp]';
resinPushHelp = 'Warning: \'resin local push\' requires an openssh-compatible client and \'rsync\' to\nbe correctly installed in your shell environment. For more information (including\nWindows support) please check the README here: https://github.com/resin-io/resin-cli\n\nUse this command to push your local changes to a container on a LAN-accessible resinOS device on the fly.\n\nIf `Dockerfile` or any file in the \'build-triggers\' list is changed,\na new container will be built and run on your device.\nIf not, changes will simply be synced with `rsync` into the application container.\n\nAfter every \'resin local push\' the updated settings will be saved in\n\'<source>/.resin-sync.yml\' and will be used in later invocations. You can\nalso change any option by editing \'.resin-sync.yml\' directly.\n\nHere is an example \'.resin-sync.yml\' :\n\n $ cat $PWD/.resin-sync.yml\n destination: \'/usr/src/app\'\n before: \'echo Hello\'\n after: \'echo Done\'\n ignore:\n - .git\n - node_modules/\n\nCommand line options have precedence over the ones saved in \'.resin-sync.yml\'.\n\nIf \'.gitignore\' is found in the source directory then all explicitly listed files will be\nexcluded when using rsync to update the container. You can choose to change this default behavior with the\n\'--skip-gitignore\' option.\n\nExamples:\n\n $ resin local push\n $ resin local push --app-name test-server --build-triggers package.json,requirements.txt\n $ resin local push --force-build\n $ resin local push --force-build --skip-logs\n $ resin local push --ignore lib/\n $ resin local push --verbose false\n $ resin local push 192.168.2.10 --source . --destination /usr/src/app\n $ resin local push 192.168.2.10 -s /home/user/myResinProject -d /usr/src/app --before \'echo Hello\' --after \'echo Done\'';
resinPush.help = {
help: 'Warning: \'resin local push\' requires an openssh-compatible client and \'rsync\' to\nbe correctly installed in your shell environment. For more information (including\nWindows support) please check the README here: https://github.com/resin-io/resin-cli\n\nUse this command to push your local changes to a container on a LAN-accessible resinOS device on the fly.\n\nIf `Dockerfile` or any file in the \'build-triggers\' list is changed, a new container will be built and run on your device.\nIf not, changes will simply be synced with `rsync` into the application container.\n\nAfter every \'resin local push\' the updated settings will be saved in\n\'<source>/.resin-sync.yml\' and will be used in later invocations. You can\nalso change any option by editing \'.resin-sync.yml\' directly.\n\nHere is an example \'.resin-sync.yml\' :\n\n $ cat $PWD/.resin-sync.yml\n destination: \'/usr/src/app\'\n before: \'echo Hello\'\n after: \'echo Done\'\n ignore:\n - .git\n - node_modules/\n\nCommand line options have precedence over the ones saved in \'.resin-sync.yml\'.\n\nIf \'.gitignore\' is found in the source directory then all explicitly listed files will be\nexcluded when using rsync to update the container. You can choose to change this default behavior with the\n\'--skip-gitignore\' option.\n\nExamples:\n\n $ resin local push\n $ resin local push --app-name test-server --build-triggers package.json,requirements.txt\n $ resin local push --force-build\n $ resin local push --force-build --skip-logs\n $ resin local push --ignore lib/\n $ resin local push --verbose false\n $ resin local push 192.168.2.10 --source . --destination /usr/src/app\n $ resin local push 192.168.2.10 -s /home/user/myResinProject -d /usr/src/app --before \'echo Hello\' --after \'echo Done\''
};
resinPush.primary = true;
resinPush.root = true;
module.exports = resinPush;
}).call(this);
module.exports = _.assign(resinPush, {
signature: 'local push [deviceIp]',
help: resinPushHelp,
primary: true,
root: true
});

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var dockerInfoProperties, dockerVersionProperties;
dockerInfoProperties = ['Containers', 'ContainersRunning', 'ContainersPaused', 'ContainersStopped', 'Images', 'Driver', 'SystemTime', 'KernelVersion', 'OperatingSystem', 'Architecture'];
@ -112,5 +110,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'local ssh [deviceIp]',
description: 'Get a shell into a resinOS device',
@ -90,5 +88,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'local stop [deviceIp]',
description: 'Stop a running container on a resinOS device',
@ -77,5 +75,3 @@ limitations under the License.
})(this));
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = {
signature: 'logs <uuid>',
description: 'show device logs',
@ -55,5 +53,3 @@ limitations under the License.
})["catch"](done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.set = {
signature: 'note <|note>',
description: 'set a device note',
@ -44,5 +42,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,16 +15,48 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var commandOptions, stepHandler;
var commandOptions, formatVersion, resolveVersion, stepHandler;
commandOptions = require('./command-options');
formatVersion = function(v, isRecommended) {
var result;
result = "v" + v;
if (isRecommended) {
result += ' (recommended)';
}
return result;
};
resolveVersion = function(deviceType, version) {
var form, resin;
if (version !== 'menu') {
return Promise.resolve(version);
}
form = require('resin-cli-form');
resin = require('resin-sdk-preconfigured');
return resin.models.os.getSupportedVersions(deviceType).then(function(arg) {
var choices, recommended, versions;
versions = arg.versions, recommended = arg.recommended;
choices = versions.map(function(v) {
return {
value: v,
name: formatVersion(v, v === recommended)
};
});
return form.ask({
message: 'Select the OS version:',
type: 'list',
choices: choices,
"default": recommended
});
});
};
exports.download = {
signature: 'os download <type>',
description: 'download an unconfigured os image',
help: 'Use this command to download an unconfigured os image for a certain device type.\n\nExamples:\n\n $ resin os download parallella -o ../foo/bar/parallella.img',
help: 'Use this command to download an unconfigured os image for a certain device type.\n\nIf version is not specified the newest stable (non-pre-release) version of OS\nis downloaded if available, or the newest version otherwise (if all existing\nversions for the given device type are pre-release).\n\nYou can pass `--version menu` to pick the OS version from the interactive menu\nof all available versions.\n\nExamples:\n\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version 1.24.1\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version ^1.20.0\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version latest\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version default\n $ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version menu',
permission: 'user',
options: [
{
@ -32,21 +64,38 @@ limitations under the License.
description: 'output path',
parameter: 'output',
alias: 'o',
required: 'You have to specify an output location'
required: 'You have to specify the output location'
}, {
signature: 'version',
description: "exact version number, or a valid semver range,\nor 'latest' (includes pre-releases),\nor 'default' (excludes pre-releases if at least one stable version is available),\nor 'recommended' (excludes pre-releases, will fail if only pre-release versions are available),\nor 'menu' (will show the interactive menu)",
parameter: 'version'
}
],
action: function(params, options, done) {
var fs, manager, rindle, unzip, visuals;
var Promise, displayVersion, fs, manager, rindle, unzip, visuals;
Promise = require('bluebird');
unzip = require('unzip2');
fs = require('fs');
rindle = require('rindle');
manager = require('resin-image-manager');
visuals = require('resin-cli-visuals');
console.info("Getting device operating system for " + params.type);
return manager.get(params.type).then(function(stream) {
displayVersion = '';
return Promise["try"](function() {
if (!options.version) {
console.warn('OS version is not specified, using the default version: the newest stable (non-pre-release) version if available, or the newest version otherwise (if all existing versions for the given device type are pre-release).');
return 'default';
}
return resolveVersion(params.type, options.version);
}).then(function(version) {
if (version !== 'default') {
displayVersion = " " + version;
}
return manager.get(params.type, version);
}).then(function(stream) {
var bar, output, spinner;
bar = new visuals.Progress('Downloading Device OS');
spinner = new visuals.Spinner('Downloading Device OS (size unknown)');
bar = new visuals.Progress("Downloading Device OS" + displayVersion);
spinner = new visuals.Spinner("Downloading Device OS" + displayVersion + " (size unknown)");
stream.on('progress', function(state) {
if (state != null) {
return bar.update(state);
@ -190,5 +239,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.list = {
signature: 'settings',
description: 'print current settings',
@ -28,5 +26,3 @@ limitations under the License.
return resin.settings.getAll().then(prettyjson.render).then(console.log).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var getSubShellCommand;
getSubShellCommand = function(command) {
@ -104,5 +102,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
module.exports = require('resin-sync').capitano('resin-cli');
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
exports.wizard = {
signature: 'quickstart [name]',
description: 'getting started with resin.io',
@ -60,5 +58,3 @@ limitations under the License.
}).nodeify(done);
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var Promise, _, actions, capitano, errors, events, plugins, resin, update;
_ = require('lodash');
@ -187,5 +185,3 @@ limitations under the License.
return capitano.executeAsync(cli);
});
})["catch"](errors.handle);
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var chalk, errors, patterns;
chalk = require('chalk');
@ -37,5 +35,3 @@ limitations under the License.
patterns.printErrorMessage(message);
return process.exit(error.exitCode || 1);
};
}).call(this);

View File

@ -1,5 +1,4 @@
// Generated by CoffeeScript 1.12.4
(function() {
var Mixpanel, Promise, _, capitanoState, packageJSON, resin;
_ = require('lodash');
@ -38,5 +37,3 @@
});
});
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var Promise, _, capitano, chalk, imagefs, os, president, resin, rindle;
Promise = require('bluebird');
@ -81,5 +79,3 @@ limitations under the License.
return resin.models.device.getManifestBySlug(deviceType);
});
};
}).call(this);

View File

@ -1,5 +1,4 @@
// Generated by CoffeeScript 1.12.4
(function() {
exports.gettingStarted = 'Run the following command to get a device started with Resin.io\n\n $ resin quickstart';
exports.reachingOut = 'If you need help, or just want to say hi, don\'t hesitate in reaching out at:\n\n GitHub: https://github.com/resin-io/resin-cli/issues/new\n Gitter: https://gitter.im/resin-io/chat';
@ -7,5 +6,3 @@
exports.getHelp = 'If you need help, don\'t hesitate in contacting us at:\n\n GitHub: https://github.com/resin-io/resin-cli/issues/new\n Gitter: https://gitter.im/resin-io/chat';
exports.resinAsciiArt = '______ _ _\n| ___ \\ (_) (_)\n| |_/ /___ ___ _ _ __ _ ___\n| // _ \\/ __| | \'_ \\ | |/ _ \\\n| |\\ \\ __/\\__ \\ | | | |_| | (_) |\n\\_| \\_\\___||___/_|_| |_(_)_|\\___/';
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var Promise, _, chalk, form, messages, resin, validation, visuals,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@ -218,5 +216,3 @@ limitations under the License.
console.error(chalk.red(message));
return console.error(chalk.red("\n" + messages.getHelp + "\n"));
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var _, capitano, nplugm, patterns;
nplugm = require('nplugm');
@ -40,5 +38,3 @@ limitations under the License.
return patterns.printErrorMessage(error.message);
});
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var isRoot, notifier, packageJSON, updateNotifier;
updateNotifier = require('update-notifier');
@ -47,5 +45,3 @@ limitations under the License.
return console.log('Notice that you might need administrator privileges depending on your setup\n');
}
};
}).call(this);

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
var validEmail;
validEmail = require('valid-email');
@ -41,5 +39,3 @@ limitations under the License.
}
return true;
};
}).call(this);

View File

@ -705,6 +705,10 @@ comma delimited paths to ignore when syncing
do not parse excluded/included files from .gitignore
#### --skip-restart
do not restart container after syncing
#### --before, -b &#60;command&#62;
execute a command before syncing
@ -780,9 +784,21 @@ device uuid
Use this command to download an unconfigured os image for a certain device type.
If version is not specified the newest stable (non-pre-release) version of OS
is downloaded if available, or the newest version otherwise (if all existing
versions for the given device type are pre-release).
You can pass `--version menu` to pick the OS version from the interactive menu
of all available versions.
Examples:
$ resin os download parallella -o ../foo/bar/parallella.img
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version 1.24.1
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version ^1.20.0
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version latest
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version default
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version menu
### Options
@ -790,6 +806,14 @@ Examples:
output path
#### --version &#60;version&#62;
exact version number, or a valid semver range,
or 'latest' (includes pre-releases),
or 'default' (excludes pre-releases if at least one stable version is available),
or 'recommended' (excludes pre-releases, will fail if only pre-release versions are available),
or 'menu' (will show the interactive menu)
## os configure &#60;image&#62; &#60;uuid&#62;
Use this command to configure a previously download operating system image with a device.

View File

@ -16,7 +16,7 @@ OPTIONS =
gulp.task 'coffee', [ 'lint' ], ->
gulp.src(OPTIONS.files.app)
.pipe(coffee(header: true))
.pipe(coffee(bare: true, header: true))
.pipe(gulp.dest(OPTIONS.directories.build))
gulp.task 'lint', ->
@ -30,5 +30,5 @@ gulp.task 'build', [
'coffee'
]
gulp.task 'watch', [ 'lint', 'coffee' ], ->
gulp.watch([ OPTIONS.files.coffee ], [ 'coffee' ])
gulp.task 'watch', [ 'build' ], ->
gulp.watch([ OPTIONS.files.coffee ], [ 'build' ])

View File

@ -18,20 +18,22 @@ limitations under the License.
# Returns the configuration object on success
#
_ = require('lodash')
resinPush = require('resin-sync').capitano('resin-toolbox')
# TODO: This is a temporary workaround to reuse the existing `rdt push`
# capitano frontend in `resin local push`.
resinPush.signature = 'local push [deviceIp]'
resinPush.help =
help: '''
resinPushHelp = '''
Warning: 'resin local push' requires an openssh-compatible client and 'rsync' to
be correctly installed in your shell environment. For more information (including
Windows support) please check the README here: https://github.com/resin-io/resin-cli
Use this command to push your local changes to a container on a LAN-accessible resinOS device on the fly.
If `Dockerfile` or any file in the 'build-triggers' list is changed, a new container will be built and run on your device.
If `Dockerfile` or any file in the 'build-triggers' list is changed,
a new container will be built and run on your device.
If not, changes will simply be synced with `rsync` into the application container.
After every 'resin local push' the updated settings will be saved in
@ -65,6 +67,10 @@ resinPush.help =
$ resin local push 192.168.2.10 --source . --destination /usr/src/app
$ resin local push 192.168.2.10 -s /home/user/myResinProject -d /usr/src/app --before 'echo Hello' --after 'echo Done'
'''
resinPush.primary = true
resinPush.root = true
module.exports = resinPush
module.exports = _.assign resinPush,
signature: 'local push [deviceIp]'
help: resinPushHelp
primary: true
root: true

View File

@ -16,25 +16,76 @@ limitations under the License.
commandOptions = require('./command-options')
formatVersion = (v, isRecommended) ->
result = "v#{v}"
if isRecommended
result += ' (recommended)'
return result
resolveVersion = (deviceType, version) ->
if version isnt 'menu'
return Promise.resolve(version)
form = require('resin-cli-form')
resin = require('resin-sdk-preconfigured')
resin.models.os.getSupportedVersions(deviceType)
.then ({ versions, recommended }) ->
choices = versions.map (v) ->
value: v
name: formatVersion(v, v is recommended)
return form.ask
message: 'Select the OS version:'
type: 'list'
choices: choices
default: recommended
exports.download =
signature: 'os download <type>'
description: 'download an unconfigured os image'
help: '''
Use this command to download an unconfigured os image for a certain device type.
If version is not specified the newest stable (non-pre-release) version of OS
is downloaded if available, or the newest version otherwise (if all existing
versions for the given device type are pre-release).
You can pass `--version menu` to pick the OS version from the interactive menu
of all available versions.
Examples:
$ resin os download parallella -o ../foo/bar/parallella.img
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version 1.24.1
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version ^1.20.0
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version latest
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version default
$ resin os download raspberrypi3 -o ../foo/bar/raspberry-pi.img --version menu
'''
permission: 'user'
options: [
{
signature: 'output'
description: 'output path'
parameter: 'output'
alias: 'o'
required: 'You have to specify an output location'
required: 'You have to specify the output location'
}
{
signature: 'version'
description: """
exact version number, or a valid semver range,
or 'latest' (includes pre-releases),
or 'default' (excludes pre-releases if at least one stable version is available),
or 'recommended' (excludes pre-releases, will fail if only pre-release versions are available),
or 'menu' (will show the interactive menu)
"""
parameter: 'version'
}
]
action: (params, options, done) ->
Promise = require('bluebird')
unzip = require('unzip2')
fs = require('fs')
rindle = require('rindle')
@ -43,9 +94,22 @@ exports.download =
console.info("Getting device operating system for #{params.type}")
manager.get(params.type).then (stream) ->
bar = new visuals.Progress('Downloading Device OS')
spinner = new visuals.Spinner('Downloading Device OS (size unknown)')
displayVersion = ''
Promise.try ->
if not options.version
console.warn('OS version is not specified, using the default version:
the newest stable (non-pre-release) version if available,
or the newest version otherwise (if all existing
versions for the given device type are pre-release).')
return 'default'
return resolveVersion(params.type, options.version)
.then (version) ->
if version isnt 'default'
displayVersion = " #{version}"
return manager.get(params.type, version)
.then (stream) ->
bar = new visuals.Progress("Downloading Device OS#{displayVersion}")
spinner = new visuals.Spinner("Downloading Device OS#{displayVersion} (size unknown)")
stream.on 'progress', (state) ->
if state?

View File

@ -14,8 +14,10 @@
},
"scripts": {
"build": "gulp build",
"prepublish": "npm run build",
"doc": "mkdir -p doc/ && coffee extras/capitanodoc/index.coffee > doc/cli.markdown"
"doc": "mkdir -p doc/ && coffee extras/capitanodoc/index.coffee > doc/cli.markdown",
"watch": "gulp watch",
"lint": "gulp lint",
"prepublish": "npm run build && npm run doc"
},
"keywords": [
"resin",
@ -34,9 +36,9 @@
"babel-preset-es2015": "^6.16.0",
"babel-register": "^6.16.3",
"bluebird": "^3.3.3",
"capitano": "~1.7.0",
"capitano": "^1.7.0",
"chalk": "^1.1.3",
"coffee-script": "~1.12.2",
"coffee-script": "~1.12.4",
"columnify": "^1.5.2",
"denymount": "^2.2.0",
"docker-toolbelt": "^1.3.3",
@ -51,7 +53,7 @@
"nplugm": "^3.0.0",
"president": "^2.0.1",
"prettyjson": "^1.1.3",
"reconfix": "0.0.3",
"reconfix": "^0.0.3",
"resin-cli-auth": "^1.0.0",
"resin-cli-errors": "^1.2.0",
"resin-cli-form": "^1.4.1",
@ -60,8 +62,8 @@
"resin-device-config": "^3.0.0",
"resin-device-init": "^2.1.0",
"resin-image-fs": "^2.1.2",
"resin-image-manager": "^4.0.0",
"resin-sdk-preconfigured": "^0.1.0",
"resin-image-manager": "^4.1.0",
"resin-sdk-preconfigured": "^0.1.1",
"resin-settings-client": "^3.5.0",
"resin-sync": "^7.0.0",
"rimraf": "^2.4.3",
@ -71,6 +73,6 @@
"underscore.string": "^3.1.1",
"unzip2": "^0.2.5",
"update-notifier": "^0.6.1",
"valid-email": "0.0.2"
"valid-email": "^0.0.2"
}
}