mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-24 18:45:07 +00:00
Compare commits
67 Commits
Author | SHA1 | Date | |
---|---|---|---|
b29ce3ee04 | |||
2b4394f3ce | |||
60f704eaa9 | |||
caa4fcf754 | |||
c4d1e4244e | |||
a6dc155028 | |||
9c65d11e66 | |||
26f50e7a74 | |||
e4773da1d7 | |||
dfd8086f63 | |||
ec513c61ad | |||
a96ab487ba | |||
cd28c985ce | |||
727af42ad4 | |||
e96d411f3e | |||
4a7d3d5945 | |||
03f05305cf | |||
af6e9ef85d | |||
8533a4a303 | |||
85f9234c74 | |||
064afd6705 | |||
978ff91f87 | |||
5cebbce7bb | |||
1cd0f02db5 | |||
77695bb505 | |||
4e4428fdbb | |||
6e978d74dd | |||
58974af77b | |||
11a0eae7a0 | |||
2a4ba895e5 | |||
19c019076e | |||
dfa18d3cb3 | |||
782c92885d | |||
a14dfa6cf1 | |||
f3b6f9d117 | |||
63b2b3feb6 | |||
9237dd25ac | |||
df9c4ce2fd | |||
fa5a7abbbf | |||
cd8bb7882e | |||
3c0378142a | |||
a524bffaa2 | |||
4b3decbe03 | |||
fa258a84cc | |||
5efa7309be | |||
6e6a01c33c | |||
94ce15bc2c | |||
b20ed34756 | |||
0b188b7ce9 | |||
80e0f20301 | |||
8410a709c9 | |||
13011cca23 | |||
53197856ab | |||
cb5bb69b47 | |||
4bfe52d73b | |||
58f557065e | |||
9d8228e1c6 | |||
fec840b897 | |||
8fbde4c452 | |||
0cc1765a1e | |||
f0346b1fd0 | |||
1bb798a8b8 | |||
4c35badcad | |||
6ba97cd961 | |||
af08a2f306 | |||
ded24432a5 | |||
bf124f196f |
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ bin/node
|
||||
release/build
|
||||
|
||||
npm-shrinkwrap.json
|
||||
.resinconf
|
||||
|
5
.hound.yml
Normal file
5
.hound.yml
Normal file
@ -0,0 +1,5 @@
|
||||
coffee_script:
|
||||
config_file: coffeelint.json
|
||||
|
||||
java_script:
|
||||
enabled: false
|
@ -1,5 +1,7 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, resin, visuals;
|
||||
var _, async, commandOptions, path, resin, vcs, visuals;
|
||||
|
||||
path = require('path');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -11,6 +13,8 @@
|
||||
|
||||
commandOptions = require('./command-options');
|
||||
|
||||
vcs = require('resin-vcs');
|
||||
|
||||
exports.create = {
|
||||
signature: 'app create <name>',
|
||||
description: 'create an application',
|
||||
@ -46,7 +50,7 @@
|
||||
exports.list = {
|
||||
signature: 'apps',
|
||||
description: 'list all applications',
|
||||
help: 'Use this command to list all your applications.\n\nNotice this command only shows the most important bits of information for each app.\nIf you want detailed information, use resin app <id> instead.\n\nExamples:\n\n $ resin apps',
|
||||
help: 'Use this command to list all your applications.\n\nNotice this command only shows the most important bits of information for each app.\nIf you want detailed information, use resin app <name> instead.\n\nExamples:\n\n $ resin apps',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.models.application.getAll(function(error, applications) {
|
||||
@ -60,12 +64,12 @@
|
||||
};
|
||||
|
||||
exports.info = {
|
||||
signature: 'app <id>',
|
||||
signature: 'app <name>',
|
||||
description: 'list a single application',
|
||||
help: 'Use this command to show detailed information for a single application.\n\nExamples:\n\n $ resin app 91',
|
||||
help: 'Use this command to show detailed information for a single application.\n\nExamples:\n\n $ resin app MyApp',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.models.application.get(params.id, function(error, application) {
|
||||
return resin.models.application.get(params.name, function(error, application) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
@ -76,50 +80,80 @@
|
||||
};
|
||||
|
||||
exports.restart = {
|
||||
signature: 'app restart <id>',
|
||||
signature: 'app restart <name>',
|
||||
description: 'restart an application',
|
||||
help: 'Use this command to restart all devices that belongs to a certain application.\n\nExamples:\n\n $ resin app restart 91',
|
||||
help: 'Use this command to restart all devices that belongs to a certain application.\n\nExamples:\n\n $ resin app restart MyApp',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.models.application.restart(params.id, done);
|
||||
return resin.models.application.restart(params.name, done);
|
||||
}
|
||||
};
|
||||
|
||||
exports.remove = {
|
||||
signature: 'app rm <id>',
|
||||
signature: 'app rm <name>',
|
||||
description: 'remove an application',
|
||||
help: 'Use this command to remove a resin.io application.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app rm 91\n $ resin app rm 91 --yes',
|
||||
help: 'Use this command to remove a resin.io application.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app rm MyApp\n $ resin app rm MyApp --yes',
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return visuals.patterns.remove('application', options.yes, function(callback) {
|
||||
return resin.models.application.remove(params.id, callback);
|
||||
return resin.models.application.remove(params.name, callback);
|
||||
}, done);
|
||||
}
|
||||
};
|
||||
|
||||
exports.init = {
|
||||
signature: 'init <id>',
|
||||
description: 'init an application',
|
||||
help: 'Use this command to associate a local project to an existing resin.io application.\n\nThe application should be a git repository before issuing this command.\nNotice this command adds a `resin` git remote to your application.\n\nExamples:\n\n $ cd myApp && resin init 91',
|
||||
exports.associate = {
|
||||
signature: 'app associate <name>',
|
||||
description: 'associate a resin project',
|
||||
help: 'Use this command to associate a project directory with a resin application.\n\nThis command adds a \'resin\' git remote to the directory and runs git init if necessary.\n\nExamples:\n\n $ resin app associate MyApp\n $ resin app associate MyApp --project my/app/directory',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var currentDirectory;
|
||||
currentDirectory = process.cwd();
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
return resin.vcs.isResinProject(currentDirectory, callback);
|
||||
}, function(isResinProject, callback) {
|
||||
var error;
|
||||
if (isResinProject) {
|
||||
error = new Error('Project is already a resin application.');
|
||||
return callback(error);
|
||||
}
|
||||
return callback();
|
||||
return vcs.initialize(currentDirectory, callback);
|
||||
}, function(callback) {
|
||||
return resin.models.application.get(params.id, callback);
|
||||
return resin.models.application.get(params.name, callback);
|
||||
}, function(application, callback) {
|
||||
return resin.vcs.initProjectWithApplication(application, currentDirectory, callback);
|
||||
return vcs.addRemote(currentDirectory, application.git_repository, callback);
|
||||
}
|
||||
], function(error, remoteUrl) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
console.info("git repository added: " + remoteUrl);
|
||||
return done(null, remoteUrl);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.init = {
|
||||
signature: 'init',
|
||||
description: 'init an application',
|
||||
help: 'Use this command to initialise a directory as a resin application.\n\nThis command performs the following steps:\n - Create a resin.io application.\n - Initialize the current directory as a git repository.\n - Add the corresponding git remote to the application.\n\nExamples:\n\n $ resin init\n $ resin init --project my/app/directory',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var currentDirectory;
|
||||
currentDirectory = process.cwd();
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
var currentDirectoryBasename;
|
||||
currentDirectoryBasename = path.basename(currentDirectory);
|
||||
return visuals.widgets.ask('What is the name of your application?', currentDirectoryBasename, callback);
|
||||
}, function(applicationName, callback) {
|
||||
return exports.create.action({
|
||||
name: applicationName
|
||||
}, options, function(error) {
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
return callback(null, applicationName);
|
||||
});
|
||||
}, function(applicationName, callback) {
|
||||
return exports.associate.action({
|
||||
name: applicationName
|
||||
}, options, callback);
|
||||
}
|
||||
], done);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
(function() {
|
||||
var _, async, resin, url, visuals;
|
||||
var TOKEN_URL, _, async, open, resin, settings, url, visuals;
|
||||
|
||||
open = require('open');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -9,45 +11,49 @@
|
||||
|
||||
resin = require('resin-sdk');
|
||||
|
||||
settings = require('resin-settings-client');
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
exports.login = {
|
||||
signature: 'login',
|
||||
description: 'login to resin.io',
|
||||
help: 'Use this command to login to your resin.io account.\nYou need to login before you can use most of the commands this tool provides.\n\nYou can pass your credentials as `--username` and `--password` options, or you can omit the\ncredentials, in which case the tool will present you with an interactive login form.\n\nExamples:\n\n $ resin login --username <username> --password <password>\n $ resin login',
|
||||
options: [
|
||||
{
|
||||
signature: 'username',
|
||||
parameter: 'username',
|
||||
description: 'user name',
|
||||
alias: 'u'
|
||||
}, {
|
||||
signature: 'password',
|
||||
parameter: 'password',
|
||||
description: 'user password',
|
||||
alias: 'p'
|
||||
}
|
||||
],
|
||||
exports.whoami = {
|
||||
signature: 'whoami',
|
||||
description: 'whoami',
|
||||
help: 'Use this command to get the logged in user name.\n\nExamples:\n\n $ resin whoami',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var hasOptionCredentials;
|
||||
hasOptionCredentials = !_.isEmpty(options);
|
||||
if (hasOptionCredentials) {
|
||||
if (!options.username) {
|
||||
return done(new Error('Missing username'));
|
||||
return resin.auth.whoami(function(error, username) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
if (!options.password) {
|
||||
return done(new Error('Missing password'));
|
||||
}
|
||||
}
|
||||
console.log(username);
|
||||
return done();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences');
|
||||
|
||||
exports.login = {
|
||||
signature: 'login [token]',
|
||||
description: 'login to resin.io',
|
||||
help: "Use this command to login to your resin.io account.\n\nTo login, you need your token, which is accesible from the preferences page:\n\n " + TOKEN_URL + "\n\nExamples:\n\n $ resin login\n $ resin login \"eyJ0eXAiOiJKV1Qi...\"",
|
||||
action: function(params, options, done) {
|
||||
console.info("To login to the Resin CLI, you need your unique token, which is accesible from\nthe preferences page at " + TOKEN_URL + "\n\nAttempting to open a browser at that location...");
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
if (hasOptionCredentials) {
|
||||
return callback(null, options);
|
||||
} else {
|
||||
return visuals.widgets.login(callback);
|
||||
return open(TOKEN_URL, function(error) {
|
||||
if (error != null) {
|
||||
console.error("Unable to open a web browser in the current environment.\nPlease visit " + TOKEN_URL + " manually.");
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}, function(callback) {
|
||||
if (params.token != null) {
|
||||
return callback(null, params.token);
|
||||
}
|
||||
}, function(credentials, callback) {
|
||||
return resin.auth.login(credentials, callback);
|
||||
return visuals.widgets.ask('What\'s your token? (visible in the preferences page)', null, callback);
|
||||
}, function(token, callback) {
|
||||
return resin.auth.loginWithToken(token, done);
|
||||
}
|
||||
], done);
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
(function() {
|
||||
var _;
|
||||
|
||||
_ = require('lodash');
|
||||
|
||||
exports.yes = {
|
||||
signature: 'yes',
|
||||
description: 'confirm non interactively',
|
||||
@ -6,14 +10,17 @@
|
||||
alias: 'y'
|
||||
};
|
||||
|
||||
exports.application = {
|
||||
exports.optionalApplication = {
|
||||
signature: 'application',
|
||||
parameter: 'application',
|
||||
description: 'application id',
|
||||
alias: ['a', 'app'],
|
||||
required: 'You have to specify an application'
|
||||
description: 'application name',
|
||||
alias: ['a', 'app']
|
||||
};
|
||||
|
||||
exports.application = _.defaults({
|
||||
required: 'You have to specify an application'
|
||||
}, exports.optionalApplication);
|
||||
|
||||
exports.network = {
|
||||
signature: 'network',
|
||||
parameter: 'network',
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, osAction, path, resin, visuals;
|
||||
var _, async, commandOptions, osAction, path, resin, vcs, visuals;
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
vcs = require('resin-vcs');
|
||||
|
||||
commandOptions = require('./command-options');
|
||||
|
||||
osAction = require('./os');
|
||||
@ -18,7 +20,7 @@
|
||||
exports.list = {
|
||||
signature: 'devices',
|
||||
description: 'list all devices',
|
||||
help: 'Use this command to list all devices that belong to a certain application.\n\nExamples:\n\n $ resin devices --application 91',
|
||||
help: 'Use this command to list all devices that belong to a certain application.\n\nExamples:\n\n $ resin devices --application MyApp',
|
||||
options: [commandOptions.application],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
@ -33,12 +35,12 @@
|
||||
};
|
||||
|
||||
exports.info = {
|
||||
signature: 'device <id>',
|
||||
signature: 'device <name>',
|
||||
description: 'list a single device',
|
||||
help: 'Use this command to show information about a single device.\n\nExamples:\n\n $ resin device 317',
|
||||
help: 'Use this command to show information about a single device.\n\nExamples:\n\n $ resin device MyDevice',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.models.device.get(params.id, function(error, device) {
|
||||
return resin.models.device.get(params.name, function(error, device) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
@ -49,14 +51,14 @@
|
||||
};
|
||||
|
||||
exports.remove = {
|
||||
signature: 'device rm <id>',
|
||||
signature: 'device rm <name>',
|
||||
description: 'remove a device',
|
||||
help: 'Use this command to remove a device from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device rm 317\n $ resin device rm 317 --yes',
|
||||
help: 'Use this command to remove a device from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device rm MyDevice\n $ resin device rm MyDevice --yes',
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return visuals.patterns.remove('device', options.yes, function(callback) {
|
||||
return resin.models.device.remove(params.id, callback);
|
||||
return resin.models.device.remove(params.name, callback);
|
||||
}, done);
|
||||
}
|
||||
};
|
||||
@ -72,19 +74,19 @@
|
||||
};
|
||||
|
||||
exports.rename = {
|
||||
signature: 'device rename <id> [name]',
|
||||
signature: 'device rename <name> [newName]',
|
||||
description: 'rename a resin device',
|
||||
help: 'Use this command to rename a device.\n\nIf you omit the name, you\'ll get asked for it interactively.\n\nExamples:\n\n $ resin device rename 317 MyPi\n $ resin device rename 317',
|
||||
help: 'Use this command to rename a device.\n\nIf you omit the name, you\'ll get asked for it interactively.\n\nExamples:\n\n $ resin device rename MyDevice MyPi\n $ resin device rename MyDevice',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
if (!_.isEmpty(params.name)) {
|
||||
return callback(null, params.name);
|
||||
if (!_.isEmpty(params.newName)) {
|
||||
return callback(null, params.newName);
|
||||
}
|
||||
return visuals.widgets.ask('How do you want to name this device?', callback);
|
||||
}, function(name, callback) {
|
||||
return resin.models.device.rename(params.id, name, callback);
|
||||
return visuals.widgets.ask('How do you want to name this device?', null, callback);
|
||||
}, function(newName, callback) {
|
||||
return resin.models.device.rename(params.name, newName, callback);
|
||||
}
|
||||
], done);
|
||||
}
|
||||
@ -109,20 +111,28 @@
|
||||
exports.init = {
|
||||
signature: 'device init [device]',
|
||||
description: 'initialise a device with resin os',
|
||||
help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nYou need to configure the network type and other settings:\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nExamples:\n\n $ resin device init --application 91 --network ethernet\n $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret',
|
||||
options: [commandOptions.application, commandOptions.network, commandOptions.wifiSsid, commandOptions.wifiKey],
|
||||
help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nYou need to configure the network type and other settings:\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nYou can omit network related options to be asked about them interactively.\n\nExamples:\n\n $ resin device init\n $ resin device init --application 91\n $ resin device init --application 91 --network ethernet\n $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret',
|
||||
options: [commandOptions.optionalApplication, commandOptions.network, commandOptions.wifiSsid, commandOptions.wifiKey],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
params.id = options.application;
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
if (options.application != null) {
|
||||
return callback(null, options.application);
|
||||
}
|
||||
return vcs.getApplicationId(process.cwd(), callback);
|
||||
}, function(applicationId, callback) {
|
||||
params.id = applicationId;
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
}
|
||||
return visuals.patterns.selectDrive(callback);
|
||||
}, function(device, callback) {
|
||||
var message;
|
||||
params.device = device;
|
||||
return visuals.patterns.confirm(options.yes, "This will completely erase " + params.device + ". Are you sure you want to continue?", callback);
|
||||
message = "This will completely erase " + params.device + ". Are you sure you want to continue?";
|
||||
return visuals.patterns.confirm(options.yes, message, callback);
|
||||
}, function(confirmed, callback) {
|
||||
if (!confirmed) {
|
||||
return done();
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var _, async, examplesData, fs, gitCli, path, resin, visuals;
|
||||
var _, async, examplesData, fs, path, resin, vcs, visuals;
|
||||
|
||||
async = require('async');
|
||||
|
||||
@ -9,12 +9,12 @@
|
||||
|
||||
_ = require('lodash');
|
||||
|
||||
gitCli = require('git-cli');
|
||||
|
||||
resin = require('resin-sdk');
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
vcs = require('resin-vcs');
|
||||
|
||||
examplesData = require('../data/examples.json');
|
||||
|
||||
exports.list = {
|
||||
@ -64,28 +64,14 @@
|
||||
help: 'Use this command to clone an example application to the current directory\n\nThis command outputs information about the cloning process.\nUse `--quiet` to remove that output.\n\nExample:\n\n $ resin example clone 3',
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var example;
|
||||
var currentDirectory, example;
|
||||
example = examplesData[params.id - 1];
|
||||
if (example == null) {
|
||||
return done(new Error("Unknown example: " + id));
|
||||
}
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
var exampleAbsolutePath;
|
||||
exampleAbsolutePath = path.join(process.cwd(), example.name);
|
||||
return fs.exists(exampleAbsolutePath, function(exists) {
|
||||
var error;
|
||||
if (!exists) {
|
||||
return callback();
|
||||
}
|
||||
error = new Error("Directory exists: " + example.name);
|
||||
return callback(error);
|
||||
});
|
||||
}, function(callback) {
|
||||
console.info("Cloning " + example.display_name + " to " + example.name);
|
||||
return gitCli.Repository.clone(example.repository, example.name, callback);
|
||||
}
|
||||
], done);
|
||||
currentDirectory = process.cwd();
|
||||
console.info("Cloning " + example.display_name + " to " + currentDirectory);
|
||||
return vcs.clone(example.repository, currentDirectory, done);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -6,10 +6,9 @@
|
||||
exports.version = {
|
||||
signature: 'version',
|
||||
description: 'output the version number',
|
||||
help: 'Display the Resin CLI, as well as the bundled NodeJS version.',
|
||||
help: 'Display the Resin CLI version.',
|
||||
action: function() {
|
||||
console.log(packageJSON.name + ": " + packageJSON.version);
|
||||
return console.log("node: " + process.version);
|
||||
return console.log(packageJSON.version);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var _, async, capitano, commandOptions, fs, resin, visuals;
|
||||
var SSH_KEY_WIDTH, _, async, capitano, commandOptions, fs, resin, visuals;
|
||||
|
||||
_ = require('lodash');
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
}
|
||||
};
|
||||
|
||||
SSH_KEY_WIDTH = 43;
|
||||
|
||||
exports.info = {
|
||||
signature: 'key <id>',
|
||||
description: 'list a single ssh key',
|
||||
@ -40,12 +42,10 @@
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
return resin.models.key.get(params.id, function(error, key) {
|
||||
var sshKeyWidth;
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
sshKeyWidth = resin.settings.get('sshKeyWidth');
|
||||
key.public_key = '\n' + visuals.helpers.chop(key.public_key, sshKeyWidth);
|
||||
key.public_key = '\n' + visuals.helpers.chop(key.public_key, SSH_KEY_WIDTH);
|
||||
console.log(visuals.widgets.table.vertical(key, ['id', 'title', 'public_key']));
|
||||
return done();
|
||||
});
|
||||
|
@ -8,12 +8,12 @@
|
||||
exports.set = {
|
||||
signature: 'note <|note>',
|
||||
description: 'set a device note',
|
||||
help: 'Use this command to set or update a device note.\n\nIf note command isn\'t passed, the tool attempts to read from `stdin`.\n\nTo view the notes, use $ resin device <id>.\n\nExamples:\n\n $ resin note "My useful note" --device 317\n $ cat note.txt | resin note --device 317',
|
||||
help: 'Use this command to set or update a device note.\n\nIf note command isn\'t passed, the tool attempts to read from `stdin`.\n\nTo view the notes, use $ resin device <name>.\n\nExamples:\n\n $ resin note "My useful note" --device MyDevice\n $ cat note.txt | resin note --device MyDevice',
|
||||
options: [
|
||||
{
|
||||
signature: 'device',
|
||||
parameter: 'device',
|
||||
description: 'device id',
|
||||
description: 'device name',
|
||||
alias: ['d', 'dev'],
|
||||
required: 'You have to specify a device'
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
(function() {
|
||||
var _, async, commandOptions, diskio, fs, mkdirp, os, path, progressStream, resin, visuals;
|
||||
var _, async, commandOptions, elevate, mkdirp, npm, os, packageJSON, path, resin, updateActions, visuals;
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
fs = require('fs');
|
||||
|
||||
os = require('os');
|
||||
|
||||
async = require('async');
|
||||
@ -17,46 +15,68 @@
|
||||
|
||||
visuals = require('resin-cli-visuals');
|
||||
|
||||
progressStream = require('progress-stream');
|
||||
|
||||
diskio = require('diskio');
|
||||
|
||||
commandOptions = require('./command-options');
|
||||
|
||||
npm = require('../npm');
|
||||
|
||||
packageJSON = require('../../package.json');
|
||||
|
||||
updateActions = require('./update');
|
||||
|
||||
elevate = require('../elevate');
|
||||
|
||||
exports.download = {
|
||||
signature: 'os download <id>',
|
||||
description: 'download device OS',
|
||||
help: 'Use this command to download the device OS configured to a specific network.\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nBy default, this command saved the downloaded image into a resin specific directory.\nYou can save it to a custom location by specifying the `--output` option.\n\nExamples:\n\n $ resin os download 91 --network ethernet\n $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123\n $ resin os download 91 --network ethernet --output ~/MyResinOS.zip',
|
||||
help: 'Use this command to download the device OS configured to a specific network.\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nAlternatively, you can omit all kind of network configuration options to configure interactively.\n\nYou have to specify an output location with the `--output` option.\n\nExamples:\n\n $ resin os download 91 --output ~/MyResinOS.zip\n $ resin os download 91 --network ethernet --output ~/MyResinOS.zip\n $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip\n $ resin os download 91 --network ethernet --output ~/MyResinOS.zip',
|
||||
options: [
|
||||
commandOptions.network, commandOptions.wifiSsid, commandOptions.wifiKey, {
|
||||
signature: 'output',
|
||||
parameter: 'output',
|
||||
description: 'output file',
|
||||
alias: 'o'
|
||||
alias: 'o',
|
||||
required: 'You need to specify an output file'
|
||||
}
|
||||
],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var fileName, osParams;
|
||||
var osParams;
|
||||
osParams = {
|
||||
network: options.network,
|
||||
wifiSsid: options.ssid,
|
||||
wifiKey: options.key,
|
||||
appId: params.id
|
||||
};
|
||||
fileName = resin.models.os.generateCacheName(osParams);
|
||||
if (options.output == null) {
|
||||
options.output = path.join(resin.settings.get('directories.os'), fileName);
|
||||
}
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
if (osParams.network != null) {
|
||||
return callback();
|
||||
}
|
||||
return visuals.patterns.selectNetworkParameters(function(error, parameters) {
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
_.extend(osParams, parameters);
|
||||
return callback();
|
||||
});
|
||||
}, function(callback) {
|
||||
return mkdirp(path.dirname(options.output), _.unary(callback));
|
||||
}, function(callback) {
|
||||
var bar;
|
||||
var bar, spinner;
|
||||
console.info("Destination file: " + options.output + "\n");
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS');
|
||||
return resin.models.os.download(osParams, options.output, callback, function(state) {
|
||||
return bar.update(state);
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)');
|
||||
return resin.models.os.download(osParams, options.output, function(error) {
|
||||
spinner.stop();
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
}, function(state) {
|
||||
if (state != null) {
|
||||
return bar.update(state);
|
||||
} else {
|
||||
return spinner.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
], function(error) {
|
||||
@ -76,8 +96,18 @@
|
||||
options: [commandOptions.yes],
|
||||
permission: 'user',
|
||||
action: function(params, options, done) {
|
||||
var bundle;
|
||||
bundle = require('../devices/raspberry-pi');
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
return npm.isUpdated(packageJSON.name, packageJSON.version, callback);
|
||||
}, function(isUpdated, callback) {
|
||||
if (isUpdated) {
|
||||
return callback();
|
||||
}
|
||||
console.info('Resin CLI is outdated.\n\nIn order to avoid device compatibility issues, this command\nrequires that you have the Resin CLI updated.\n\nUpdating now...');
|
||||
return updateActions.update.action(params, options, _.unary(callback));
|
||||
}, function(callback) {
|
||||
if (params.device != null) {
|
||||
return callback(null, params.device);
|
||||
}
|
||||
@ -96,37 +126,22 @@
|
||||
message = "This will completely erase " + params.device + ". Are you sure you want to continue?";
|
||||
return visuals.patterns.confirm(options.yes, message, callback);
|
||||
}, function(confirmed, callback) {
|
||||
var bar, error, imageFileSize, imageFileStream, progress;
|
||||
var bar;
|
||||
if (!confirmed) {
|
||||
return done();
|
||||
}
|
||||
imageFileSize = fs.statSync(params.image).size;
|
||||
if (imageFileSize === 0) {
|
||||
error = new Error("Invalid OS image: " + params.image + ". The image is 0 bytes.");
|
||||
return callback(error);
|
||||
}
|
||||
progress = progressStream({
|
||||
length: imageFileSize,
|
||||
time: 500
|
||||
});
|
||||
if (!options.quiet) {
|
||||
bar = new visuals.widgets.Progress('Writing Device OS');
|
||||
progress.on('progress', function(status) {
|
||||
return bar.update(status);
|
||||
});
|
||||
}
|
||||
imageFileStream = fs.createReadStream(params.image).pipe(progress);
|
||||
return diskio.writeStream(params.device, imageFileStream, callback);
|
||||
bar = new visuals.widgets.Progress('Writing Device OS');
|
||||
params.progress = _.bind(bar.update, bar);
|
||||
return bundle.write(params, callback);
|
||||
}
|
||||
], function(error) {
|
||||
var resinWritePath, windosu;
|
||||
var resinWritePath;
|
||||
if (error == null) {
|
||||
return done();
|
||||
}
|
||||
if (_.all([os.platform() === 'win32', error.code === 'EPERM' || error.code === 'EACCES', !options.fromScript])) {
|
||||
windosu = require('windosu');
|
||||
if (elevate.shouldElevate(error) && !options.fromScript) {
|
||||
resinWritePath = "\"" + (path.join(__dirname, '..', '..', 'bin', 'resin-write')) + "\"";
|
||||
return windosu.exec("\"" + process.argv[0] + "\" " + resinWritePath + " \"" + params.image + "\" \"" + params.device + "\"");
|
||||
return elevate.run("\"" + process.argv[0] + "\" " + resinWritePath + " \"" + params.image + "\" \"" + params.device + "\"");
|
||||
} else {
|
||||
return done(error);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
(function() {
|
||||
var open, resin, url;
|
||||
var open, settings, url;
|
||||
|
||||
open = require('open');
|
||||
|
||||
url = require('url');
|
||||
|
||||
resin = require('resin-sdk');
|
||||
settings = require('resin-settings-client');
|
||||
|
||||
exports.preferences = {
|
||||
signature: 'preferences',
|
||||
@ -13,9 +13,8 @@
|
||||
help: 'Use this command to open the preferences form.\n\nIn the future, we will allow changing all preferences directly from the terminal.\nFor now, we open your default web browser and point it to the web based preferences form.\n\nExamples:\n\n $ resin preferences',
|
||||
permission: 'user',
|
||||
action: function() {
|
||||
var absUrl, preferencesUrl;
|
||||
preferencesUrl = resin.settings.get('urls.preferences');
|
||||
absUrl = url.resolve(resin.settings.get('remoteUrl'), preferencesUrl);
|
||||
var absUrl;
|
||||
absUrl = url.resolve(settings.get('remoteUrl'), '/preferences');
|
||||
return open(absUrl);
|
||||
}
|
||||
};
|
||||
|
@ -1,11 +1,13 @@
|
||||
(function() {
|
||||
var _, async, npm, packageJSON;
|
||||
var _, child_process, npm, packageJSON, president;
|
||||
|
||||
async = require('async');
|
||||
_ = require('lodash');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
child_process = require('child_process');
|
||||
|
||||
npm = require('npm');
|
||||
president = require('president');
|
||||
|
||||
npm = require('../npm');
|
||||
|
||||
packageJSON = require('../../package.json');
|
||||
|
||||
@ -14,27 +16,35 @@
|
||||
description: 'update the resin cli',
|
||||
help: 'Use this command to update the Resin CLI\n\nThis command outputs information about the update process.\nUse `--quiet` to remove that output.\n\nThe Resin CLI checks for updates once per day.\n\nMajor updates require a manual update with this update command,\nwhile minor updates are applied automatically.\n\nExamples:\n\n $ resin update',
|
||||
action: function(params, options, done) {
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
options = {
|
||||
loglevel: 'silent',
|
||||
global: true
|
||||
};
|
||||
return npm.load(options, _.unary(callback));
|
||||
}, function(callback) {
|
||||
return npm.commands.update([packageJSON.name], function(error, data) {
|
||||
return callback(error, data);
|
||||
});
|
||||
}, function(data, callback) {
|
||||
var newVersion;
|
||||
if (_.isEmpty(data)) {
|
||||
return callback(new Error('You are already running the latest version'));
|
||||
}
|
||||
newVersion = _.last(_.first(_.last(data)).split('@'));
|
||||
console.info("Upgraded " + packageJSON.name + " to v" + newVersion + ".");
|
||||
return callback();
|
||||
return npm.isUpdated(packageJSON.name, packageJSON.version, function(error, isUpdated) {
|
||||
var command, onUpdate;
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
], done);
|
||||
if (isUpdated) {
|
||||
return done(new Error('You\'re already running the latest version.'));
|
||||
}
|
||||
onUpdate = function(error, stdout, stderr) {
|
||||
if (error != null) {
|
||||
return done(error);
|
||||
}
|
||||
if (!_.isEmpty(stderr)) {
|
||||
return done(new Error(stderr));
|
||||
}
|
||||
console.info("Upgraded " + packageJSON.name + ".");
|
||||
return done();
|
||||
};
|
||||
command = "npm install --global " + packageJSON.name;
|
||||
return child_process.exec(command, function(error, stdout, stderr) {
|
||||
if (error != null) {
|
||||
return onUpdate(null, stdout, stderr);
|
||||
}
|
||||
if (_.any([error.code === 3, error.code === 'EPERM', error.code === 'ACCES'])) {
|
||||
return president.execute(command, onUpdate);
|
||||
}
|
||||
return done(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,6 +77,8 @@
|
||||
|
||||
capitano.command(actions.app.restart);
|
||||
|
||||
capitano.command(actions.app.associate);
|
||||
|
||||
capitano.command(actions.app.init);
|
||||
|
||||
capitano.command(actions.device.list);
|
||||
@ -150,10 +152,6 @@
|
||||
return update.check(callback);
|
||||
}, function(callback) {
|
||||
return plugins.register('resin-plugin-', callback);
|
||||
}, function(callback) {
|
||||
var dataPrefix;
|
||||
dataPrefix = resin.settings.get('dataPrefix');
|
||||
return resin.data.prefix.set(dataPrefix, callback);
|
||||
}, function(callback) {
|
||||
var cli;
|
||||
cli = capitano.parse(process.argv);
|
||||
|
30
build/devices/raspberry-pi.js
Normal file
30
build/devices/raspberry-pi.js
Normal file
@ -0,0 +1,30 @@
|
||||
(function() {
|
||||
var diskio, fs, progressStream;
|
||||
|
||||
fs = require('fs');
|
||||
|
||||
progressStream = require('progress-stream');
|
||||
|
||||
diskio = require('diskio');
|
||||
|
||||
exports.name = 'Raspberry Pi';
|
||||
|
||||
exports.write = function(options, callback) {
|
||||
var error, imageFileSize, imageFileStream, progress;
|
||||
imageFileSize = fs.statSync(options.image).size;
|
||||
if (imageFileSize === 0) {
|
||||
error = new Error("Invalid OS image: " + options.image + ". The image is 0 bytes.");
|
||||
return callback(error);
|
||||
}
|
||||
progress = progressStream({
|
||||
length: imageFileSize,
|
||||
time: 500
|
||||
});
|
||||
if (!options.quiet) {
|
||||
progress.on('progress', options.progress);
|
||||
}
|
||||
imageFileStream = fs.createReadStream(options.image).pipe(progress);
|
||||
return diskio.writeStream(options.device, imageFileStream, callback);
|
||||
};
|
||||
|
||||
}).call(this);
|
25
build/elevate.js
Normal file
25
build/elevate.js
Normal file
@ -0,0 +1,25 @@
|
||||
(function() {
|
||||
var _, isWindows, os, path;
|
||||
|
||||
_ = require('lodash');
|
||||
|
||||
os = require('os');
|
||||
|
||||
path = require('path');
|
||||
|
||||
isWindows = function() {
|
||||
return os.platform() === 'win32';
|
||||
};
|
||||
|
||||
exports.shouldElevate = function(error) {
|
||||
return _.all([isWindows(), error.code === 'EPERM' || error.code === 'EACCES']);
|
||||
};
|
||||
|
||||
exports.run = function(command) {
|
||||
if (!isWindows()) {
|
||||
return;
|
||||
}
|
||||
return require('windosu').exec(command);
|
||||
};
|
||||
|
||||
}).call(this);
|
@ -28,6 +28,8 @@
|
||||
message += 'Try running this command again prefixing it with `sudo`.';
|
||||
}
|
||||
console.error(message);
|
||||
} else if (error.code === 'ENOGIT') {
|
||||
console.error('Git is not installed on this system.\nHead over to http://git-scm.com to install it and run this command again.');
|
||||
} else if (error.message != null) {
|
||||
console.error(error.message);
|
||||
}
|
||||
|
38
build/npm.js
Normal file
38
build/npm.js
Normal file
@ -0,0 +1,38 @@
|
||||
(function() {
|
||||
var _, async, npm;
|
||||
|
||||
npm = require('npm');
|
||||
|
||||
async = require('async');
|
||||
|
||||
_ = require('lodash-contrib');
|
||||
|
||||
exports.getLatestVersion = function(name, callback) {
|
||||
return async.waterfall([
|
||||
function(callback) {
|
||||
var options;
|
||||
options = {
|
||||
loglevel: 'silent',
|
||||
global: true
|
||||
};
|
||||
return npm.load(options, _.unary(callback));
|
||||
}, function(callback) {
|
||||
return npm.commands.view([name], true, function(error, data) {
|
||||
var versions;
|
||||
versions = _.keys(data);
|
||||
return callback(error, _.first(versions));
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
};
|
||||
|
||||
exports.isUpdated = function(name, currentVersion, callback) {
|
||||
return exports.getLatestVersion(name, function(error, latestVersion) {
|
||||
if (error != null) {
|
||||
return callback(error);
|
||||
}
|
||||
return callback(null, currentVersion === latestVersion);
|
||||
});
|
||||
};
|
||||
|
||||
}).call(this);
|
@ -1,68 +0,0 @@
|
||||
{
|
||||
"name": "resin-cli",
|
||||
"version": "0.0.1",
|
||||
"description": "Git Push to your devices",
|
||||
"main": "./lib/actions/index.coffee",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@bitbucket.org:rulemotion/resin-cli.git"
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"bundled_engine": "v0.12.0",
|
||||
"man": [
|
||||
"./man/resin.1",
|
||||
"./man/resin-completion.1",
|
||||
"./man/resin-plugins.1"
|
||||
],
|
||||
"bin": {
|
||||
"resin": "./bin/resin"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "gulp build",
|
||||
"test": "gult test",
|
||||
"install": "node build/install-node.js bin/node"
|
||||
},
|
||||
"keywords": [
|
||||
"resin",
|
||||
"git"
|
||||
],
|
||||
"author": "Juan Cruz Viotti <juanchiviotti@gmail.com>",
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"windosu": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.9.2",
|
||||
"gulp": "~3.8.9",
|
||||
"gulp-coffee": "^2.2.0",
|
||||
"gulp-coffeelint": "~0.4.0",
|
||||
"gulp-marked-man": "~0.3.1",
|
||||
"gulp-mocha": "~1.1.1",
|
||||
"gulp-shell": "^0.2.11",
|
||||
"gulp-util": "~3.0.1",
|
||||
"mocha": "~2.0.1",
|
||||
"mocha-notifier-reporter": "~0.1.0",
|
||||
"run-sequence": "~1.0.2",
|
||||
"sinon": "~1.12.1",
|
||||
"sinon-chai": "~2.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"capitano": "~1.5.0",
|
||||
"coffee-script": "~1.8.0",
|
||||
"conf.js": "^0.1.1",
|
||||
"diskio": "^1.0.0",
|
||||
"drivelist": "^1.2.0",
|
||||
"git-cli": "~0.8.2",
|
||||
"lodash": "~2.4.1",
|
||||
"lodash-contrib": "~241.4.14",
|
||||
"mkdirp": "~0.5.0",
|
||||
"node-binary": "^1.0.1",
|
||||
"nplugm": "^2.0.0",
|
||||
"open": "0.0.5",
|
||||
"progress-stream": "^0.5.0",
|
||||
"resin-cli-visuals": "resin-io/resin-cli-visuals",
|
||||
"resin-sdk": "resin-io/resin-sdk",
|
||||
"underscore.string": "~2.4.0"
|
||||
}
|
||||
}
|
96
capitanodoc.json
Normal file
96
capitanodoc.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"title": "Resin CLI Documentation",
|
||||
"introduction": "This tool allows you to interact with the resin.io api from the comfort of your command line.\n\nTo get started download the CLI from npm.\n\n\t$ npm install resin-cli -g\n\nThen authenticate yourself:\n\n\t$ resin login\n\nNow you have access to all the commands referenced below.",
|
||||
"categories": [
|
||||
{
|
||||
"title": "Application",
|
||||
"files": [
|
||||
"lib/actions/app.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Authentication",
|
||||
"files": [
|
||||
"lib/actions/auth.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Device",
|
||||
"files": [
|
||||
"lib/actions/device.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Drive",
|
||||
"files": [
|
||||
"lib/actions/drive.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Environment Variables",
|
||||
"files": [
|
||||
"lib/actions/environment-variables.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Examples",
|
||||
"files": [
|
||||
"lib/actions/examples.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Help",
|
||||
"files": [
|
||||
"lib/actions/help.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Information",
|
||||
"files": [
|
||||
"lib/actions/info.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Keys",
|
||||
"files": [
|
||||
"lib/actions/keys.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Logs",
|
||||
"files": [
|
||||
"lib/actions/logs.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Notes",
|
||||
"files": [
|
||||
"lib/actions/notes.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "OS",
|
||||
"files": [
|
||||
"lib/actions/os.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Plugin",
|
||||
"files": [
|
||||
"lib/actions/plugin.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Preferences",
|
||||
"files": [
|
||||
"lib/actions/preferences.coffee"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Update",
|
||||
"files": [
|
||||
"lib/actions/update.coffee"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
# app create <name>
|
||||
|
||||
Use this command to create a new resin.io application.
|
||||
|
||||
You can specify the application type with the `--type` option.
|
||||
Otherwise, an interactive dropdown will be shown for you to select from.
|
||||
|
||||
You can see a list of supported device types with
|
||||
|
||||
$ resin devices supported
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app create MyApp
|
||||
$ resin app create MyApp --type raspberry-pi
|
||||
|
||||
## Options
|
||||
|
||||
### --type, -t <type>
|
||||
|
||||
application type
|
@ -1,7 +0,0 @@
|
||||
# app <id>
|
||||
|
||||
Use this command to show detailed information for a single application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app 91
|
@ -1,10 +0,0 @@
|
||||
# init <id>
|
||||
|
||||
Use this command to associate a local project to an existing resin.io application.
|
||||
|
||||
The application should be a git repository before issuing this command.
|
||||
Notice this command adds a `resin` git remote to your application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ cd myApp && resin init 91
|
@ -1,10 +0,0 @@
|
||||
# apps
|
||||
|
||||
Use this command to list all your applications.
|
||||
|
||||
Notice this command only shows the most important bits of information for each app.
|
||||
If you want detailed information, use resin app <id> instead.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin apps
|
@ -1,17 +0,0 @@
|
||||
# app rm <id>
|
||||
|
||||
Use this command to remove a resin.io application.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app rm 91
|
||||
$ resin app rm 91 --yes
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,7 +0,0 @@
|
||||
# app restart <id>
|
||||
|
||||
Use this command to restart all devices that belongs to a certain application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app restart 91
|
@ -1,22 +0,0 @@
|
||||
# login
|
||||
|
||||
Use this command to login to your resin.io account.
|
||||
You need to login before you can use most of the commands this tool provides.
|
||||
|
||||
You can pass your credentials as `--username` and `--password` options, or you can omit the
|
||||
credentials, in which case the tool will present you with an interactive login form.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin login --username <username> --password <password>
|
||||
$ resin login
|
||||
|
||||
## Options
|
||||
|
||||
### --username, -u <username>
|
||||
|
||||
user name
|
||||
|
||||
### --password, -p <password>
|
||||
|
||||
user password
|
@ -1,7 +0,0 @@
|
||||
# logout
|
||||
|
||||
Use this command to logout from your resin.io account.o
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin logout
|
@ -1,31 +0,0 @@
|
||||
# signup
|
||||
|
||||
Use this command to signup for a resin.io account.
|
||||
|
||||
If signup is successful, you'll be logged in to your new user automatically.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin signup
|
||||
Email: me@mycompany.com
|
||||
Username: johndoe
|
||||
Password: ***********
|
||||
|
||||
$ resin signup --email me@mycompany.com --username johndoe --password ***********
|
||||
|
||||
$ resin whoami
|
||||
johndoe
|
||||
|
||||
## Options
|
||||
|
||||
### --email, -e <email>
|
||||
|
||||
user email
|
||||
|
||||
### --username, -u <username>
|
||||
|
||||
user name
|
||||
|
||||
### --password, -p <user password>
|
||||
|
||||
user password
|
@ -1,7 +0,0 @@
|
||||
# whoami
|
||||
|
||||
Use this command to find out the current logged in username.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin whoami
|
774
doc/cli.markdown
Normal file
774
doc/cli.markdown
Normal file
@ -0,0 +1,774 @@
|
||||
# Resin CLI Documentation
|
||||
|
||||
This tool allows you to interact with the resin.io api from the comfort of your command line.
|
||||
|
||||
To get started download the CLI from npm.
|
||||
|
||||
$ npm install resin-cli -g
|
||||
|
||||
Then authenticate yourself:
|
||||
|
||||
$ resin login
|
||||
|
||||
Now you have access to all the commands referenced below.
|
||||
|
||||
# Table of contents
|
||||
|
||||
- Application
|
||||
|
||||
- [app create <name>](#/pages/using/cli.md#app-create-60-name-62-)
|
||||
- [apps](#/pages/using/cli.md#apps)
|
||||
- [app <name>](#/pages/using/cli.md#app-60-name-62-)
|
||||
- [app restart <name>](#/pages/using/cli.md#app-restart-60-name-62-)
|
||||
- [app rm <name>](#/pages/using/cli.md#app-rm-60-name-62-)
|
||||
- [app associate <name>](#/pages/using/cli.md#app-associate-60-name-62-)
|
||||
- [init](#/pages/using/cli.md#init)
|
||||
|
||||
- Authentication
|
||||
|
||||
- [whoami](#/pages/using/cli.md#whoami)
|
||||
- [login [token]](#/pages/using/cli.md#login-token-)
|
||||
- [logout](#/pages/using/cli.md#logout)
|
||||
- [signup](#/pages/using/cli.md#signup)
|
||||
|
||||
- Device
|
||||
|
||||
- [devices](#/pages/using/cli.md#devices)
|
||||
- [device <name>](#/pages/using/cli.md#device-60-name-62-)
|
||||
- [device rm <name>](#/pages/using/cli.md#device-rm-60-name-62-)
|
||||
- [device identify <uuid>](#/pages/using/cli.md#device-identify-60-uuid-62-)
|
||||
- [device rename <name> [newName]](#/pages/using/cli.md#device-rename-60-name-62-newname-)
|
||||
- [devices supported](#/pages/using/cli.md#devices-supported)
|
||||
- [device init [device]](#/pages/using/cli.md#device-init-device-)
|
||||
|
||||
- Drive
|
||||
|
||||
- [drives](#/pages/using/cli.md#drives)
|
||||
|
||||
- Environment Variables
|
||||
|
||||
- [envs](#/pages/using/cli.md#envs)
|
||||
- [env rm <id>](#/pages/using/cli.md#env-rm-60-id-62-)
|
||||
- [env add <key> [value]](#/pages/using/cli.md#env-add-60-key-62-value-)
|
||||
- [env rename <id> <value>](#/pages/using/cli.md#env-rename-60-id-62-60-value-62-)
|
||||
|
||||
- Examples
|
||||
|
||||
- [examples](#/pages/using/cli.md#examples)
|
||||
- [example <id>](#/pages/using/cli.md#example-60-id-62-)
|
||||
- [example clone <id>](#/pages/using/cli.md#example-clone-60-id-62-)
|
||||
|
||||
- Help
|
||||
|
||||
- [help [command...]](#/pages/using/cli.md#help-command-)
|
||||
|
||||
- Information
|
||||
|
||||
- [version](#/pages/using/cli.md#version)
|
||||
|
||||
- Keys
|
||||
|
||||
- [keys](#/pages/using/cli.md#keys)
|
||||
- [key <id>](#/pages/using/cli.md#key-60-id-62-)
|
||||
- [key rm <id>](#/pages/using/cli.md#key-rm-60-id-62-)
|
||||
- [key add <name> [path]](#/pages/using/cli.md#key-add-60-name-62-path-)
|
||||
|
||||
- Logs
|
||||
|
||||
- [logs <uuid>](#/pages/using/cli.md#logs-60-uuid-62-)
|
||||
|
||||
- Notes
|
||||
|
||||
- [note <|note>](#/pages/using/cli.md#note-60-note-62-)
|
||||
|
||||
- OS
|
||||
|
||||
- [os download <id>](#/pages/using/cli.md#os-download-60-id-62-)
|
||||
- [os install <image> [device]](#/pages/using/cli.md#os-install-60-image-62-device-)
|
||||
|
||||
- Plugin
|
||||
|
||||
- [plugins](#/pages/using/cli.md#plugins)
|
||||
- [plugin install <name>](#/pages/using/cli.md#plugin-install-60-name-62-)
|
||||
- [plugin update <name>](#/pages/using/cli.md#plugin-update-60-name-62-)
|
||||
- [plugin rm <name>](#/pages/using/cli.md#plugin-rm-60-name-62-)
|
||||
|
||||
- Preferences
|
||||
|
||||
- [preferences](#/pages/using/cli.md#preferences)
|
||||
|
||||
- Update
|
||||
|
||||
- [update](#/pages/using/cli.md#update)
|
||||
|
||||
# Application
|
||||
|
||||
## app create <name>
|
||||
|
||||
Use this command to create a new resin.io application.
|
||||
|
||||
You can specify the application type with the `--type` option.
|
||||
Otherwise, an interactive dropdown will be shown for you to select from.
|
||||
|
||||
You can see a list of supported device types with
|
||||
|
||||
$ resin devices supported
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app create MyApp
|
||||
$ resin app create MyApp --type raspberry-pi
|
||||
|
||||
### Options
|
||||
|
||||
#### --type, -t <type>
|
||||
|
||||
application type
|
||||
|
||||
## apps
|
||||
|
||||
Use this command to list all your applications.
|
||||
|
||||
Notice this command only shows the most important bits of information for each app.
|
||||
If you want detailed information, use resin app <name> instead.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin apps
|
||||
|
||||
## app <name>
|
||||
|
||||
Use this command to show detailed information for a single application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app MyApp
|
||||
|
||||
## app restart <name>
|
||||
|
||||
Use this command to restart all devices that belongs to a certain application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app restart MyApp
|
||||
|
||||
## app rm <name>
|
||||
|
||||
Use this command to remove a resin.io application.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app rm MyApp
|
||||
$ resin app rm MyApp --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
## app associate <name>
|
||||
|
||||
Use this command to associate a project directory with a resin application.
|
||||
|
||||
This command adds a 'resin' git remote to the directory and runs git init if necessary.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app associate MyApp
|
||||
$ resin app associate MyApp --project my/app/directory
|
||||
|
||||
## init
|
||||
|
||||
Use this command to initialise a directory as a resin application.
|
||||
|
||||
This command performs the following steps:
|
||||
- Create a resin.io application.
|
||||
- Initialize the current directory as a git repository.
|
||||
- Add the corresponding git remote to the application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin init
|
||||
$ resin init --project my/app/directory
|
||||
|
||||
# Authentication
|
||||
|
||||
## whoami
|
||||
|
||||
Use this command to find out the current logged in username.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin whoami
|
||||
|
||||
## login [token]
|
||||
|
||||
Use this command to login to your resin.io account.
|
||||
|
||||
To login, you need your token, which is accesible from the preferences page:
|
||||
|
||||
https://staging.resin.io/preferences
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin login
|
||||
$ resin login "eyJ0eXAiOiJKV1Qi..."
|
||||
|
||||
## logout
|
||||
|
||||
Use this command to logout from your resin.io account.o
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin logout
|
||||
|
||||
## signup
|
||||
|
||||
Use this command to signup for a resin.io account.
|
||||
|
||||
If signup is successful, you'll be logged in to your new user automatically.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin signup
|
||||
Email: me@mycompany.com
|
||||
Username: johndoe
|
||||
Password: ***********
|
||||
|
||||
$ resin signup --email me@mycompany.com --username johndoe --password ***********
|
||||
|
||||
$ resin whoami
|
||||
johndoe
|
||||
|
||||
### Options
|
||||
|
||||
#### --email, -e <email>
|
||||
|
||||
user email
|
||||
|
||||
#### --username, -u <username>
|
||||
|
||||
user name
|
||||
|
||||
#### --password, -p <user password>
|
||||
|
||||
user password
|
||||
|
||||
# Device
|
||||
|
||||
## devices
|
||||
|
||||
Use this command to list all devices that belong to a certain application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin devices --application MyApp
|
||||
|
||||
### Options
|
||||
|
||||
#### --application, --a,app, --a,app <application>
|
||||
|
||||
application name
|
||||
|
||||
## device <name>
|
||||
|
||||
Use this command to show information about a single device.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device MyDevice
|
||||
|
||||
## device rm <name>
|
||||
|
||||
Use this command to remove a device from resin.io.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rm MyDevice
|
||||
$ resin device rm MyDevice --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
## device identify <uuid>
|
||||
|
||||
Use this command to identify a device.
|
||||
|
||||
In the Raspberry Pi, the ACT led is blinked several times.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828
|
||||
|
||||
## device rename <name> [newName]
|
||||
|
||||
Use this command to rename a device.
|
||||
|
||||
If you omit the name, you'll get asked for it interactively.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rename MyDevice MyPi
|
||||
$ resin device rename MyDevice
|
||||
|
||||
## devices supported
|
||||
|
||||
Use this command to get the list of all supported devices
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin devices supported
|
||||
|
||||
## device init [device]
|
||||
|
||||
Use this command to download the OS image of a certain application and write it to an SD Card.
|
||||
|
||||
Note that this command requires admin privileges.
|
||||
|
||||
If `device` is omitted, you will be prompted to select a device interactively.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
You need to configure the network type and other settings:
|
||||
|
||||
Ethernet:
|
||||
You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".
|
||||
|
||||
Wifi:
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
You can omit network related options to be asked about them interactively.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device init
|
||||
$ resin device init --application 91
|
||||
$ resin device init --application 91 --network ethernet
|
||||
$ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret
|
||||
|
||||
### Options
|
||||
|
||||
#### --application, --a,app, --a,app <application>
|
||||
|
||||
application name
|
||||
|
||||
#### --network, -n <network>
|
||||
|
||||
network type
|
||||
|
||||
#### --ssid, -s <ssid>
|
||||
|
||||
wifi ssid, if network is wifi
|
||||
|
||||
#### --key, -k <key>
|
||||
|
||||
wifi key, if network is wifi
|
||||
|
||||
# Drive
|
||||
|
||||
## drives
|
||||
|
||||
Use this command to list all drives that are connected to your machine.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin drives
|
||||
|
||||
# Environment Variables
|
||||
|
||||
## envs
|
||||
|
||||
Use this command to list all environment variables for a particular application.
|
||||
Notice we will support per-device environment variables soon.
|
||||
|
||||
This command lists all custom environment variables set on the devices running
|
||||
the application. If you want to see all environment variables, including private
|
||||
ones used by resin, use the verbose option.
|
||||
|
||||
Example:
|
||||
|
||||
$ resin envs --application 91
|
||||
$ resin envs --application 91 --verbose
|
||||
|
||||
### Options
|
||||
|
||||
#### --application, --a,app, --a,app <application>
|
||||
|
||||
application name
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
show private environment variables
|
||||
|
||||
## env rm <id>
|
||||
|
||||
Use this command to remove an environment variable from an application.
|
||||
|
||||
Don't remove resin specific variables, as things might not work as expected.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env rm 215
|
||||
$ resin env rm 215 --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
## env add <key> [value]
|
||||
|
||||
Use this command to add an enviroment variable to an application.
|
||||
|
||||
You need to pass the `--application` option.
|
||||
|
||||
If value is omitted, the tool will attempt to use the variable's value
|
||||
as defined in your host machine.
|
||||
|
||||
If the value is grabbed from the environment, a warning message will be printed.
|
||||
Use `--quiet` to remove it.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env add EDITOR vim -a 91
|
||||
$ resin env add TERM -a 91
|
||||
|
||||
### Options
|
||||
|
||||
#### --application, --a,app, --a,app <application>
|
||||
|
||||
application name
|
||||
|
||||
## env rename <id> <value>
|
||||
|
||||
Use this command to rename an enviroment variable from an application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env rename 376 emacs
|
||||
|
||||
# Examples
|
||||
|
||||
## examples
|
||||
|
||||
Use this command to list available example applications from resin.io
|
||||
|
||||
Example:
|
||||
|
||||
$ resin examples
|
||||
|
||||
## example <id>
|
||||
|
||||
Use this command to show information of a single example application
|
||||
|
||||
Example:
|
||||
|
||||
$ resin example 3
|
||||
|
||||
## example clone <id>
|
||||
|
||||
Use this command to clone an example application to the current directory
|
||||
|
||||
This command outputs information about the cloning process.
|
||||
Use `--quiet` to remove that output.
|
||||
|
||||
Example:
|
||||
|
||||
$ resin example clone 3
|
||||
|
||||
# Help
|
||||
|
||||
## help [command...]
|
||||
|
||||
Get detailed help for an specific command.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin help apps
|
||||
$ resin help os download
|
||||
|
||||
# Information
|
||||
|
||||
## version
|
||||
|
||||
Display the Resin CLI version.
|
||||
|
||||
# Keys
|
||||
|
||||
## keys
|
||||
|
||||
Use this command to list all your SSH keys.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin keys
|
||||
|
||||
## key <id>
|
||||
|
||||
Use this command to show information about a single SSH key.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key 17
|
||||
|
||||
## key rm <id>
|
||||
|
||||
Use this command to remove a SSH key from resin.io.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key rm 17
|
||||
$ resin key rm 17 --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
## key add <name> [path]
|
||||
|
||||
Use this command to associate a new SSH key with your account.
|
||||
|
||||
If `path` is omitted, the command will attempt
|
||||
to read the SSH key from stdin.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key add Main ~/.ssh/id_rsa.pub
|
||||
$ cat ~/.ssh/id_rsa.pub | resin key add Main
|
||||
|
||||
# Logs
|
||||
|
||||
## logs <uuid>
|
||||
|
||||
Use this command to show logs for a specific device.
|
||||
|
||||
By default, the command prints all log messages and exit.
|
||||
|
||||
To limit the output to the n last lines, use the `--num` option along with a number.
|
||||
This is similar to doing `resin logs <uuid> | tail -n X`.
|
||||
|
||||
To continuously stream output, and see new logs in real time, use the `--tail` option.
|
||||
|
||||
Note that for now you need to provide the whole UUID for this command to work correctly,
|
||||
and the tool won't notice if you're using an invalid UUID.
|
||||
|
||||
This is due to some technical limitations that we plan to address soon.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828
|
||||
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20
|
||||
$ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail
|
||||
|
||||
### Options
|
||||
|
||||
#### --num, -n <num>
|
||||
|
||||
number of lines to display
|
||||
|
||||
#### --tail, -t
|
||||
|
||||
continuously stream output
|
||||
|
||||
# Notes
|
||||
|
||||
## note <|note>
|
||||
|
||||
Use this command to set or update a device note.
|
||||
|
||||
If note command isn't passed, the tool attempts to read from `stdin`.
|
||||
|
||||
To view the notes, use $ resin device <name>.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin note "My useful note" --device MyDevice
|
||||
$ cat note.txt | resin note --device MyDevice
|
||||
|
||||
### Options
|
||||
|
||||
#### --device, --d,dev, --d,dev <device>
|
||||
|
||||
device name
|
||||
|
||||
# OS
|
||||
|
||||
## os download <id>
|
||||
|
||||
Use this command to download the device OS configured to a specific network.
|
||||
|
||||
Ethernet:
|
||||
You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".
|
||||
|
||||
Wifi:
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
Alternatively, you can omit all kind of network configuration options to configure interactively.
|
||||
|
||||
You have to specify an output location with the `--output` option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os download 91 --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
||||
|
||||
### Options
|
||||
|
||||
#### --network, -n <network>
|
||||
|
||||
network type
|
||||
|
||||
#### --ssid, -s <ssid>
|
||||
|
||||
wifi ssid, if network is wifi
|
||||
|
||||
#### --key, -k <key>
|
||||
|
||||
wifi key, if network is wifi
|
||||
|
||||
#### --output, -o <output>
|
||||
|
||||
output file
|
||||
|
||||
## os install <image> [device]
|
||||
|
||||
Use this command to write an operating system image to a device.
|
||||
|
||||
Note that this command requires admin privileges.
|
||||
|
||||
If `device` is omitted, you will be prompted to select a device interactively.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
See the `drives` command to get a list of all connected devices to your machine and their respective ids.
|
||||
|
||||
In Mac OS X:
|
||||
|
||||
$ sudo diskutil unmountDisk /dev/xxx
|
||||
|
||||
In GNU/Linux:
|
||||
|
||||
$ sudo umount /dev/xxx
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os install rpi.iso /dev/disk2
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
# Plugin
|
||||
|
||||
## plugins
|
||||
|
||||
Use this command to list all the installed resin plugins.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugins
|
||||
|
||||
## plugin install <name>
|
||||
|
||||
Use this command to install a resin plugin
|
||||
|
||||
Use `--quiet` to prevent information logging.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin install hello
|
||||
|
||||
## plugin update <name>
|
||||
|
||||
Use this command to update a resin plugin
|
||||
|
||||
Use `--quiet` to prevent information logging.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin update hello
|
||||
|
||||
## plugin rm <name>
|
||||
|
||||
Use this command to remove a resin.io plugin.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin rm hello
|
||||
$ resin plugin rm hello --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non interactively
|
||||
|
||||
# Preferences
|
||||
|
||||
## preferences
|
||||
|
||||
Use this command to open the preferences form.
|
||||
|
||||
In the future, we will allow changing all preferences directly from the terminal.
|
||||
For now, we open your default web browser and point it to the web based preferences form.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin preferences
|
||||
|
||||
# Update
|
||||
|
||||
## update
|
||||
|
||||
Use this command to update the Resin CLI
|
||||
|
||||
This command outputs information about the update process.
|
||||
Use `--quiet` to remove that output.
|
||||
|
||||
The Resin CLI checks for updates once per day.
|
||||
|
||||
Major updates require a manual update with this update command,
|
||||
while minor updates are applied automatically.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin update
|
||||
|
@ -1,9 +0,0 @@
|
||||
# device identify <uuid>
|
||||
|
||||
Use this command to identify a device.
|
||||
|
||||
In the Raspberry Pi, the ACT led is blinked several times.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828
|
@ -1,7 +0,0 @@
|
||||
# device <id>
|
||||
|
||||
Use this command to show information about a single device.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device 317
|
@ -1,46 +0,0 @@
|
||||
# device init [device]
|
||||
|
||||
Use this command to download the OS image of a certain application and write it to an SD Card.
|
||||
|
||||
Note that this command requires admin privileges.
|
||||
|
||||
If `device` is omitted, you will be prompted to select a device interactively.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
You need to configure the network type and other settings:
|
||||
|
||||
Ethernet:
|
||||
You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".
|
||||
|
||||
Wifi:
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device init --application 91 --network ethernet
|
||||
$ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret
|
||||
|
||||
## Options
|
||||
|
||||
### --application, --a,app, --a,app <application>
|
||||
|
||||
application id
|
||||
|
||||
### --network, -n <network>
|
||||
|
||||
network type
|
||||
|
||||
### --ssid, -s <ssid>
|
||||
|
||||
wifi ssid, if network is wifi
|
||||
|
||||
### --key, -k <key>
|
||||
|
||||
wifi key, if network is wifi
|
@ -1,13 +0,0 @@
|
||||
# devices
|
||||
|
||||
Use this command to list all devices that belong to a certain application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin devices --application 91
|
||||
|
||||
## Options
|
||||
|
||||
### --application, --a,app, --a,app <application>
|
||||
|
||||
application id
|
@ -1,17 +0,0 @@
|
||||
# device rm <id>
|
||||
|
||||
Use this command to remove a device from resin.io.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rm 317
|
||||
$ resin device rm 317 --yes
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,10 +0,0 @@
|
||||
# device rename <id> [name]
|
||||
|
||||
Use this command to rename a device.
|
||||
|
||||
If you omit the name, you'll get asked for it interactively.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rename 317 MyPi
|
||||
$ resin device rename 317
|
@ -1,7 +0,0 @@
|
||||
# devices supported
|
||||
|
||||
Use this command to get the list of all supported devices
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin devices supported
|
@ -1,7 +0,0 @@
|
||||
# drives
|
||||
|
||||
Use this command to list all drives that are connected to your machine.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin drives
|
@ -1,22 +0,0 @@
|
||||
# env add <key> [value]
|
||||
|
||||
Use this command to add an enviroment variable to an application.
|
||||
|
||||
You need to pass the `--application` option.
|
||||
|
||||
If value is omitted, the tool will attempt to use the variable's value
|
||||
as defined in your host machine.
|
||||
|
||||
If the value is grabbed from the environment, a warning message will be printed.
|
||||
Use `--quiet` to remove it.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env add EDITOR vim -a 91
|
||||
$ resin env add TERM -a 91
|
||||
|
||||
## Options
|
||||
|
||||
### --application, --a,app, --a,app <application>
|
||||
|
||||
application id
|
@ -1,23 +0,0 @@
|
||||
# envs
|
||||
|
||||
Use this command to list all environment variables for a particular application.
|
||||
Notice we will support per-device environment variables soon.
|
||||
|
||||
This command lists all custom environment variables set on the devices running
|
||||
the application. If you want to see all environment variables, including private
|
||||
ones used by resin, use the verbose option.
|
||||
|
||||
Example:
|
||||
|
||||
$ resin envs --application 91
|
||||
$ resin envs --application 91 --verbose
|
||||
|
||||
## Options
|
||||
|
||||
### --application, --a,app, --a,app <application>
|
||||
|
||||
application id
|
||||
|
||||
### --verbose, -v
|
||||
|
||||
show private environment variables
|
@ -1,19 +0,0 @@
|
||||
# env rm <id>
|
||||
|
||||
Use this command to remove an environment variable from an application.
|
||||
|
||||
Don't remove resin specific variables, as things might not work as expected.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env rm 215
|
||||
$ resin env rm 215 --yes
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,7 +0,0 @@
|
||||
# env rename <id> <value>
|
||||
|
||||
Use this command to rename an enviroment variable from an application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin env rename 376 emacs
|
@ -1,10 +0,0 @@
|
||||
# example clone <id>
|
||||
|
||||
Use this command to clone an example application to the current directory
|
||||
|
||||
This command outputs information about the cloning process.
|
||||
Use `--quiet` to remove that output.
|
||||
|
||||
Example:
|
||||
|
||||
$ resin example clone 3
|
@ -1,7 +0,0 @@
|
||||
# example <id>
|
||||
|
||||
Use this command to show information of a single example application
|
||||
|
||||
Example:
|
||||
|
||||
$ resin example 3
|
@ -1,7 +0,0 @@
|
||||
# examples
|
||||
|
||||
Use this command to list available example applications from resin.io
|
||||
|
||||
Example:
|
||||
|
||||
$ resin examples
|
@ -1,8 +0,0 @@
|
||||
# help [command...]
|
||||
|
||||
Get detailed help for an specific command.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin help apps
|
||||
$ resin help os download
|
@ -1,3 +0,0 @@
|
||||
# version
|
||||
|
||||
Display the Resin CLI, as well as the bundled NodeJS version.
|
@ -1,11 +0,0 @@
|
||||
# key add <name> [path]
|
||||
|
||||
Use this command to associate a new SSH key with your account.
|
||||
|
||||
If `path` is omitted, the command will attempt
|
||||
to read the SSH key from stdin.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key add Main ~/.ssh/id_rsa.pub
|
||||
$ cat ~/.ssh/id_rsa.pub | resin key add Main
|
@ -1,7 +0,0 @@
|
||||
# key <id>
|
||||
|
||||
Use this command to show information about a single SSH key.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key 17
|
@ -1,7 +0,0 @@
|
||||
# keys
|
||||
|
||||
Use this command to list all your SSH keys.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin keys
|
@ -1,17 +0,0 @@
|
||||
# key rm <id>
|
||||
|
||||
Use this command to remove a SSH key from resin.io.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin key rm 17
|
||||
$ resin key rm 17 --yes
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,18 +0,0 @@
|
||||
# note <|note>
|
||||
|
||||
Use this command to set or update a device note.
|
||||
|
||||
If note command isn't passed, the tool attempts to read from `stdin`.
|
||||
|
||||
To view the notes, use $ resin device <id>.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin note "My useful note" --device 317
|
||||
$ cat note.txt | resin note --device 317
|
||||
|
||||
## Options
|
||||
|
||||
### --device, --d,dev, --d,dev <device>
|
||||
|
||||
device id
|
@ -1,37 +0,0 @@
|
||||
# os download <id>
|
||||
|
||||
Use this command to download the device OS configured to a specific network.
|
||||
|
||||
Ethernet:
|
||||
You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".
|
||||
|
||||
Wifi:
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
By default, this command saved the downloaded image into a resin specific directory.
|
||||
You can save it to a custom location by specifying the `--output` option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os download 91 --network ethernet
|
||||
$ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123
|
||||
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
||||
|
||||
## Options
|
||||
|
||||
### --network, -n <network>
|
||||
|
||||
network type
|
||||
|
||||
### --ssid, -s <ssid>
|
||||
|
||||
wifi ssid, if network is wifi
|
||||
|
||||
### --key, -k <key>
|
||||
|
||||
wifi key, if network is wifi
|
||||
|
||||
### --output, -o <output>
|
||||
|
||||
output file
|
@ -1,34 +0,0 @@
|
||||
# os install <image> [device]
|
||||
|
||||
Use this command to write an operating system image to a device.
|
||||
|
||||
Note that this command requires admin privileges.
|
||||
|
||||
If `device` is omitted, you will be prompted to select a device interactively.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
You can quiet the progress bar by passing the `--quiet` boolean option.
|
||||
|
||||
You may have to unmount the device before attempting this operation.
|
||||
|
||||
See the `drives` command to get a list of all connected devices to your machine and their respective ids.
|
||||
|
||||
In Mac OS X:
|
||||
|
||||
$ sudo diskutil unmountDisk /dev/xxx
|
||||
|
||||
In GNU/Linux:
|
||||
|
||||
$ sudo umount /dev/xxx
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os install rpi.iso /dev/disk2
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,9 +0,0 @@
|
||||
# plugin install <name>
|
||||
|
||||
Use this command to install a resin plugin
|
||||
|
||||
Use `--quiet` to prevent information logging.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin install hello
|
@ -1,7 +0,0 @@
|
||||
# plugins
|
||||
|
||||
Use this command to list all the installed resin plugins.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugins
|
@ -1,17 +0,0 @@
|
||||
# plugin rm <name>
|
||||
|
||||
Use this command to remove a resin.io plugin.
|
||||
|
||||
Notice this command asks for confirmation interactively.
|
||||
You can avoid this by passing the `--yes` boolean option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin rm hello
|
||||
$ resin plugin rm hello --yes
|
||||
|
||||
## Options
|
||||
|
||||
### --yes, -y
|
||||
|
||||
confirm non interactively
|
@ -1,9 +0,0 @@
|
||||
# plugin update <name>
|
||||
|
||||
Use this command to update a resin plugin
|
||||
|
||||
Use `--quiet` to prevent information logging.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin plugin update hello
|
@ -1,10 +0,0 @@
|
||||
# preferences
|
||||
|
||||
Use this command to open the preferences form.
|
||||
|
||||
In the future, we will allow changing all preferences directly from the terminal.
|
||||
For now, we open your default web browser and point it to the web based preferences form.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin preferences
|
@ -1,15 +0,0 @@
|
||||
# update
|
||||
|
||||
Use this command to update the Resin CLI
|
||||
|
||||
This command outputs information about the update process.
|
||||
Use `--quiet` to remove that output.
|
||||
|
||||
The Resin CLI checks for updates once per day.
|
||||
|
||||
Major updates require a manual update with this update command,
|
||||
while minor updates are applied automatically.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin update
|
@ -1,20 +0,0 @@
|
||||
mkdirp = require('mkdirp')
|
||||
fs = require('fs')
|
||||
path = require('path')
|
||||
capitano = require('capitano')
|
||||
markdown = require('./markdown')
|
||||
|
||||
capitano.command
|
||||
signature: 'markdown <file> <output>'
|
||||
description: 'file to markdown'
|
||||
action: (params, options, done) ->
|
||||
mkdirp.sync(params.output)
|
||||
action = require(params.file)
|
||||
|
||||
for actionName, actionCommand of action
|
||||
output = path.join(params.output, "#{actionName}.md")
|
||||
fs.writeFileSync(output, markdown.command(actionCommand))
|
||||
|
||||
return done()
|
||||
|
||||
capitano.run(process.argv)
|
@ -1,23 +0,0 @@
|
||||
_ = require('lodash')
|
||||
utils = require('./utils')
|
||||
|
||||
exports.option = (option) ->
|
||||
result = utils.parseSignature(option)
|
||||
|
||||
exports.command = (command) ->
|
||||
result = """
|
||||
# #{command.signature}
|
||||
|
||||
#{command.help}\n
|
||||
"""
|
||||
|
||||
if not _.isEmpty(command.options)
|
||||
result += '\n## Options'
|
||||
|
||||
for option in command.options
|
||||
result += """
|
||||
\n\n### #{utils.parseSignature(option)}
|
||||
|
||||
#{option.description}
|
||||
"""
|
||||
return result
|
45
extras/capitanodoc/index.coffee
Normal file
45
extras/capitanodoc/index.coffee
Normal file
@ -0,0 +1,45 @@
|
||||
_ = require('lodash')
|
||||
capitanodoc = require('../../capitanodoc.json')
|
||||
markdown = require('./markdown')
|
||||
|
||||
result = {}
|
||||
result.title = capitanodoc.title
|
||||
result.introduction = capitanodoc.introduction
|
||||
result.categories = []
|
||||
|
||||
for commandCategory in capitanodoc.categories
|
||||
category = {}
|
||||
category.title = commandCategory.title
|
||||
category.commands = []
|
||||
|
||||
for file in commandCategory.files
|
||||
actions = require(file)
|
||||
|
||||
for actionName, actionCommand of actions
|
||||
category.commands.push(_.omit(actionCommand, 'action'))
|
||||
|
||||
result.categories.push(category)
|
||||
|
||||
result.toc = _.cloneDeep(result.categories)
|
||||
result.toc = _.map result.toc, (category) ->
|
||||
category.commands = _.map category.commands, (command) ->
|
||||
return {
|
||||
signature: command.signature
|
||||
|
||||
# TODO: Make anchor prefix a configurable setting
|
||||
# in capitanodoc.json
|
||||
anchor: '#/pages/using/cli.md#' + command.signature
|
||||
.replace(/\s/g,'-')
|
||||
.replace(/</g, '60-')
|
||||
.replace(/>/g, '-62-')
|
||||
.replace(/\[/g, '')
|
||||
.replace(/\]/g, '-')
|
||||
.replace(/--/g, '-')
|
||||
.replace(/\.\.\./g, '')
|
||||
.replace(/\|/g, '')
|
||||
.toLowerCase()
|
||||
}
|
||||
|
||||
return category
|
||||
|
||||
console.log(markdown.display(result))
|
66
extras/capitanodoc/markdown.coffee
Normal file
66
extras/capitanodoc/markdown.coffee
Normal file
@ -0,0 +1,66 @@
|
||||
_ = require('lodash')
|
||||
ent = require('ent')
|
||||
utils = require('./utils')
|
||||
|
||||
exports.command = (command) ->
|
||||
result = """
|
||||
## #{ent.encode(command.signature)}
|
||||
|
||||
#{command.help}\n
|
||||
"""
|
||||
|
||||
if not _.isEmpty(command.options)
|
||||
result += '\n### Options'
|
||||
|
||||
for option in command.options
|
||||
result += """
|
||||
\n\n#### #{utils.parseSignature(option)}
|
||||
|
||||
#{option.description}
|
||||
"""
|
||||
|
||||
result += '\n'
|
||||
|
||||
return result
|
||||
|
||||
exports.category = (category) ->
|
||||
result = """
|
||||
# #{category.title}\n
|
||||
"""
|
||||
|
||||
for command in category.commands
|
||||
result += '\n' + exports.command(command)
|
||||
|
||||
return result
|
||||
|
||||
exports.toc = (toc) ->
|
||||
result = '''
|
||||
# Table of contents\n
|
||||
'''
|
||||
|
||||
for category in toc
|
||||
|
||||
result += """
|
||||
\n- #{category.title}\n\n
|
||||
"""
|
||||
|
||||
for command in category.commands
|
||||
result += """
|
||||
\t- [#{ent.encode(command.signature)}](#{command.anchor})\n
|
||||
"""
|
||||
|
||||
return result
|
||||
|
||||
exports.display = (doc) ->
|
||||
result = """
|
||||
# #{doc.title}
|
||||
|
||||
#{doc.introduction}
|
||||
|
||||
#{exports.toc(doc.toc)}
|
||||
"""
|
||||
|
||||
for category in doc.categories
|
||||
result += '\n' + exports.category(category)
|
||||
|
||||
return result
|
@ -1,4 +1,5 @@
|
||||
_ = require('lodash')
|
||||
ent = require('ent')
|
||||
|
||||
exports.getOptionPrefix = (signature) ->
|
||||
if signature.length > 1
|
||||
@ -22,4 +23,4 @@ exports.parseSignature = (option) ->
|
||||
if option.parameter?
|
||||
result += " <#{option.parameter}>"
|
||||
|
||||
return result
|
||||
return ent.encode(result)
|
@ -1,8 +1,10 @@
|
||||
path = require('path')
|
||||
_ = require('lodash-contrib')
|
||||
async = require('async')
|
||||
resin = require('resin-sdk')
|
||||
visuals = require('resin-cli-visuals')
|
||||
commandOptions = require('./command-options')
|
||||
vcs = require('resin-vcs')
|
||||
|
||||
exports.create =
|
||||
signature: 'app create <name>'
|
||||
@ -53,7 +55,7 @@ exports.list =
|
||||
Use this command to list all your applications.
|
||||
|
||||
Notice this command only shows the most important bits of information for each app.
|
||||
If you want detailed information, use resin app <id> instead.
|
||||
If you want detailed information, use resin app <name> instead.
|
||||
|
||||
Examples:
|
||||
|
||||
@ -73,18 +75,18 @@ exports.list =
|
||||
return done()
|
||||
|
||||
exports.info =
|
||||
signature: 'app <id>'
|
||||
signature: 'app <name>'
|
||||
description: 'list a single application'
|
||||
help: '''
|
||||
Use this command to show detailed information for a single application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app 91
|
||||
$ resin app MyApp
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.models.application.get params.id, (error, application) ->
|
||||
resin.models.application.get params.name, (error, application) ->
|
||||
return done(error) if error?
|
||||
console.log visuals.widgets.table.vertical application, [
|
||||
'id'
|
||||
@ -96,21 +98,21 @@ exports.info =
|
||||
return done()
|
||||
|
||||
exports.restart =
|
||||
signature: 'app restart <id>'
|
||||
signature: 'app restart <name>'
|
||||
description: 'restart an application'
|
||||
help: '''
|
||||
Use this command to restart all devices that belongs to a certain application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app restart 91
|
||||
$ resin app restart MyApp
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.models.application.restart(params.id, done)
|
||||
resin.models.application.restart(params.name, done)
|
||||
|
||||
exports.remove =
|
||||
signature: 'app rm <id>'
|
||||
signature: 'app rm <name>'
|
||||
description: 'remove an application'
|
||||
help: '''
|
||||
Use this command to remove a resin.io application.
|
||||
@ -120,28 +122,28 @@ exports.remove =
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin app rm 91
|
||||
$ resin app rm 91 --yes
|
||||
$ resin app rm MyApp
|
||||
$ resin app rm MyApp --yes
|
||||
'''
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
visuals.patterns.remove 'application', options.yes, (callback) ->
|
||||
resin.models.application.remove(params.id, callback)
|
||||
resin.models.application.remove(params.name, callback)
|
||||
, done
|
||||
|
||||
exports.init =
|
||||
signature: 'init <id>'
|
||||
description: 'init an application'
|
||||
exports.associate =
|
||||
signature: 'app associate <name>'
|
||||
description: 'associate a resin project'
|
||||
help: '''
|
||||
Use this command to associate a local project to an existing resin.io application.
|
||||
Use this command to associate a project directory with a resin application.
|
||||
|
||||
The application should be a git repository before issuing this command.
|
||||
Notice this command adds a `resin` git remote to your application.
|
||||
This command adds a 'resin' git remote to the directory and runs git init if necessary.
|
||||
|
||||
Examples:
|
||||
|
||||
$ cd myApp && resin init 91
|
||||
$ resin app associate MyApp
|
||||
$ resin app associate MyApp --project my/app/directory
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
@ -150,18 +152,55 @@ exports.init =
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
resin.vcs.isResinProject(currentDirectory, callback)
|
||||
|
||||
(isResinProject, callback) ->
|
||||
if isResinProject
|
||||
error = new Error('Project is already a resin application.')
|
||||
return callback(error)
|
||||
return callback()
|
||||
vcs.initialize(currentDirectory, callback)
|
||||
|
||||
(callback) ->
|
||||
resin.models.application.get(params.id, callback)
|
||||
resin.models.application.get(params.name, callback)
|
||||
|
||||
(application, callback) ->
|
||||
resin.vcs.initProjectWithApplication(application, currentDirectory, callback)
|
||||
vcs.addRemote(currentDirectory, application.git_repository, callback)
|
||||
|
||||
], done
|
||||
], (error, remoteUrl) ->
|
||||
return done(error) if error?
|
||||
console.info("git repository added: #{remoteUrl}")
|
||||
return done(null, remoteUrl)
|
||||
|
||||
exports.init =
|
||||
signature: 'init'
|
||||
description: 'init an application'
|
||||
help: '''
|
||||
Use this command to initialise a directory as a resin application.
|
||||
|
||||
This command performs the following steps:
|
||||
- Create a resin.io application.
|
||||
- Initialize the current directory as a git repository.
|
||||
- Add the corresponding git remote to the application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin init
|
||||
$ resin init --project my/app/directory
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
|
||||
currentDirectory = process.cwd()
|
||||
|
||||
async.waterfall([
|
||||
|
||||
(callback) ->
|
||||
currentDirectoryBasename = path.basename(currentDirectory)
|
||||
visuals.widgets.ask('What is the name of your application?', currentDirectoryBasename, callback)
|
||||
|
||||
(applicationName, callback) ->
|
||||
|
||||
# TODO: Make resin.models.application.create return
|
||||
# the whole application instead of just the id
|
||||
exports.create.action name: applicationName, options, (error) ->
|
||||
return callback(error) if error?
|
||||
return callback(null, applicationName)
|
||||
|
||||
(applicationName, callback) ->
|
||||
exports.associate.action(name: applicationName, options, callback)
|
||||
|
||||
], done)
|
||||
|
@ -1,62 +1,73 @@
|
||||
open = require('open')
|
||||
_ = require('lodash-contrib')
|
||||
url = require('url')
|
||||
async = require('async')
|
||||
resin = require('resin-sdk')
|
||||
settings = require('resin-settings-client')
|
||||
visuals = require('resin-cli-visuals')
|
||||
|
||||
exports.login =
|
||||
signature: 'login'
|
||||
description: 'login to resin.io'
|
||||
exports.whoami =
|
||||
signature: 'whoami'
|
||||
description: 'whoami'
|
||||
help: '''
|
||||
Use this command to login to your resin.io account.
|
||||
You need to login before you can use most of the commands this tool provides.
|
||||
|
||||
You can pass your credentials as `--username` and `--password` options, or you can omit the
|
||||
credentials, in which case the tool will present you with an interactive login form.
|
||||
Use this command to get the logged in user name.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin login --username <username> --password <password>
|
||||
$ resin login
|
||||
$ resin whoami
|
||||
'''
|
||||
options: [
|
||||
{
|
||||
signature: 'username'
|
||||
parameter: 'username'
|
||||
description: 'user name'
|
||||
alias: 'u'
|
||||
}
|
||||
{
|
||||
signature: 'password'
|
||||
parameter: 'password'
|
||||
description: 'user password'
|
||||
alias: 'p'
|
||||
}
|
||||
]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.auth.whoami (error, username) ->
|
||||
return done(error) if error?
|
||||
console.log(username)
|
||||
return done()
|
||||
|
||||
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences')
|
||||
|
||||
exports.login =
|
||||
signature: 'login [token]'
|
||||
description: 'login to resin.io'
|
||||
help: """
|
||||
Use this command to login to your resin.io account.
|
||||
|
||||
To login, you need your token, which is accesible from the preferences page:
|
||||
|
||||
#{TOKEN_URL}
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin login
|
||||
$ resin login "eyJ0eXAiOiJKV1Qi..."
|
||||
"""
|
||||
action: (params, options, done) ->
|
||||
|
||||
hasOptionCredentials = not _.isEmpty(options)
|
||||
console.info """
|
||||
To login to the Resin CLI, you need your unique token, which is accesible from
|
||||
the preferences page at #{TOKEN_URL}
|
||||
|
||||
if hasOptionCredentials
|
||||
Attempting to open a browser at that location...
|
||||
"""
|
||||
|
||||
if not options.username
|
||||
return done(new Error('Missing username'))
|
||||
|
||||
if not options.password
|
||||
return done(new Error('Missing password'))
|
||||
|
||||
async.waterfall [
|
||||
async.waterfall([
|
||||
|
||||
(callback) ->
|
||||
if hasOptionCredentials
|
||||
return callback(null, options)
|
||||
else
|
||||
return visuals.widgets.login(callback)
|
||||
open TOKEN_URL, (error) ->
|
||||
if error?
|
||||
console.error """
|
||||
Unable to open a web browser in the current environment.
|
||||
Please visit #{TOKEN_URL} manually.
|
||||
"""
|
||||
return callback()
|
||||
|
||||
(credentials, callback) ->
|
||||
resin.auth.login(credentials, callback)
|
||||
(callback) ->
|
||||
return callback(null, params.token) if params.token?
|
||||
visuals.widgets.ask('What\'s your token? (visible in the preferences page)', null, callback)
|
||||
|
||||
], done
|
||||
(token, callback) ->
|
||||
resin.auth.loginWithToken(token, done)
|
||||
|
||||
], done)
|
||||
|
||||
exports.logout =
|
||||
signature: 'logout'
|
||||
|
@ -1,15 +1,20 @@
|
||||
_ = require('lodash')
|
||||
|
||||
exports.yes =
|
||||
signature: 'yes'
|
||||
description: 'confirm non interactively'
|
||||
boolean: true
|
||||
alias: 'y'
|
||||
|
||||
exports.application =
|
||||
exports.optionalApplication =
|
||||
signature: 'application'
|
||||
parameter: 'application'
|
||||
description: 'application id'
|
||||
description: 'application name'
|
||||
alias: [ 'a', 'app' ]
|
||||
|
||||
exports.application = _.defaults
|
||||
required: 'You have to specify an application'
|
||||
, exports.optionalApplication
|
||||
|
||||
exports.network =
|
||||
signature: 'network'
|
||||
|
@ -3,6 +3,7 @@ path = require('path')
|
||||
async = require('async')
|
||||
resin = require('resin-sdk')
|
||||
visuals = require('resin-cli-visuals')
|
||||
vcs = require('resin-vcs')
|
||||
commandOptions = require('./command-options')
|
||||
osAction = require('./os')
|
||||
|
||||
@ -14,7 +15,7 @@ exports.list =
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin devices --application 91
|
||||
$ resin devices --application MyApp
|
||||
'''
|
||||
options: [ commandOptions.application ]
|
||||
permission: 'user'
|
||||
@ -34,18 +35,18 @@ exports.list =
|
||||
return done()
|
||||
|
||||
exports.info =
|
||||
signature: 'device <id>'
|
||||
signature: 'device <name>'
|
||||
description: 'list a single device'
|
||||
help: '''
|
||||
Use this command to show information about a single device.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device 317
|
||||
$ resin device MyDevice
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin.models.device.get params.id, (error, device) ->
|
||||
resin.models.device.get params.name, (error, device) ->
|
||||
return done(error) if error?
|
||||
console.log visuals.widgets.table.vertical device, [
|
||||
'id'
|
||||
@ -66,7 +67,7 @@ exports.info =
|
||||
return done()
|
||||
|
||||
exports.remove =
|
||||
signature: 'device rm <id>'
|
||||
signature: 'device rm <name>'
|
||||
description: 'remove a device'
|
||||
help: '''
|
||||
Use this command to remove a device from resin.io.
|
||||
@ -76,14 +77,14 @@ exports.remove =
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rm 317
|
||||
$ resin device rm 317 --yes
|
||||
$ resin device rm MyDevice
|
||||
$ resin device rm MyDevice --yes
|
||||
'''
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
visuals.patterns.remove 'device', options.yes, (callback) ->
|
||||
resin.models.device.remove(params.id, callback)
|
||||
resin.models.device.remove(params.name, callback)
|
||||
, done
|
||||
|
||||
exports.identify =
|
||||
@ -103,7 +104,7 @@ exports.identify =
|
||||
resin.models.device.identify(params.uuid, done)
|
||||
|
||||
exports.rename =
|
||||
signature: 'device rename <id> [name]'
|
||||
signature: 'device rename <name> [newName]'
|
||||
description: 'rename a resin device'
|
||||
help: '''
|
||||
Use this command to rename a device.
|
||||
@ -112,20 +113,20 @@ exports.rename =
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device rename 317 MyPi
|
||||
$ resin device rename 317
|
||||
$ resin device rename MyDevice MyPi
|
||||
$ resin device rename MyDevice
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
if not _.isEmpty(params.name)
|
||||
return callback(null, params.name)
|
||||
visuals.widgets.ask('How do you want to name this device?', callback)
|
||||
if not _.isEmpty(params.newName)
|
||||
return callback(null, params.newName)
|
||||
visuals.widgets.ask('How do you want to name this device?', null, callback)
|
||||
|
||||
(name, callback) ->
|
||||
resin.models.device.rename(params.id, name, callback)
|
||||
(newName, callback) ->
|
||||
resin.models.device.rename(params.name, newName, callback)
|
||||
|
||||
], done
|
||||
|
||||
@ -172,13 +173,17 @@ exports.init =
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
You can omit network related options to be asked about them interactively.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device init
|
||||
$ resin device init --application 91
|
||||
$ resin device init --application 91 --network ethernet
|
||||
$ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret
|
||||
'''
|
||||
options: [
|
||||
commandOptions.application
|
||||
commandOptions.optionalApplication
|
||||
commandOptions.network
|
||||
commandOptions.wifiSsid
|
||||
commandOptions.wifiKey
|
||||
@ -191,12 +196,18 @@ exports.init =
|
||||
async.waterfall([
|
||||
|
||||
(callback) ->
|
||||
return callback(null, options.application) if options.application?
|
||||
vcs.getApplicationId(process.cwd(), callback)
|
||||
|
||||
(applicationId, callback) ->
|
||||
params.id = applicationId
|
||||
return callback(null, params.device) if params.device?
|
||||
visuals.patterns.selectDrive(callback)
|
||||
|
||||
(device, callback) ->
|
||||
params.device = device
|
||||
visuals.patterns.confirm(options.yes, "This will completely erase #{params.device}. Are you sure you want to continue?", callback)
|
||||
message = "This will completely erase #{params.device}. Are you sure you want to continue?"
|
||||
visuals.patterns.confirm(options.yes, message, callback)
|
||||
|
||||
(confirmed, callback) ->
|
||||
return done() if not confirmed
|
||||
|
@ -2,9 +2,9 @@ async = require('async')
|
||||
fs = require('fs')
|
||||
path = require('path')
|
||||
_ = require('lodash')
|
||||
gitCli = require('git-cli')
|
||||
resin = require('resin-sdk')
|
||||
visuals = require('resin-cli-visuals')
|
||||
vcs = require('resin-vcs')
|
||||
examplesData = require('../data/examples.json')
|
||||
|
||||
exports.list =
|
||||
@ -85,18 +85,6 @@ exports.clone =
|
||||
if not example?
|
||||
return done(new Error("Unknown example: #{id}"))
|
||||
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
exampleAbsolutePath = path.join(process.cwd(), example.name)
|
||||
|
||||
fs.exists exampleAbsolutePath, (exists) ->
|
||||
return callback() if not exists
|
||||
error = new Error("Directory exists: #{example.name}")
|
||||
return callback(error)
|
||||
|
||||
(callback) ->
|
||||
console.info("Cloning #{example.display_name} to #{example.name}")
|
||||
gitCli.Repository.clone(example.repository, example.name, callback)
|
||||
|
||||
], done
|
||||
currentDirectory = process.cwd()
|
||||
console.info("Cloning #{example.display_name} to #{currentDirectory}")
|
||||
vcs.clone(example.repository, currentDirectory, done)
|
||||
|
@ -4,8 +4,7 @@ exports.version =
|
||||
signature: 'version'
|
||||
description: 'output the version number'
|
||||
help: '''
|
||||
Display the Resin CLI, as well as the bundled NodeJS version.
|
||||
Display the Resin CLI version.
|
||||
'''
|
||||
action: ->
|
||||
console.log("#{packageJSON.name}: #{packageJSON.version}")
|
||||
console.log("node: #{process.version}")
|
||||
console.log(packageJSON.version)
|
||||
|
@ -24,6 +24,8 @@ exports.list =
|
||||
console.log visuals.widgets.table.horizontal keys, [ 'id', 'title' ]
|
||||
return done()
|
||||
|
||||
SSH_KEY_WIDTH = 43
|
||||
|
||||
exports.info =
|
||||
signature: 'key <id>'
|
||||
description: 'list a single ssh key'
|
||||
@ -39,8 +41,7 @@ exports.info =
|
||||
resin.models.key.get params.id, (error, key) ->
|
||||
return done(error) if error?
|
||||
|
||||
sshKeyWidth = resin.settings.get('sshKeyWidth')
|
||||
key.public_key = '\n' + visuals.helpers.chop(key.public_key, sshKeyWidth)
|
||||
key.public_key = '\n' + visuals.helpers.chop(key.public_key, SSH_KEY_WIDTH)
|
||||
|
||||
console.log(visuals.widgets.table.vertical(key, [ 'id', 'title', 'public_key' ]))
|
||||
return done()
|
||||
|
@ -9,17 +9,17 @@ exports.set =
|
||||
|
||||
If note command isn't passed, the tool attempts to read from `stdin`.
|
||||
|
||||
To view the notes, use $ resin device <id>.
|
||||
To view the notes, use $ resin device <name>.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin note "My useful note" --device 317
|
||||
$ cat note.txt | resin note --device 317
|
||||
$ resin note "My useful note" --device MyDevice
|
||||
$ cat note.txt | resin note --device MyDevice
|
||||
'''
|
||||
options: [
|
||||
signature: 'device'
|
||||
parameter: 'device'
|
||||
description: 'device id'
|
||||
description: 'device name'
|
||||
alias: [ 'd', 'dev' ]
|
||||
required: 'You have to specify a device'
|
||||
]
|
||||
|
@ -1,14 +1,15 @@
|
||||
_ = require('lodash-contrib')
|
||||
fs = require('fs')
|
||||
os = require('os')
|
||||
async = require('async')
|
||||
path = require('path')
|
||||
mkdirp = require('mkdirp')
|
||||
resin = require('resin-sdk')
|
||||
visuals = require('resin-cli-visuals')
|
||||
progressStream = require('progress-stream')
|
||||
diskio = require('diskio')
|
||||
commandOptions = require('./command-options')
|
||||
npm = require('../npm')
|
||||
packageJSON = require('../../package.json')
|
||||
updateActions = require('./update')
|
||||
elevate = require('../elevate')
|
||||
|
||||
exports.download =
|
||||
signature: 'os download <id>'
|
||||
@ -23,13 +24,15 @@ exports.download =
|
||||
You can setup the device OS to use wifi by setting the `--network` option to "wifi".
|
||||
If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.
|
||||
|
||||
By default, this command saved the downloaded image into a resin specific directory.
|
||||
You can save it to a custom location by specifying the `--output` option.
|
||||
Alternatively, you can omit all kind of network configuration options to configure interactively.
|
||||
|
||||
You have to specify an output location with the `--output` option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin os download 91 --network ethernet
|
||||
$ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123
|
||||
$ resin os download 91 --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip
|
||||
$ resin os download 91 --network ethernet --output ~/MyResinOS.zip
|
||||
'''
|
||||
options: [
|
||||
@ -42,6 +45,7 @@ exports.download =
|
||||
parameter: 'output'
|
||||
description: 'output file'
|
||||
alias: 'o'
|
||||
required: 'You need to specify an output file'
|
||||
}
|
||||
]
|
||||
permission: 'user'
|
||||
@ -52,11 +56,15 @@ exports.download =
|
||||
wifiKey: options.key
|
||||
appId: params.id
|
||||
|
||||
fileName = resin.models.os.generateCacheName(osParams)
|
||||
options.output ?= path.join(resin.settings.get('directories.os'), fileName)
|
||||
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
return callback() if osParams.network?
|
||||
visuals.patterns.selectNetworkParameters (error, parameters) ->
|
||||
return callback(error) if error?
|
||||
_.extend(osParams, parameters)
|
||||
return callback()
|
||||
|
||||
(callback) ->
|
||||
|
||||
# We need to ensure this directory exists
|
||||
@ -66,9 +74,16 @@ exports.download =
|
||||
console.info("Destination file: #{options.output}\n")
|
||||
|
||||
bar = new visuals.widgets.Progress('Downloading Device OS')
|
||||
spinner = new visuals.widgets.Spinner('Downloading Device OS (size unknown)')
|
||||
|
||||
resin.models.os.download osParams, options.output, callback, (state) ->
|
||||
bar.update(state)
|
||||
resin.models.os.download osParams, options.output, (error) ->
|
||||
spinner.stop()
|
||||
return callback(error) if error?
|
||||
, (state) ->
|
||||
if state?
|
||||
bar.update(state)
|
||||
else
|
||||
spinner.start()
|
||||
|
||||
], (error) ->
|
||||
return done(error) if error?
|
||||
@ -109,8 +124,28 @@ exports.install =
|
||||
options: [ commandOptions.yes ]
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
|
||||
bundle = require('../devices/raspberry-pi')
|
||||
|
||||
async.waterfall [
|
||||
|
||||
(callback) ->
|
||||
npm.isUpdated(packageJSON.name, packageJSON.version, callback)
|
||||
|
||||
(isUpdated, callback) ->
|
||||
return callback() if isUpdated
|
||||
|
||||
console.info '''
|
||||
Resin CLI is outdated.
|
||||
|
||||
In order to avoid device compatibility issues, this command
|
||||
requires that you have the Resin CLI updated.
|
||||
|
||||
Updating now...
|
||||
'''
|
||||
|
||||
updateActions.update.action(params, options, _.unary(callback))
|
||||
|
||||
(callback) ->
|
||||
return callback(null, params.device) if params.device?
|
||||
|
||||
@ -131,41 +166,17 @@ exports.install =
|
||||
(confirmed, callback) ->
|
||||
return done() if not confirmed
|
||||
|
||||
imageFileSize = fs.statSync(params.image).size
|
||||
|
||||
if imageFileSize is 0
|
||||
error = new Error("Invalid OS image: #{params.image}. The image is 0 bytes.")
|
||||
return callback(error)
|
||||
|
||||
progress = progressStream
|
||||
length: imageFileSize
|
||||
time: 500
|
||||
|
||||
if not options.quiet
|
||||
bar = new visuals.widgets.Progress('Writing Device OS')
|
||||
|
||||
progress.on 'progress', (status) ->
|
||||
bar.update(status)
|
||||
|
||||
imageFileStream = fs.createReadStream(params.image).pipe(progress)
|
||||
|
||||
diskio.writeStream(params.device, imageFileStream, callback)
|
||||
bar = new visuals.widgets.Progress('Writing Device OS')
|
||||
params.progress = _.bind(bar.update, bar)
|
||||
bundle.write(params, callback)
|
||||
|
||||
], (error) ->
|
||||
return done() if not error?
|
||||
|
||||
if _.all [
|
||||
os.platform() is 'win32'
|
||||
error.code is 'EPERM' or error.code is 'EACCES'
|
||||
if elevate.shouldElevate(error) and not options.fromScript
|
||||
|
||||
# Prevent re-running resin-write infinitely
|
||||
# If we have an EPERM or EACCES even after running
|
||||
# windosu, we throw it as there is not much we can do
|
||||
not options.fromScript
|
||||
]
|
||||
windosu = require('windosu')
|
||||
# Need to escape every path to avoid errors
|
||||
resinWritePath = "\"#{path.join(__dirname, '..', '..', 'bin', 'resin-write')}\""
|
||||
windosu.exec("\"#{process.argv[0]}\" #{resinWritePath} \"#{params.image}\" \"#{params.device}\"")
|
||||
elevate.run("\"#{process.argv[0]}\" #{resinWritePath} \"#{params.image}\" \"#{params.device}\"")
|
||||
else
|
||||
return done(error)
|
||||
|
@ -1,6 +1,6 @@
|
||||
open = require('open')
|
||||
url = require('url')
|
||||
resin = require('resin-sdk')
|
||||
settings = require('resin-settings-client')
|
||||
|
||||
exports.preferences =
|
||||
signature: 'preferences'
|
||||
@ -17,6 +17,5 @@ exports.preferences =
|
||||
'''
|
||||
permission: 'user'
|
||||
action: ->
|
||||
preferencesUrl = resin.settings.get('urls.preferences')
|
||||
absUrl = url.resolve(resin.settings.get('remoteUrl'), preferencesUrl)
|
||||
absUrl = url.resolve(settings.get('remoteUrl'), '/preferences')
|
||||
open(absUrl)
|
||||
|
@ -1,6 +1,7 @@
|
||||
async = require('async')
|
||||
_ = require('lodash-contrib')
|
||||
npm = require('npm')
|
||||
_ = require('lodash')
|
||||
child_process = require('child_process')
|
||||
president = require('president')
|
||||
npm = require('../npm')
|
||||
packageJSON = require('../../package.json')
|
||||
|
||||
exports.update =
|
||||
@ -22,30 +23,36 @@ exports.update =
|
||||
$ resin update
|
||||
'''
|
||||
action: (params, options, done) ->
|
||||
async.waterfall([
|
||||
npm.isUpdated packageJSON.name, packageJSON.version, (error, isUpdated) ->
|
||||
return done(error) if error?
|
||||
|
||||
(callback) ->
|
||||
options =
|
||||
if isUpdated
|
||||
return done(new Error('You\'re already running the latest version.'))
|
||||
|
||||
# TODO: There is no way to quiet npm install completely.
|
||||
# Some output is still shown once the module is updated
|
||||
# https://github.com/npm/npm/issues/2040
|
||||
loglevel: 'silent'
|
||||
global: true
|
||||
onUpdate = (error, stdout, stderr) ->
|
||||
return done(error) if error?
|
||||
return done(new Error(stderr)) if not _.isEmpty(stderr)
|
||||
console.info("Upgraded #{packageJSON.name}.")
|
||||
return done()
|
||||
|
||||
npm.load(options, _.unary(callback))
|
||||
command = "npm install --global #{packageJSON.name}"
|
||||
|
||||
(callback) ->
|
||||
npm.commands.update [ packageJSON.name ], (error, data) ->
|
||||
return callback(error, data)
|
||||
# Attempting to self update using the NPM API was not considered safe.
|
||||
# A safer thing to do is to call npm as a child process
|
||||
# https://github.com/npm/npm/issues/7723
|
||||
child_process.exec command, (error, stdout, stderr) ->
|
||||
return onUpdate(null, stdout, stderr) if error?
|
||||
|
||||
(data, callback) ->
|
||||
if _.isEmpty(data)
|
||||
return callback(new Error('You are already running the latest version'))
|
||||
if _.any [
|
||||
|
||||
newVersion = _.last(_.first(_.last(data)).split('@'))
|
||||
console.info("Upgraded #{packageJSON.name} to v#{newVersion}.")
|
||||
# 3 is equivalent to EACCES for NPM
|
||||
error.code is 3
|
||||
|
||||
error.code is 'EPERM'
|
||||
error.code is 'ACCES'
|
||||
]
|
||||
return president.execute(command, onUpdate)
|
||||
|
||||
return done(error)
|
||||
|
||||
return callback()
|
||||
|
||||
], done)
|
||||
|
@ -57,6 +57,7 @@ capitano.command(actions.app.list)
|
||||
capitano.command(actions.app.info)
|
||||
capitano.command(actions.app.remove)
|
||||
capitano.command(actions.app.restart)
|
||||
capitano.command(actions.app.associate)
|
||||
capitano.command(actions.app.init)
|
||||
|
||||
# ---------- Device Module ----------
|
||||
@ -124,10 +125,6 @@ async.waterfall([
|
||||
(callback) ->
|
||||
plugins.register('resin-plugin-', callback)
|
||||
|
||||
(callback) ->
|
||||
dataPrefix = resin.settings.get('dataPrefix')
|
||||
resin.data.prefix.set(dataPrefix, callback)
|
||||
|
||||
(callback) ->
|
||||
cli = capitano.parse(process.argv)
|
||||
|
||||
|
22
lib/devices/raspberry-pi.coffee
Normal file
22
lib/devices/raspberry-pi.coffee
Normal file
@ -0,0 +1,22 @@
|
||||
fs = require('fs')
|
||||
progressStream = require('progress-stream')
|
||||
diskio = require('diskio')
|
||||
|
||||
exports.name = 'Raspberry Pi'
|
||||
|
||||
exports.write = (options, callback) ->
|
||||
imageFileSize = fs.statSync(options.image).size
|
||||
|
||||
if imageFileSize is 0
|
||||
error = new Error("Invalid OS image: #{options.image}. The image is 0 bytes.")
|
||||
return callback(error)
|
||||
|
||||
progress = progressStream
|
||||
length: imageFileSize
|
||||
time: 500
|
||||
|
||||
if not options.quiet
|
||||
progress.on('progress', options.progress)
|
||||
|
||||
imageFileStream = fs.createReadStream(options.image).pipe(progress)
|
||||
diskio.writeStream(options.device, imageFileStream, callback)
|
16
lib/elevate.coffee
Normal file
16
lib/elevate.coffee
Normal file
@ -0,0 +1,16 @@
|
||||
_ = require('lodash')
|
||||
os = require('os')
|
||||
path = require('path')
|
||||
|
||||
isWindows = ->
|
||||
return os.platform() is 'win32'
|
||||
|
||||
exports.shouldElevate = (error) ->
|
||||
return _.all [
|
||||
isWindows()
|
||||
error.code is 'EPERM' or error.code is 'EACCES'
|
||||
]
|
||||
|
||||
exports.run = (command) ->
|
||||
return if not isWindows()
|
||||
require('windosu').exec(command)
|
@ -23,6 +23,12 @@ exports.handle = (error, exit = true) ->
|
||||
|
||||
console.error(message)
|
||||
|
||||
else if error.code is 'ENOGIT'
|
||||
console.error '''
|
||||
Git is not installed on this system.
|
||||
Head over to http://git-scm.com to install it and run this command again.
|
||||
'''
|
||||
|
||||
else if error.message?
|
||||
console.error(error.message)
|
||||
|
||||
|
29
lib/npm.coffee
Normal file
29
lib/npm.coffee
Normal file
@ -0,0 +1,29 @@
|
||||
npm = require('npm')
|
||||
async = require('async')
|
||||
_ = require('lodash-contrib')
|
||||
|
||||
exports.getLatestVersion = (name, callback) ->
|
||||
async.waterfall([
|
||||
|
||||
(callback) ->
|
||||
options =
|
||||
|
||||
# TODO: There is no way to quiet npm install completely.
|
||||
# Some output is still shown once the module is updated
|
||||
# https://github.com/npm/npm/issues/2040
|
||||
loglevel: 'silent'
|
||||
global: true
|
||||
|
||||
npm.load(options, _.unary(callback))
|
||||
|
||||
(callback) ->
|
||||
npm.commands.view [ name ], true, (error, data) ->
|
||||
versions = _.keys(data)
|
||||
return callback(error, _.first(versions))
|
||||
|
||||
], callback)
|
||||
|
||||
exports.isUpdated = (name, currentVersion, callback) ->
|
||||
exports.getLatestVersion name, (error, latestVersion) ->
|
||||
return callback(error) if error?
|
||||
return callback(null, currentVersion is latestVersion)
|
15
package.json
15
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "resin-cli",
|
||||
"version": "0.2.3",
|
||||
"version": "0.8.1",
|
||||
"description": "Git Push to your devices",
|
||||
"main": "./lib/actions/index.coffee",
|
||||
"homepage": "https://github.com/resin-io/resin-cli",
|
||||
@ -20,7 +20,7 @@
|
||||
"scripts": {
|
||||
"prepublish": "gulp build",
|
||||
"test": "gulp test",
|
||||
"doc": "./scripts/extract-documentation.sh doc lib/actions"
|
||||
"doc": "mkdir -p doc/ && coffee extras/capitanodoc/index.coffee > doc/cli.markdown"
|
||||
},
|
||||
"keywords": [
|
||||
"resin",
|
||||
@ -33,6 +33,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.9.2",
|
||||
"ent": "^2.2.0",
|
||||
"gulp": "~3.8.9",
|
||||
"gulp-coffee": "^2.2.0",
|
||||
"gulp-coffeelint": "~0.4.0",
|
||||
@ -53,16 +54,18 @@
|
||||
"conf.js": "^0.1.1",
|
||||
"diskio": "^1.0.0",
|
||||
"drivelist": "^1.2.1",
|
||||
"git-cli": "~0.8.2",
|
||||
"lodash": "~2.4.1",
|
||||
"lodash-contrib": "~241.4.14",
|
||||
"mkdirp": "~0.5.0",
|
||||
"nplugm": "^2.1.0",
|
||||
"nplugm": "^2.2.0",
|
||||
"npm": "^2.6.1",
|
||||
"open": "0.0.5",
|
||||
"president": "^1.0.0",
|
||||
"progress-stream": "^0.5.0",
|
||||
"resin-cli-visuals": "^0.0.6",
|
||||
"resin-sdk": "^0.0.1",
|
||||
"resin-cli-visuals": "^0.1.0",
|
||||
"resin-sdk": "^1.2.0",
|
||||
"resin-settings-client": "^1.0.0",
|
||||
"resin-vcs": "^1.1.0",
|
||||
"underscore.string": "~2.4.0",
|
||||
"update-notifier": "^0.3.1"
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<title>Resin CLI</title>
|
||||
<organization>io.resin</organization>
|
||||
<domains enable_localSystem="true" />
|
||||
<options customize="never" require-scripts="true" />
|
||||
|
||||
<background file="background.png" alignment="bottomleft" mime-type="image/png" />
|
||||
|
||||
<!-- Define documents displayed at various steps -->
|
||||
<welcome file="welcome.txt" mime-type="text/plain" />
|
||||
<license file="license.txt" mime-type="text/plain" />
|
||||
<conclusion file="conclusion.txt" mime-type="text/plain" />
|
||||
|
||||
<!-- List all component packages -->
|
||||
<pkg-ref id="io.resin.cli">cli.pkg</pkg-ref>
|
||||
|
||||
<!-- List them again here -->
|
||||
<choices-outline>
|
||||
<line choice="io.resin.cli" />
|
||||
</choices-outline>
|
||||
|
||||
<!-- Define each choice above -->
|
||||
<choice
|
||||
customLocation="/opt/resin.io/cli"
|
||||
id="io.resin.cli"
|
||||
visible="false"
|
||||
title="Resin CLI"
|
||||
description="The Resin CLI tool"
|
||||
start_selected="true">
|
||||
<pkg-ref id="io.resin.cli" />
|
||||
</choice>
|
||||
</installer-gui-script>
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
@ -1 +0,0 @@
|
||||
Thanks for installing the Resin CLI. Enjoy!
|
@ -1,3 +0,0 @@
|
||||
Welcome to the installation of the Resin CLI tool, an advanced way to communicate with Resin.io
|
||||
|
||||
The Resin.io CLI tool will be installed in /opt/resin.io/cli.
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Add binary symbolic link
|
||||
ln -s /opt/resin.io/cli/bin/resin /usr/bin/resin
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Remove previous installations of the CLI
|
||||
rm -rf /opt/resin.io/cli
|
||||
|
||||
# Remove previous symbolic link
|
||||
rm -f /usr/bin/resin
|
@ -1,327 +0,0 @@
|
||||
/**
|
||||
* EnvVarUpdate.nsh
|
||||
* : Environmental Variables: append, prepend, and remove entries
|
||||
*
|
||||
* WARNING: If you use StrFunc.nsh header then include it before this file
|
||||
* with all required definitions. This is to avoid conflicts
|
||||
*
|
||||
* Usage:
|
||||
* ${EnvVarUpdate} "ResultVar" "EnvVarName" "Action" "RegLoc" "PathString"
|
||||
*
|
||||
* Credits:
|
||||
* Version 1.0
|
||||
* * Cal Turney (turnec2)
|
||||
* * Amir Szekely (KiCHiK) and e-circ for developing the forerunners of this
|
||||
* function: AddToPath, un.RemoveFromPath, AddToEnvVar, un.RemoveFromEnvVar,
|
||||
* WriteEnvStr, and un.DeleteEnvStr
|
||||
* * Diego Pedroso (deguix) for StrTok
|
||||
* * Kevin English (kenglish_hi) for StrContains
|
||||
* * Hendri Adriaens (Smile2Me), Diego Pedroso (deguix), and Dan Fuhry
|
||||
* (dandaman32) for StrReplace
|
||||
*
|
||||
* Version 1.1 (compatibility with StrFunc.nsh)
|
||||
* * techtonik
|
||||
*
|
||||
* http://nsis.sourceforge.net/Environmental_Variables:_append%2C_prepend%2C_and_remove_entries
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
!ifndef ENVVARUPDATE_FUNCTION
|
||||
!define ENVVARUPDATE_FUNCTION
|
||||
!verbose push
|
||||
!verbose 3
|
||||
!include "LogicLib.nsh"
|
||||
!include "WinMessages.NSH"
|
||||
!include "StrFunc.nsh"
|
||||
|
||||
; ---- Fix for conflict if StrFunc.nsh is already includes in main file -----------------------
|
||||
!macro _IncludeStrFunction StrFuncName
|
||||
!ifndef ${StrFuncName}_INCLUDED
|
||||
${${StrFuncName}}
|
||||
!endif
|
||||
!ifndef Un${StrFuncName}_INCLUDED
|
||||
${Un${StrFuncName}}
|
||||
!endif
|
||||
!define un.${StrFuncName} "${Un${StrFuncName}}"
|
||||
!macroend
|
||||
|
||||
!insertmacro _IncludeStrFunction StrTok
|
||||
!insertmacro _IncludeStrFunction StrStr
|
||||
!insertmacro _IncludeStrFunction StrRep
|
||||
|
||||
; ---------------------------------- Macro Definitions ----------------------------------------
|
||||
!macro _EnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define EnvVarUpdate '!insertmacro "_EnvVarUpdateConstructor"'
|
||||
|
||||
!macro _unEnvVarUpdateConstructor ResultVar EnvVarName Action Regloc PathString
|
||||
Push "${EnvVarName}"
|
||||
Push "${Action}"
|
||||
Push "${RegLoc}"
|
||||
Push "${PathString}"
|
||||
Call un.EnvVarUpdate
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
!define un.EnvVarUpdate '!insertmacro "_unEnvVarUpdateConstructor"'
|
||||
; ---------------------------------- Macro Definitions end-------------------------------------
|
||||
|
||||
;----------------------------------- EnvVarUpdate start----------------------------------------
|
||||
!define hklm_all_users 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
!define hkcu_current_user 'HKCU "Environment"'
|
||||
|
||||
!macro EnvVarUpdate UN
|
||||
|
||||
Function ${UN}EnvVarUpdate
|
||||
|
||||
Push $0
|
||||
Exch 4
|
||||
Exch $1
|
||||
Exch 3
|
||||
Exch $2
|
||||
Exch 2
|
||||
Exch $3
|
||||
Exch
|
||||
Exch $4
|
||||
Push $5
|
||||
Push $6
|
||||
Push $7
|
||||
Push $8
|
||||
Push $9
|
||||
Push $R0
|
||||
|
||||
/* After this point:
|
||||
-------------------------
|
||||
$0 = ResultVar (returned)
|
||||
$1 = EnvVarName (input)
|
||||
$2 = Action (input)
|
||||
$3 = RegLoc (input)
|
||||
$4 = PathString (input)
|
||||
$5 = Orig EnvVar (read from registry)
|
||||
$6 = Len of $0 (temp)
|
||||
$7 = tempstr1 (temp)
|
||||
$8 = Entry counter (temp)
|
||||
$9 = tempstr2 (temp)
|
||||
$R0 = tempChar (temp) */
|
||||
|
||||
; Step 1: Read contents of EnvVarName from RegLoc
|
||||
;
|
||||
; Check for empty EnvVarName
|
||||
${If} $1 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: EnvVarName is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for valid Action
|
||||
${If} $2 != "A"
|
||||
${AndIf} $2 != "P"
|
||||
${AndIf} $2 != "R"
|
||||
SetErrors
|
||||
DetailPrint "ERROR: Invalid Action - must be A, P, or R"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
${If} $3 == HKLM
|
||||
ReadRegStr $5 ${hklm_all_users} $1 ; Get EnvVarName from all users into $5
|
||||
${ElseIf} $3 == HKCU
|
||||
ReadRegStr $5 ${hkcu_current_user} $1 ; Read EnvVarName from current user into $5
|
||||
${Else}
|
||||
SetErrors
|
||||
DetailPrint 'ERROR: Action is [$3] but must be "HKLM" or HKCU"'
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Check for empty PathString
|
||||
${If} $4 == ""
|
||||
SetErrors
|
||||
DetailPrint "ERROR: PathString is blank"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Make sure we've got some work to do
|
||||
${If} $5 == ""
|
||||
${AndIf} $2 == "R"
|
||||
SetErrors
|
||||
DetailPrint "$1 is empty - Nothing to remove"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
${EndIf}
|
||||
|
||||
; Step 2: Scrub EnvVar
|
||||
;
|
||||
StrCpy $0 $5 ; Copy the contents to $0
|
||||
; Remove spaces around semicolons (NOTE: spaces before the 1st entry or
|
||||
; after the last one are not removed here but instead in Step 3)
|
||||
${If} $0 != "" ; If EnvVar is not empty ...
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 " ;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 " ;" ";" ; Remove '<space>;'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 "; "
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 "; " ";" ; Remove ';<space>'
|
||||
${Loop}
|
||||
${Do}
|
||||
${${UN}StrStr} $7 $0 ";;"
|
||||
${If} $7 == ""
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${${UN}StrRep} $0 $0 ";;" ";"
|
||||
${Loop}
|
||||
|
||||
; Remove a leading or trailing semicolon from EnvVar
|
||||
StrCpy $7 $0 1 0
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 "" 1 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
StrLen $6 $0
|
||||
IntOp $6 $6 - 1
|
||||
StrCpy $7 $0 1 $6
|
||||
${If} $7 == ";"
|
||||
StrCpy $0 $0 $6 ; Change ';<EnvVar>' to '<EnvVar>'
|
||||
${EndIf}
|
||||
; DetailPrint "Scrubbed $1: [$0]" ; Uncomment to debug
|
||||
${EndIf}
|
||||
|
||||
/* Step 3. Remove all instances of the target path/string (even if "A" or "P")
|
||||
$6 = bool flag (1 = found and removed PathString)
|
||||
$7 = a string (e.g. path) delimited by semicolon(s)
|
||||
$8 = entry counter starting at 0
|
||||
$9 = copy of $0
|
||||
$R0 = tempChar */
|
||||
|
||||
${If} $5 != "" ; If EnvVar is not empty ...
|
||||
StrCpy $9 $0
|
||||
StrCpy $0 ""
|
||||
StrCpy $8 0
|
||||
StrCpy $6 0
|
||||
|
||||
${Do}
|
||||
${${UN}StrTok} $7 $9 ";" $8 "0" ; $7 = next entry, $8 = entry counter
|
||||
|
||||
${If} $7 == "" ; If we've run out of entries,
|
||||
${ExitDo} ; were done
|
||||
${EndIf} ;
|
||||
|
||||
; Remove leading and trailing spaces from this entry (critical step for Action=Remove)
|
||||
${Do}
|
||||
StrCpy $R0 $7 1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 "" 1 ; Remove leading space
|
||||
${Loop}
|
||||
${Do}
|
||||
StrCpy $R0 $7 1 -1
|
||||
${If} $R0 != " "
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $7 $7 -1 ; Remove trailing space
|
||||
${Loop}
|
||||
${If} $7 == $4 ; If string matches, remove it by not appending it
|
||||
StrCpy $6 1 ; Set 'found' flag
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 == "" ; and the 1st string being added to $0,
|
||||
StrCpy $0 $7 ; copy it to $0 without a prepended semicolon
|
||||
${ElseIf} $7 != $4 ; If string does NOT match
|
||||
${AndIf} $0 != "" ; and this is NOT the 1st string to be added to $0,
|
||||
StrCpy $0 $0;$7 ; append path to $0 with a prepended semicolon
|
||||
${EndIf} ;
|
||||
|
||||
IntOp $8 $8 + 1 ; Bump counter
|
||||
${Loop} ; Check for duplicates until we run out of paths
|
||||
${EndIf}
|
||||
|
||||
; Step 4: Perform the requested Action
|
||||
;
|
||||
${If} $2 != "R" ; If Append or Prepend
|
||||
${If} $6 == 1 ; And if we found the target
|
||||
DetailPrint "Target is already present in $1. It will be removed and"
|
||||
${EndIf}
|
||||
${If} $0 == "" ; If EnvVar is (now) empty
|
||||
StrCpy $0 $4 ; just copy PathString to EnvVar
|
||||
${If} $6 == 0 ; If found flag is either 0
|
||||
${OrIf} $6 == "" ; or blank (if EnvVarName is empty)
|
||||
DetailPrint "$1 was empty and has been updated with the target"
|
||||
${EndIf}
|
||||
${ElseIf} $2 == "A" ; If Append (and EnvVar is not empty),
|
||||
StrCpy $0 $0;$4 ; append PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "appended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was appended to $1"
|
||||
${EndIf}
|
||||
${Else} ; If Prepend (and EnvVar is not empty),
|
||||
StrCpy $0 $4;$0 ; prepend PathString
|
||||
${If} $6 == 1
|
||||
DetailPrint "prepended to $1"
|
||||
${Else}
|
||||
DetailPrint "Target was prepended to $1"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${Else} ; If Action = Remove
|
||||
${If} $6 == 1 ; and we found the target
|
||||
DetailPrint "Target was found and removed from $1"
|
||||
${Else}
|
||||
DetailPrint "Target was NOT found in $1 (nothing to remove)"
|
||||
${EndIf}
|
||||
${If} $0 == ""
|
||||
DetailPrint "$1 is now empty"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Step 5: Update the registry at RegLoc with the updated EnvVar and announce the change
|
||||
;
|
||||
ClearErrors
|
||||
${If} $3 == HKLM
|
||||
WriteRegExpandStr ${hklm_all_users} $1 $0 ; Write it in all users section
|
||||
${ElseIf} $3 == HKCU
|
||||
WriteRegExpandStr ${hkcu_current_user} $1 $0 ; Write it to current user section
|
||||
${EndIf}
|
||||
|
||||
IfErrors 0 +4
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "Could not write updated $1 to $3"
|
||||
DetailPrint "Could not write updated $1 to $3"
|
||||
Goto EnvVarUpdate_Restore_Vars
|
||||
|
||||
; "Export" our change
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
EnvVarUpdate_Restore_Vars:
|
||||
;
|
||||
; Restore the user's variables and return ResultVar
|
||||
Pop $R0
|
||||
Pop $9
|
||||
Pop $8
|
||||
Pop $7
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Push $0 ; Push my $0 (ResultVar)
|
||||
Exch
|
||||
Pop $0 ; Restore his $0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!macroend ; EnvVarUpdate UN
|
||||
!insertmacro EnvVarUpdate ""
|
||||
!insertmacro EnvVarUpdate "un."
|
||||
;----------------------------------- EnvVarUpdate end----------------------------------------
|
||||
|
||||
!verbose pop
|
||||
!endif
|
@ -1,417 +0,0 @@
|
||||
;ZipDLL include file for NSIS
|
||||
;Written by Tim Kosse (mailto:tim.kosse@gmx.de)
|
||||
;some improvements by deguix
|
||||
|
||||
;Supported languages with their translators in alphabetical order:
|
||||
|
||||
;Arabic translation by asdfuae
|
||||
;Brazilian Portuguese translation by "deguix"
|
||||
;Chinese, Simplified translation by Kii Ali <kiiali@cpatch.org>
|
||||
;Chinese, Traditional traslation by "matini" and Kii Ali <kiiali@cpatch.org>
|
||||
;Croatian translation by "iostriz"
|
||||
;Danish translation by Claus Futtrup
|
||||
;French translation by "veekee"
|
||||
;German translation by Tim Kosse
|
||||
;Hungarian translation by Toth Laszlo
|
||||
;Korean translation by Seongab Kim
|
||||
;Lithuanian translation by Vytautas Krivickas
|
||||
;Polish translation by Krzysztof Galuszka
|
||||
;Russion translation by Sergey
|
||||
;Spanish translation by "dark_boy"
|
||||
|
||||
!ifndef ZIPDLL_USED
|
||||
|
||||
!define ZIPDLL_USED
|
||||
|
||||
!macro ZIPDLL_EXTRACT SOURCE DESTINATION FILE
|
||||
|
||||
!define "FILE_${FILE}"
|
||||
|
||||
!ifndef FILE_<ALL>
|
||||
Push "${FILE}"
|
||||
!endif
|
||||
|
||||
IfFileExists "${DESTINATION}" +2
|
||||
CreateDirectory "${DESTINATION}"
|
||||
|
||||
Push "${DESTINATION}"
|
||||
|
||||
IfFileExists "${SOURCE}" +2
|
||||
SetErrors
|
||||
|
||||
Push "${SOURCE}"
|
||||
|
||||
;The strings that will be translated are (ready to copy,
|
||||
;remove leading semicolons in your language block):
|
||||
|
||||
!ifdef LANG_ENGLISH
|
||||
|
||||
;English is default language of ZipDLL, no need to push the untranslated strings
|
||||
|
||||
;StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +1
|
||||
|
||||
;Push " Error: %s"
|
||||
;Push "Could not get file attributes."
|
||||
;Push "Error: Could not get file attributes."
|
||||
;Push "Could not extract %s"
|
||||
;Push " Error: Could not extract %s"
|
||||
|
||||
;!ifdef FILE_<ALL>
|
||||
;Push " Extract: %s"
|
||||
;Push " Extracting %d files and directories"
|
||||
;Push "Extracting contents of %s to %s"
|
||||
;!else
|
||||
;Push "Specified file does not exist in archive."
|
||||
;Push "Error: Specified file does not exist in archive."
|
||||
;Push "Extracting the file %s from %s to %s"
|
||||
;!endif
|
||||
|
||||
;Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_HUNGARIAN
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_HUNGARIAN} 0 +10
|
||||
|
||||
Push " Hiba: %s"
|
||||
Push "Nem olvashat<61> a f<>jl attrib<69>tumai."
|
||||
Push "Hiba: Nem olvashat<61> a f<>jl attrib<69>tumai."
|
||||
Push "Nem siker<65>lt kicsomagolni a(z) %s"
|
||||
Push " Hiba: Nem siker<65>lt kicsomagolni a(z) %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Kicsomagol<6F>s: %s"
|
||||
Push " %d f<>jl <20>s mappa kicsomagol<6F>sa"
|
||||
Push "%s tartalom kicsomagol<6F>sa a %s helyre"
|
||||
!else
|
||||
Push "A megadott f<>jl nem tal<61>lhat<61> az arh<72>vumban."
|
||||
Push "Hiba: A megadott f<>jl nem tal<61>lhat<61> az arh<72>vumban."
|
||||
Push "%s f<>jl kcsomagol<6F>sa a(z) %s f<>jlb<6C>l a %s helyre"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_FRENCH
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_FRENCH} 0 +10
|
||||
|
||||
Push " Erreur : %s"
|
||||
Push "Impossible de r<>cup<75>rer les informations sur le fichier."
|
||||
Push "Erreur : Impossible de r<>cup<75>rer les informations sur le fichier."
|
||||
Push "Impossible de d<>compresser %s."
|
||||
Push " Erreur : Impossible de d<>compresser %s."
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " D<>compression : %s"
|
||||
Push " D<>compression de %d fichiers et r<>pertoires"
|
||||
Push "D<EFBFBD>compression des donn<6E>es de %s vers %s"
|
||||
!else
|
||||
Push "Le fichier sp<73>cifi<66> n'existe pas dans l'archive"
|
||||
Push "Erreur : Le fichier sp<73>cifi<66> n'existe pas dans l'archive"
|
||||
Push "D<EFBFBD>compression du fichier %s depuis %s vers %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_GERMAN
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_GERMAN} 0 +10
|
||||
|
||||
Push " Fehler: %s"
|
||||
Push "Dateiattribute konnten nicht ermittelt werden."
|
||||
Push "Fehler: Dateiattribute konnten nicht ermittelt werden."
|
||||
Push "%s konnte nicht dekomprimiert werden."
|
||||
Push " Fehler: %s konnte nicht dekomprimiert werden."
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Dekomprimiere: %s"
|
||||
Push " Dekomprimiere %d Dateien und Verzeichnisse"
|
||||
Push "Dekomprimiere Inhalt von %s nach %s"
|
||||
!else
|
||||
Push "Die angegebene Datei existiert nicht im Archiv"
|
||||
Push "Fehler: Die angegebene Datei existiert nicht im Archiv"
|
||||
Push "Dekomprimiere Datei %s von %s nach %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_SPANISH
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +10
|
||||
|
||||
Push " Error: %s"
|
||||
Push "No se obtuvieron atributos del archivo"
|
||||
Push "Error: No se obtuvieron atributos del archivo"
|
||||
Push "No se pudo extraer %s"
|
||||
Push " Error: No se pudo extraer %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Extraer: %s"
|
||||
Push " Extrayendo %d archivos y directorios"
|
||||
Push "Extraer archivos de %s a %s"
|
||||
!else
|
||||
Push "Archivo especificado no existe en el ZIP"
|
||||
Push "Error: El archivo especificado no existe en el ZIP"
|
||||
Push "Extrayendo el archivo %s de %s a %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_PORTUGUESEBR
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} 0 +10
|
||||
|
||||
Push " Erro: %s"
|
||||
Push "N<EFBFBD>o se pode ler os atributos do arquivo"
|
||||
Push "Error: N<>o se pode ler os atributos do arquivo"
|
||||
Push "N<EFBFBD>o se pode extrair %s"
|
||||
Push " Erro: N<>o se pode extrair %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Extraindo: %s"
|
||||
Push " Extraindo %d arquivos e diret<65>rios"
|
||||
Push "Extraindo arquivos de %s a %s"
|
||||
!else
|
||||
Push "O arquivo especificado n<>o existe no ZIP"
|
||||
Push "Erro: O arquivo especificado n<>o existe no ZIP"
|
||||
Push "Extraindo o arquivo %s de %s a %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_TRADCHINESE
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_TRADCHINESE} 0 +11
|
||||
|
||||
Push " <20><><EFBFBD>~: %s"
|
||||
Push "<EFBFBD>L<EFBFBD>k<EFBFBD><EFBFBD><EFBFBD>o<EFBFBD>ɮ<EFBFBD><EFBFBD>ݩʡC"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>~: <20>L<EFBFBD>k<EFBFBD><6B><EFBFBD>o<EFBFBD>ɮ<EFBFBD><C9AE>ݩʡC"
|
||||
Push "<EFBFBD>L<EFBFBD>k<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y %s"
|
||||
Push " <20><><EFBFBD>~<7E>G<EFBFBD>L<EFBFBD>k<EFBFBD><6B><EFBFBD><EFBFBD><EFBFBD>Y %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>G%s"
|
||||
Push " <20><><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>Y %d <20>ɮP<D7BB>ؿ<EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y %s <20><><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD><65> %s"
|
||||
!else
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><EFBFBD><EFBFBD>ɮרä<EFBFBD><EFBFBD>s<EFBFBD>b<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>]<5D>C"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>~<7E>G<EFBFBD><47><EFBFBD>w<EFBFBD><77><EFBFBD>ɮרä<D7A8><C3A4>s<EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>]<5D>C"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>b<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y<EFBFBD>ɮ<EFBFBD> %s <20>A<EFBFBD>q %s <20><> %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_SIMPCHINESE
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_SIMPCHINESE} 0 +11
|
||||
|
||||
Push " <20><><EFBFBD><EFBFBD>: %s"
|
||||
Push "<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ԡ<EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD> %s"
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>ѹ<EFBFBD><D1B9> %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>%s"
|
||||
Push " <20><><EFBFBD>ڽ<EFBFBD>ѹ<EFBFBD><D1B9> %d <20>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD>ѹ<EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD> %s"
|
||||
!else
|
||||
Push "ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> %s <20><><EFBFBD><EFBFBD> %s <20><> %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_LITHUANIAN
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_LITHUANIAN} 0 +10
|
||||
|
||||
Push " Klaida: %s"
|
||||
Push "Negaleta gauti bylos nuorodu."
|
||||
Push "Klaida: Negaleta gauti bylos nuorodu."
|
||||
Push "Negaleta i<>traukti %s"
|
||||
Push " Klaida: Negaleta i<>traukti %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " I<>traukiam : %s"
|
||||
Push " I<>traukiame %d bylas ir katalogus"
|
||||
Push "I<EFBFBD>traukiame viska is %s i %s"
|
||||
!else
|
||||
Push "Parinkta byla nesurasta <20>iame archyve."
|
||||
Push "Klaida: Parinkta byla nesurasta <20>iame archyve."
|
||||
Push "I<EFBFBD>traukiame byla %s i<> %s i %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef "LANG_POLISH"
|
||||
|
||||
strcmp $LANGUAGE ${LANG_POLISH} 0 +10
|
||||
|
||||
Push " B<><42>d: %s"
|
||||
Push "Nie mo<6D>e pobra<72> atrybutu pliku."
|
||||
Push "B<EFBFBD><EFBFBD>d: Nie mo<6D>e pobra<72> atrybutu pliku."
|
||||
Push "Nie mo<6D>e rozpakowa<77> %s."
|
||||
Push " B<><42>d: Nie mo<6D>e rozpakowa<77> %s."
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Rozpakuj: %s"
|
||||
Push " Rozpakowywanie %d plik<69>w i katalog<6F>w"
|
||||
Push "Rozpakowywanie zawarto<74>ci %s do %s"
|
||||
!else
|
||||
Push "Plik nie istnieje w archiwum"
|
||||
Push "B<EFBFBD><EFBFBD>d: Plik nie istnieje w archiwum"
|
||||
Push "Rozpakowywanie pliku %s z %s do %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef "LANG_KOREAN"
|
||||
strcmp $LANGUAGE ${LANG_KOREAN} 0 +10
|
||||
Push " <20><><EFBFBD><EFBFBD> : %s"
|
||||
Push "ȭ<EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ȭ<><C8AD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
Push "%s<><73>(<28><>) Ǯ <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
Push " <20><><EFBFBD><EFBFBD>: %s<><73>(<28><>) Ǯ <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Ǯ<><C7AE> : %s"
|
||||
Push " %d<><64><EFBFBD><EFBFBD> <20><><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ǫ<><C7AA> <20><>"
|
||||
Push "%s<><73> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s<><73> Ǫ<><C7AA> <20><>"
|
||||
!else
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ȿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ȿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."
|
||||
Push "%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s<><73><EFBFBD><EFBFBD> %s<><73> Ǫ<><C7AA> <20><>"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef "LANG_RUSSIAN"
|
||||
|
||||
strcmp $LANGUAGE ${LANG_RUSSIAN} 0 +10
|
||||
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s"
|
||||
Push "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s"
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s"
|
||||
|
||||
!ifdef LANG_<ALL>
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s"
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> %s <20> %s"
|
||||
!else
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: S<><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> %s <20><> %s <20> %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_ARABIC
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_ARABIC} 0 +10
|
||||
|
||||
Push " <20><><EFBFBD><EFBFBD>: %s"
|
||||
Push "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s"
|
||||
Push " <20><><EFBFBD><EFBFBD>: <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s"
|
||||
Push " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> %d"
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD> %s"
|
||||
!else
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>."
|
||||
Push "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> %s <20><> %s <20><><EFBFBD> %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_DANISH
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_DANISH} 0 +10
|
||||
|
||||
Push " Fejl: %s"
|
||||
Push "Kunne ikke l<>se fil attributter."
|
||||
Push "Fejl: Kunne ikke l<>se fil attributter."
|
||||
Push "Kunne ikke udpakke %s"
|
||||
Push " Fejl: Kunne ikke udpakke %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Udpakker: %s"
|
||||
Push " Udpakker %d filer og mapper"
|
||||
Push "Udpakker indhold fra %s til %s"
|
||||
!else
|
||||
Push "Specificeret fil eksisterer ikke i filarkivet"
|
||||
Push "Fejl: Specificeret fil eksisterer ikke i filarkivet"
|
||||
Push "Udpakker fil %s fra %s til %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef LANG_CROATIAN
|
||||
|
||||
StrCmp $LANGUAGE ${LANG_CROATIAN} 0 +10
|
||||
|
||||
Push " Gre<72>ka: %s"
|
||||
Push "Ne mogu dohvatiti atribute datoteke."
|
||||
Push "Gre<EFBFBD>ka: Ne mogu dohvatiti atribute datoteke."
|
||||
Push "Ne mogu ekstrahirati %s"
|
||||
Push " Gre<72>ka: Ne mogu ekstrahirati %s"
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
Push " Ekstrakcija: %s"
|
||||
Push " Ekstrakcija %d datoteka i mapa"
|
||||
Push "Ekstrakcija sadr<64>aja %s u %s"
|
||||
!else
|
||||
Push "Tra<EFBFBD>ena datoteka ne postoji u arhivi."
|
||||
Push "Gre<EFBFBD>ka: Tra<72>ena datoteka ne postoji u arhivi."
|
||||
Push "Ekstrakcija datoteke %s iz %s u %s"
|
||||
!endif
|
||||
|
||||
Push "/TRANSLATE"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef FILE_<ALL>
|
||||
ZipDLL::extractall
|
||||
!else
|
||||
ZipDLL::extractfile
|
||||
!endif
|
||||
|
||||
!undef "FILE_${FILE}"
|
||||
|
||||
!macroend
|
||||
|
||||
!endif
|
@ -1,21 +0,0 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2014 Resin.io, Inc. https://resin.io
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 201 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB |
@ -1,44 +0,0 @@
|
||||
!addincludedir "Include"
|
||||
!addplugindir "Plugins"
|
||||
|
||||
!include "MUI2.nsh"
|
||||
!include "EnvVarUpdate.nsh"
|
||||
!include "zipdll.nsh"
|
||||
|
||||
Name "Resin CLI"
|
||||
OutFile "..\..\build\distrib\resin-cli-setup.exe"
|
||||
BrandingText "Resin.io"
|
||||
|
||||
InstallDir "$PROGRAMFILES\Resin.io\resin-cli"
|
||||
|
||||
; MUI settings
|
||||
!define MUI_ICON "logo.ico"
|
||||
!define MUI_UNICON "logo.ico"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "banner.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "banner.bmp"
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "License.txt"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
Section "Install"
|
||||
SetOutPath $INSTDIR
|
||||
File "..\..\build\distrib\resin-cli-win32.zip"
|
||||
!insertmacro ZIPDLL_EXTRACT "$INSTDIR\resin-cli-win32.zip" "$INSTDIR" "<ALL>"
|
||||
Delete "$INSTDIR\resin-cli-win32.zip"
|
||||
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
RMDir /r "$INSTDIR"
|
||||
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin"
|
||||
SectionEnd
|
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
OUTPUT=$1
|
||||
INPUT=$2
|
||||
|
||||
for file in $INPUT/*.coffee; do
|
||||
|
||||
# Omit this unecessary files
|
||||
if [ `basename "$file"` == 'index.coffee' ] || [ `basename "$file"` == 'command-options.coffee' ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
filename=`basename "${file%.*}"`
|
||||
output=$OUTPUT/$filename
|
||||
mkdir -p $output
|
||||
./node_modules/coffee-script/bin/coffee extras/capitano-doc/index.coffee markdown "$file" "$output"
|
||||
echo "[CapitanoDoc] Processed $file to $output"
|
||||
done
|
Reference in New Issue
Block a user