Compare commits

...

135 Commits

Author SHA1 Message Date
1f8c610bb0 Resin CLI v0.10.6 2015-05-14 11:50:43 -03:00
d220728380 Merge pull request #49 from resin-io/feature/device-list-devices
Return devices array to the done callback in device list command
2015-05-14 11:47:25 -03:00
db58e9986c Return devices array to the done callback in device list command
Useful when using the CLI programatically.
2015-05-14 11:43:41 -03:00
2a5e66eca6 Merge pull request #48 from resin-io/feature/use-selfupdate
Make use of selfupdate
2015-05-14 11:40:23 -03:00
e7e8ec296c Make use of selfupdate 2015-05-14 11:32:18 -03:00
80e69c56d0 Resin CLI v0.10.5 2015-05-11 14:42:00 -03:00
ce3c6aecff Upgrade Resin SDK to v1.4.3 2015-05-11 14:39:55 -03:00
300f76ba83 Upgrade Resin SDK to v1.4.2 2015-05-11 14:27:09 -03:00
a4e8a38bf4 Merge pull request #44 from resin-io/fix/download-exit
Fix callback not being called on success in os download command
2015-05-11 14:26:07 -03:00
9bb04f43a8 Fix callback not being called on success in os download command 2015-05-11 14:23:34 -03:00
9b0c08bd46 Don't umount in os install as it's already handled in Resin Image 2015-05-11 13:10:06 -03:00
679d48e86e Merge branch 'master' of github.com:resin-io/resin-cli 2015-05-11 13:08:44 -03:00
4b6bf60531 Upgrade Resin Image to v1.1.2 2015-05-11 12:38:19 -03:00
d8ce6648e2 Handle device unmounting in os install command 2015-05-11 10:04:05 -03:00
402bc2d3a8 Merge pull request #43 from resin-io/fix/non-interactive-login
Make login command behave non interactively if a token is passed as an argument
2015-05-11 09:46:07 -03:00
f3e193be0f Make login command behave non interactively if a token is passed as an argument 2015-05-11 09:42:25 -03:00
f5b461612b Upgrade Capitano to v1.6.0 2015-05-11 09:30:07 -03:00
d2514a3fc3 Resin CLI v0.10.4 2015-05-08 14:29:02 -03:00
2019f9fdeb Merge pull request #42 from resin-io/feature/use-resin-image
Make use of resin-image to remove image writing logic from the CLI
2015-05-08 14:28:33 -03:00
656f3e5cd9 Make use of resin-image to remove image writing logic from the CLI 2015-05-08 14:26:04 -03:00
741acfbba3 Merge pull request #41 from resin-io/feature/command-run
Make use of capitano.run() to run subcommands
2015-05-08 14:23:37 -03:00
4b7eca02a0 Resin CLI v0.10.3 2015-05-07 12:03:40 -03:00
c7788a80e1 Upgrade Resin SDK to v1.4.1
That version includes the os download piping issue fix
2015-05-07 12:03:12 -03:00
08648894e3 Merge pull request #40 from resin-io/feature/device-await
Implement device await command
2015-05-06 11:18:42 -03:00
4c5d5697bc Implement device await command 2015-05-06 11:14:08 -03:00
c758a5b9ea Make use of capitano.run() to run subcommands 2015-05-05 17:34:24 -03:00
2af54e2e28 Merge pull request #39 from resin-io/feature/coffee-compile
Compile CoffeeScript by default when initializing watch task
2015-05-05 06:49:45 -03:00
cf9b23b987 Compile CoffeeScript by default when initializing watch task 2015-05-05 00:21:30 -04:00
f8380ec8e6 Merge pull request #38 from resin-io/feature/os-install-umount
Handle device unmounting in os install command
2015-05-05 00:06:25 -04:00
cd3245a631 Handle device unmounting in os install command 2015-05-02 10:34:11 -04:00
144a155208 Merge pull request #36 from resin-io/feature/standard-version
Implement --version/-v global options. Closes #35
2015-04-30 13:12:51 -04:00
7f7ca13001 Implement --version/-v global options. Closes #35 2015-04-30 11:56:15 -04:00
361e149063 Merge pull request #34 from resin-io/fix/note-validation
Fix note command validation issues
2015-04-29 14:43:47 -04:00
fab85b381a Throw a nice error if note contents are missing 2015-04-29 14:39:46 -04:00
faecf103bf Upgrade Resin SDK to v1.3.4
This version addresses the device validation issue
2015-04-29 14:39:28 -04:00
a0f8c1aa8c Merge pull request #33 from resin-io/fix/devices-app-name
Fix devices command not showing application names. Closes #32
2015-04-29 14:13:09 -04:00
24726b575d Fix devices command not showing application names. Closes #32 2015-04-29 14:07:59 -04:00
688b89a099 Resin CLI v0.10.2 2015-04-28 09:34:41 -04:00
2e39110cc0 Merge pull request #31 from resin-io/feature/app-uniqueness
Check that an application exists before asking it's type. Closes #30
2015-04-28 09:33:59 -04:00
193cedae26 Check that an application exists before asking it's type. Closes #30 2015-04-28 09:18:21 -04:00
3d1f023ef5 Merge pull request #29 from resin-io/feature/list-all-devices
Make devices command list all devices if no application option
2015-04-27 11:26:00 -04:00
9bb51d7146 Make devices command list all devices if no application option. Closes #17 2015-04-27 11:21:30 -04:00
84900aa588 Remove outdated uuid checking help message 2015-04-27 10:51:26 -04:00
b2bce3c4ac Upgrade Resin SDK 2015-04-27 10:49:28 -04:00
8c11620a42 Upgrade Resin SDK 2015-04-27 10:33:34 -04:00
7c1e0ac2e9 Merge pull request #28 from resin-io/fix/logs-messages
Fix logs printing, as messages got added a message property
2015-04-27 10:05:16 -04:00
9a3c844336 Print logs correctly, as they recently got a message field added 2015-04-27 09:30:57 -04:00
69039d21c2 Resin CLI v0.10.1 2015-04-21 11:28:24 -04:00
34c9cdd8bb Upgrade Resin SDK to v1.2.1 2015-04-21 11:26:40 -04:00
0a8b30e824 Resin CLI v0.10.0 2015-04-21 09:06:45 -04:00
ea5b521262 Merge pull request #26 from resin-io/fix/device-init-temp-output
Fix temporary os download output option in device init
2015-04-21 09:06:11 -04:00
3bc71577b5 Fix temporary os download output option in device init 2015-04-21 08:37:40 -04:00
0fb24162fc Merge pull request #24 from resin-io/fix/update
Fix logical issue in update command
2015-04-20 14:14:33 -04:00
d0d63f5bbb Merge pull request #25 from resin-io/deduplicate/whoami
Remove duplicated whoami command
2015-04-20 14:14:25 -04:00
8041905144 Remove duplicated whoami command 2015-04-20 12:46:43 -04:00
37d96e238d Fix logical issue in update command 2015-04-20 12:42:31 -04:00
ae8c941bfe Resin CLI v0.9.0 2015-04-20 12:15:57 -04:00
4c16835ca4 Merge pull request #23 from resin-io/feature/device-init-app-name
Make device init and os download take app names instead of ids
2015-04-20 12:14:53 -04:00
7bd8922a4e Upgrade Resin VCS to v1.2.0 and make use of vcs.getApplicationName() 2015-04-20 11:41:26 -04:00
42b2e2fcf0 Regenerate documentation 2015-04-20 09:14:47 -04:00
f7256e9927 Make device init command take an application name instead of id 2015-04-20 09:13:15 -04:00
85444a5a6a Make os download command accept an application name instead of id 2015-04-20 09:06:40 -04:00
ac115c7ea3 Merge pull request #22 from resin-io/feature/clone-dir
Make "example clone" clone to a new directory
2015-04-20 08:59:28 -04:00
3c2a440553 Make "example clone" clone to a new directory 2015-04-20 08:56:10 -04:00
b29ce3ee04 Resin CLI v0.8.1 2015-04-17 15:09:40 -04:00
2b4394f3ce Merge pull request #21 from resin-io/fix/progress-context
Bind progress update function to avoid context issues
2015-04-17 14:45:17 -04:00
60f704eaa9 Merge pull request #20 from resin-io/fix/elevate-lodash
Add lodash dependency to lib/elevate.coffee
2015-04-17 14:44:50 -04:00
caa4fcf754 Bind progress update function to avoid context issues 2015-04-17 10:11:02 -04:00
c4d1e4244e Upgrade Nplugm to v2.2.0 2015-04-17 10:10:35 -04:00
a6dc155028 Add lodash dependency to lib/elevate.coffee
Depedency was missing and thus elevating functions threw errors.
2015-04-17 09:22:21 -04:00
9c65d11e66 Add documentation anchor support 2015-04-16 11:11:51 -04:00
26f50e7a74 Merge pull request #16 from resin-io/documentation/single-page
Implement Single Page documentation
2015-04-16 09:51:00 -04:00
e4773da1d7 Implement Single Page documentation 2015-04-16 09:49:54 -04:00
dfd8086f63 Resin CLI v0.8.0 2015-04-08 08:37:07 -04:00
ec513c61ad Merge pull request #10 from resin-io/fix/login
Fix bug with login with token
2015-04-08 08:35:57 -04:00
a96ab487ba Fix bug with login with token
The commit was merged from an older branch, in which settings was
still part of the SDK.
2015-04-08 08:25:27 -04:00
cd28c985ce Merge pull request #9 from resin-io/feature/version
Remove bundled node version from version command
2015-04-07 10:56:18 -04:00
727af42ad4 Merge pull request #8 from resin-io/feature/login-with-token
Login with token
2015-04-07 08:12:12 -04:00
e96d411f3e Merge pull request #7 from resin-io/feature/rpi-bundle
Mock local Raspberry Pi bundle
2015-04-07 08:11:43 -04:00
4a7d3d5945 Mock local Raspberry Pi bundle 2015-04-07 08:10:26 -04:00
03f05305cf Fix tiny text issue 2015-04-07 08:07:06 -04:00
af6e9ef85d Merge pull request #6 from resin-io/feature/elevate
Move windosu elevate logic to another module
2015-04-07 08:05:23 -04:00
8533a4a303 Remove bundled node version from version command 2015-04-06 17:18:00 -04:00
85f9234c74 Add .resinconf to gitignore 2015-04-06 17:05:13 -04:00
064afd6705 Fetch TOKEN_URL from the resin sdk 2015-04-06 17:05:13 -04:00
978ff91f87 Remove tab query from preferences token url constant
Tab queries were removed from the web frontend.
2015-04-06 17:04:43 -04:00
5cebbce7bb Update login command documentation 2015-04-06 17:04:03 -04:00
1cd0f02db5 Attempt to open a browser to the token location automatically 2015-04-06 17:04:03 -04:00
77695bb505 Allow login with token 2015-04-06 17:02:53 -04:00
4e4428fdbb Move windosu elevate logic to another module 2015-04-06 16:49:53 -04:00
6e978d74dd Merge pull request #5 from resin-io/feature/hound-config
Add .hound.yml
2015-04-06 10:19:13 -04:00
58974af77b Add .hound.yml 2015-04-06 10:08:49 -04:00
11a0eae7a0 Merge pull request #4 from resin-io/feature/sudo-update
Elevate update command permissions if necessary
2015-04-02 12:53:45 -04:00
2a4ba895e5 Elevate privileges of update command if necessary 2015-04-01 12:51:04 -04:00
19c019076e "resin-cli" "0.7.0" 2015-03-31 13:17:32 -04:00
dfa18d3cb3 Merge pull request #3 from resin-io/fix/selfupdate
Use child_process to trigger self update
2015-03-31 13:15:58 -04:00
782c92885d Use child_process to trigger self update
Using the NPM API led to weird issues.

See https://github.com/npm/npm/issues/7723.
2015-03-24 08:44:02 -04:00
a14dfa6cf1 Fix long line lint warning 2015-03-23 18:32:28 -04:00
f3b6f9d117 Add missing example to device init 2015-03-23 08:25:45 -04:00
63b2b3feb6 Upgrade resin-vcs to 1.1.0 2015-03-23 08:24:29 -04:00
9237dd25ac "resin-cli" "0.6.0" 2015-03-23 08:18:13 -04:00
df9c4ce2fd Reference applications and devices by name 2015-03-23 08:17:55 -04:00
fa5a7abbbf Merge pull request #2 from resin-io/feature/whoami
Reimplement whoami command
2015-03-20 08:55:26 -04:00
cd8bb7882e Reimplement whoami command 2015-03-19 15:57:43 -04:00
3c0378142a Resin CLI v0.5.0 2015-03-19 11:45:38 -04:00
a524bffaa2 Integrate with SDK v1.0.0 2015-03-19 11:45:07 -04:00
4b3decbe03 Resin CLI v0.4.1 2015-03-17 08:54:27 -04:00
fa258a84cc Show a spinner if no progress state in os download command 2015-03-16 11:45:17 -04:00
5efa7309be Fix bug in device init 2015-03-16 11:06:44 -04:00
6e6a01c33c HTML Encode documentation require parameters 2015-03-16 08:51:26 -04:00
94ce15bc2c Make CapitanoDoc output *.markdown files 2015-03-16 08:45:44 -04:00
b20ed34756 Resin CLI v0.4.0 2015-03-12 12:07:51 -04:00
0b188b7ce9 Fetch resin-vcs from NPM 2015-03-12 12:07:18 -04:00
80e0f20301 Make device init attempt to get application id from current directory 2015-03-12 12:03:59 -04:00
8410a709c9 Make use of resin-vcs instead of using gitwrap directly 2015-03-12 11:24:36 -04:00
13011cca23 Regenerate command documentatio 2015-03-11 09:05:48 -04:00
53197856ab Extend device init help message 2015-03-11 09:05:20 -04:00
cb5bb69b47 Get rid of gitCli in favor of gitwrap 2015-03-11 09:03:13 -04:00
4bfe52d73b Require CLI to be updated when running os install 2015-03-11 08:49:26 -04:00
58f557065e Resin CLI v0.3.0 2015-03-10 14:42:48 -04:00
9d8228e1c6 Add ENOGIT specific error message 2015-03-10 13:56:55 -04:00
fec840b897 Upgrade gitwrap to v1.1.0 2015-03-10 13:53:35 -04:00
8fbde4c452 Make use of gitwrap 2015-03-10 10:03:49 -04:00
0cc1765a1e Regenerate documentation 2015-03-09 19:49:46 -04:00
f0346b1fd0 Allow to interactively configure network for os download 2015-03-09 19:42:43 -04:00
1bb798a8b8 Get rid of automatic cache name generation logic 2015-03-09 12:38:37 -04:00
4c35badcad Upgrade Resin SDK to v0.0.2 2015-03-09 11:49:52 -04:00
6ba97cd961 Automate resin init command 2015-03-09 09:14:39 -04:00
af08a2f306 Add LICENSE file 2015-03-05 15:43:39 -04:00
ded24432a5 Remove windows installer from the codebase
Has been moved to https://github.com/resin-io/resin-cli-installer-win32
2015-03-05 15:42:36 -04:00
bf124f196f Remove OS X installer from the codebase
Was moved to https://github.com/resin-io/resin-cli-installer-osx
2015-03-05 12:33:06 -04:00
6fc2d5eee1 Resin CLI v0.2.3 2015-03-05 12:16:48 -04:00
dbe181ea84 Upgrade resin-cli-visuals to v0.0.6 2015-03-05 12:16:31 -04:00
dd169d356a Resin CLI 0.2.2 2015-03-05 11:56:07 -04:00
4fbc016d18 Make use of resin-cli-visuals from NPM 2015-03-05 11:54:53 -04:00
100 changed files with 1758 additions and 2021 deletions

1
.gitignore vendored
View File

@ -32,3 +32,4 @@ bin/node
release/build
npm-shrinkwrap.json
.resinconf

5
.hound.yml Normal file
View File

@ -0,0 +1,5 @@
coffee_script:
config_file: coffeelint.json
java_script:
enabled: false

View File

@ -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',
@ -27,6 +31,11 @@
action: function(params, options, done) {
return async.waterfall([
function(callback) {
return resin.models.application.has(params.name, callback);
}, function(hasApplication, callback) {
if (hasApplication) {
return callback(new Error('You already have an application with that name!'));
}
if (options.type != null) {
return callback(null, options.type);
}
@ -46,7 +55,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 +69,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 +85,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);
}

View File

@ -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,31 @@
resin = require('resin-sdk');
settings = require('resin-settings-client');
visuals = require('resin-cli-visuals');
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences');
exports.login = {
signature: 'login',
signature: 'login [token]',
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'
}
],
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) {
var hasOptionCredentials;
hasOptionCredentials = !_.isEmpty(options);
if (hasOptionCredentials) {
if (!options.username) {
return done(new Error('Missing username'));
}
if (!options.password) {
return done(new Error('Missing password'));
}
}
return async.waterfall([
function(callback) {
if (hasOptionCredentials) {
return callback(null, options);
} else {
return visuals.widgets.login(callback);
if (params.token != null) {
return callback(null, params.token);
}
}, function(credentials, callback) {
return resin.auth.login(credentials, callback);
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 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 visuals.widgets.ask('What\'s your token? (visible in the preferences page)', null, callback);
});
}, function(token, callback) {
return resin.auth.loginWithToken(token, done);
}
], done);
}
@ -123,10 +111,14 @@
permission: 'user',
action: function(params, options, done) {
return resin.auth.whoami(function(error, username) {
if (error != null) {
return done(error);
}
if (username == null) {
return done(new Error('Username not found'));
}
return console.log(username);
console.log(username);
return done();
});
}
};

View File

@ -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',

View File

@ -1,5 +1,7 @@
(function() {
var _, async, commandOptions, osAction, path, resin, visuals;
var _, async, capitano, commandOptions, osAction, path, resin, tmp, vcs, visuals;
capitano = require('capitano');
_ = require('lodash-contrib');
@ -11,6 +13,12 @@
visuals = require('resin-cli-visuals');
vcs = require('resin-vcs');
tmp = require('tmp');
tmp.setGracefulCleanup();
commandOptions = require('./command-options');
osAction = require('./os');
@ -18,27 +26,33 @@
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',
options: [commandOptions.application],
help: 'Use this command to list all devices that belong to you.\n\nYou can filter the devices by application by using the `--application` option.\n\nExamples:\n\n $ resin devices\n $ resin devices --application MyApp\n $ resin devices --app MyApp\n $ resin devices -a MyApp',
options: [commandOptions.optionalApplication],
permission: 'user',
action: function(params, options, done) {
return resin.models.device.getAllByApplication(options.application, function(error, devices) {
var getFunction;
if (options.application != null) {
getFunction = _.partial(resin.models.device.getAllByApplication, options.application);
} else {
getFunction = resin.models.device.getAll;
}
return getFunction(function(error, devices) {
if (error != null) {
return done(error);
}
console.log(visuals.widgets.table.horizontal(devices, ['id', 'name', 'device_type', 'is_online', 'application_name', 'status', 'last_seen']));
return done();
return done(null, devices);
});
}
};
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 +63,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 +86,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);
}
@ -106,32 +120,91 @@
}
};
exports.await = {
signature: 'device await <name>',
description: 'await for a device to become online',
help: 'Use this command to await for a device to become online.\n\nThe process will exit when the device becomes online.\n\nNotice that there is no time limit for this command, so it might run forever.\n\nYou can configure the poll interval with the --interval option (defaults to 3000ms).\n\nExamples:\n\n $ resin device await MyDevice\n $ resin device await MyDevice --interval 1000',
options: [
{
signature: 'interval',
parameter: 'interval',
description: 'poll interval',
alias: 'i'
}
],
permission: 'user',
action: function(params, options, done) {
var poll;
if (options.interval == null) {
options.interval = 3000;
}
poll = function() {
return resin.models.device.isOnline(params.name, function(error, isOnline) {
if (error != null) {
return done(error);
}
if (isOnline) {
console.info("Device became online: " + params.name);
return done();
} else {
console.info("Polling device network status: " + params.name);
return setTimeout(poll, options.interval);
}
});
};
return poll();
}
};
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 MyApp\n $ resin device init --application MyApp --network ethernet\n $ resin device init /dev/disk2 --application MyApp --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.getApplicationName(process.cwd(), callback);
}, function(applicationName, callback) {
params.name = applicationName;
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();
}
options.yes = confirmed;
return osAction.download.action(params, options, callback);
}, function(outputFile, callback) {
params.image = outputFile;
return osAction.install.action(params, options, callback);
return tmp.file({
prefix: 'resin-image-',
postfix: '.img'
}, callback);
}, function(tmpPath, tmpFd, cleanupCallback, callback) {
options.output = tmpPath;
return osAction.download.action(params, options, function(error, outputFile) {
if (error != null) {
return callback(error);
}
return callback(null, outputFile, cleanupCallback);
});
}, function(outputFile, cleanupCallback, callback) {
return capitano.run("os install " + outputFile + " " + params.device, function(error) {
if (error != null) {
return callback(error);
}
cleanupCallback();
return callback();
});
}
], done);
}

View File

@ -1,5 +1,7 @@
(function() {
var _, async, examplesData, fs, gitCli, path, resin, visuals;
var _, async, examplesData, fs, mkdirp, path, resin, vcs, visuals;
mkdirp = require('mkdirp');
async = require('async');
@ -9,12 +11,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 +66,21 @@
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, destination, 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);
currentDirectory = process.cwd();
destination = path.join(currentDirectory, example.name);
return mkdirp(destination, function(error) {
if (error != null) {
return done(error);
}
], done);
console.info("Cloning " + example.display_name + " to " + destination);
vcs.clone(example.repository, destination, done);
return done();
});
}
};

View File

@ -6,10 +6,10 @@
exports.version = {
signature: 'version',
description: 'output the version number',
help: 'Display the Resin CLI, as well as the bundled NodeJS version.',
action: function() {
console.log(packageJSON.name + ": " + packageJSON.version);
return console.log("node: " + process.version);
help: 'Display the Resin CLI version.',
action: function(params, options, done) {
console.log(packageJSON.version);
return done();
}
};

View File

@ -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();
});

View File

@ -10,7 +10,7 @@
exports.logs = {
signature: 'logs <uuid>',
description: 'show device logs',
help: 'Use this command to show logs for a specific device.\n\nBy default, the command prints all log messages and exit.\n\nTo limit the output to the n last lines, use the `--num` option along with a number.\nThis is similar to doing `resin logs <uuid> | tail -n X`.\n\nTo continuously stream output, and see new logs in real time, use the `--tail` option.\n\nNote that for now you need to provide the whole UUID for this command to work correctly,\nand the tool won\'t notice if you\'re using an invalid UUID.\n\nThis is due to some technical limitations that we plan to address soon.\n\nExamples:\n\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail',
help: 'Use this command to show logs for a specific device.\n\nBy default, the command prints all log messages and exit.\n\nTo limit the output to the n last lines, use the `--num` option along with a number.\nThis is similar to doing `resin logs <uuid> | tail -n X`.\n\nTo continuously stream output, and see new logs in real time, use the `--tail` option.\n\nNote that for now you need to provide the whole UUID for this command to work correctly.\n\nThis is due to some technical limitations that we plan to address soon.\n\nExamples:\n\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail',
options: [
{
signature: 'num',
@ -35,10 +35,10 @@
}
if (_.isArray(message)) {
_.each(message, function(line) {
return console.log(line);
return console.log(line.message);
});
} else {
console.log(message);
console.log(message.message);
}
return done();
});

View File

@ -1,5 +1,7 @@
(function() {
var async, resin;
var _, async, resin;
_ = require('lodash');
async = require('async');
@ -8,18 +10,21 @@
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'
}
],
permission: 'user',
action: function(params, options, done) {
if (_.isEmpty(params.note)) {
return done(new Error('Missing note content'));
}
return resin.models.device.note(options.device, params.note, done);
}
};

View File

@ -1,10 +1,10 @@
(function() {
var _, async, commandOptions, diskio, fs, mkdirp, os, path, progressStream, resin, visuals;
var _, async, capitano, commandOptions, elevate, image, mkdirp, os, packageJSON, path, resin, selfupdate, visuals;
capitano = require('capitano');
_ = require('lodash-contrib');
fs = require('fs');
os = require('os');
async = require('async');
@ -15,56 +15,81 @@
resin = require('resin-sdk');
image = require('resin-image');
visuals = require('resin-cli-visuals');
progressStream = require('progress-stream');
diskio = require('diskio');
selfupdate = require('selfupdate');
commandOptions = require('./command-options');
packageJSON = require('../../package.json');
elevate = require('../elevate');
exports.download = {
signature: 'os download <id>',
signature: 'os download <name>',
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 MyApp --output ~/MyResinOS.zip\n $ resin os download MyApp --network ethernet --output ~/MyResinOS.zip\n $ resin os download MyApp --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip\n $ resin os download MyApp --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;
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) {
return mkdirp(path.dirname(options.output), _.unary(callback));
}, function(callback) {
var bar;
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);
});
}
], function(error) {
return resin.models.application.get(params.name, function(error, application) {
var osParams;
if (error != null) {
return done(error);
}
console.info("\nFinished downloading " + options.output);
return done(null, options.output);
osParams = {
network: options.network,
wifiSsid: options.ssid,
wifiKey: options.key,
appId: application.id
};
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, spinner;
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)');
return resin.models.os.download(osParams, options.output, function(error) {
spinner.stop();
return callback(error);
}, function(state) {
if (state != null) {
return bar.update(state);
} else {
return spinner.start();
}
});
}
], function(error) {
if (error != null) {
return done(error);
}
console.info("\nFinished downloading " + options.output);
return done(null, options.output);
});
});
}
};
@ -72,12 +97,20 @@
exports.install = {
signature: 'os install <image> [device]',
description: 'write an operating system image to a device',
help: 'Use this command to write an operating system image to a device.\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\nSee the `drives` command to get a list of all connected devices to your machine and their respective ids.\n\nIn Mac OS X:\n\n $ sudo diskutil unmountDisk /dev/xxx\n\nIn GNU/Linux:\n\n $ sudo umount /dev/xxx\n\nExamples:\n\n $ resin os install rpi.iso /dev/disk2',
help: 'Use this command to write an operating system image to a device.\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\nExamples:\n\n $ resin os install rpi.iso /dev/disk2',
options: [commandOptions.yes],
permission: 'user',
action: function(params, options, done) {
return async.waterfall([
function(callback) {
return selfupdate.isUpdated(packageJSON, 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 capitano.run('update', _.unary(callback));
}, function(callback) {
if (params.device != null) {
return callback(null, params.device);
}
@ -96,37 +129,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 image.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);
}

View File

@ -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);
}
};

View File

@ -1,11 +1,7 @@
(function() {
var _, async, npm, packageJSON;
var packageJSON, selfupdate;
async = require('async');
_ = require('lodash-contrib');
npm = require('npm');
selfupdate = require('selfupdate');
packageJSON = require('../../package.json');
@ -14,27 +10,13 @@
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 selfupdate.update(packageJSON, function(error, version) {
if (error != null) {
return done(error);
}
], done);
console.info("Updated " + packageJSON.name + " to version " + version + ".");
return done();
});
}
};

View File

@ -49,6 +49,13 @@
alias: 'j'
});
capitano.globalOption({
signature: 'version',
description: actions.info.version.description,
boolean: true,
alias: 'v'
});
capitano.globalOption({
signature: 'no-color',
description: 'disable colour highlighting',
@ -77,6 +84,8 @@
capitano.command(actions.app.restart);
capitano.command(actions.app.associate);
capitano.command(actions.app.init);
capitano.command(actions.device.list);
@ -93,6 +102,8 @@
capitano.command(actions.device.identify);
capitano.command(actions.device.await);
capitano.command(actions.drive.list);
capitano.command(actions.notes.set);
@ -150,10 +161,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);
@ -163,7 +170,11 @@
if (cli.global.project != null) {
changeProjectDirectory(cli.global.project);
}
return capitano.execute(cli, callback);
if (cli.global.version) {
return actions.info.version.action(null, null, callback);
} else {
return capitano.execute(cli, callback);
}
}
], errors.handle);

25
build/elevate.js Normal file
View 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);

View File

@ -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);
}

View File

@ -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
View 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"
]
}
]
}

View File

@ -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

View File

@ -1,7 +0,0 @@
# app <id>
Use this command to show detailed information for a single application.
Examples:
$ resin app 91

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +0,0 @@
# logout
Use this command to logout from your resin.io account.o
Examples:
$ resin logout

View File

@ -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

View File

@ -1,7 +0,0 @@
# whoami
Use this command to find out the current logged in username.
Examples:
$ resin whoami

788
doc/cli.markdown Normal file
View File

@ -0,0 +1,788 @@
# 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 &#60;name&#62;](#/pages/using/cli.md#app-create-60-name-62-)
- [apps](#/pages/using/cli.md#apps)
- [app &#60;name&#62;](#/pages/using/cli.md#app-60-name-62-)
- [app restart &#60;name&#62;](#/pages/using/cli.md#app-restart-60-name-62-)
- [app rm &#60;name&#62;](#/pages/using/cli.md#app-rm-60-name-62-)
- [app associate &#60;name&#62;](#/pages/using/cli.md#app-associate-60-name-62-)
- [init](#/pages/using/cli.md#init)
- Authentication
- [login [token]](#/pages/using/cli.md#login-token-)
- [logout](#/pages/using/cli.md#logout)
- [signup](#/pages/using/cli.md#signup)
- [whoami](#/pages/using/cli.md#whoami)
- Device
- [devices](#/pages/using/cli.md#devices)
- [device &#60;name&#62;](#/pages/using/cli.md#device-60-name-62-)
- [device rm &#60;name&#62;](#/pages/using/cli.md#device-rm-60-name-62-)
- [device identify &#60;uuid&#62;](#/pages/using/cli.md#device-identify-60-uuid-62-)
- [device rename &#60;name&#62; [newName]](#/pages/using/cli.md#device-rename-60-name-62-newname-)
- [devices supported](#/pages/using/cli.md#devices-supported)
- [device await &#60;name&#62;](#/pages/using/cli.md#device-await-60-name-62-)
- [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 &#60;id&#62;](#/pages/using/cli.md#env-rm-60-id-62-)
- [env add &#60;key&#62; [value]](#/pages/using/cli.md#env-add-60-key-62-value-)
- [env rename &#60;id&#62; &#60;value&#62;](#/pages/using/cli.md#env-rename-60-id-62-60-value-62-)
- Examples
- [examples](#/pages/using/cli.md#examples)
- [example &#60;id&#62;](#/pages/using/cli.md#example-60-id-62-)
- [example clone &#60;id&#62;](#/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 &#60;id&#62;](#/pages/using/cli.md#key-60-id-62-)
- [key rm &#60;id&#62;](#/pages/using/cli.md#key-rm-60-id-62-)
- [key add &#60;name&#62; [path]](#/pages/using/cli.md#key-add-60-name-62-path-)
- Logs
- [logs &#60;uuid&#62;](#/pages/using/cli.md#logs-60-uuid-62-)
- Notes
- [note &#60;|note&#62;](#/pages/using/cli.md#note-60-note-62-)
- OS
- [os download &#60;name&#62;](#/pages/using/cli.md#os-download-60-name-62-)
- [os install &#60;image&#62; [device]](#/pages/using/cli.md#os-install-60-image-62-device-)
- Plugin
- [plugins](#/pages/using/cli.md#plugins)
- [plugin install &#60;name&#62;](#/pages/using/cli.md#plugin-install-60-name-62-)
- [plugin update &#60;name&#62;](#/pages/using/cli.md#plugin-update-60-name-62-)
- [plugin rm &#60;name&#62;](#/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 &#60;name&#62;
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 &#60;type&#62;
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 &#60;name&#62;
Use this command to show detailed information for a single application.
Examples:
$ resin app MyApp
## app restart &#60;name&#62;
Use this command to restart all devices that belongs to a certain application.
Examples:
$ resin app restart MyApp
## app rm &#60;name&#62;
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 &#60;name&#62;
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
## 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://dashboard.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 &#60;email&#62;
user email
#### --username, -u &#60;username&#62;
user name
#### --password, -p &#60;user password&#62;
user password
## whoami
Use this command to find out the current logged in username.
Examples:
$ resin whoami
# Device
## devices
Use this command to list all devices that belong to you.
You can filter the devices by application by using the `--application` option.
Examples:
$ resin devices
$ resin devices --application MyApp
$ resin devices --app MyApp
$ resin devices -a MyApp
### Options
#### --application, --a,app, --a,app &#60;application&#62;
application name
## device &#60;name&#62;
Use this command to show information about a single device.
Examples:
$ resin device MyDevice
## device rm &#60;name&#62;
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 &#60;uuid&#62;
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 &#60;name&#62; [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 await &#60;name&#62;
Use this command to await for a device to become online.
The process will exit when the device becomes online.
Notice that there is no time limit for this command, so it might run forever.
You can configure the poll interval with the --interval option (defaults to 3000ms).
Examples:
$ resin device await MyDevice
$ resin device await MyDevice --interval 1000
### Options
#### --interval, -i &#60;interval&#62;
poll interval
## 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 MyApp
$ resin device init --application MyApp --network ethernet
$ resin device init /dev/disk2 --application MyApp --network wifi --ssid MyNetwork --key secret
### Options
#### --application, --a,app, --a,app &#60;application&#62;
application name
#### --network, -n &#60;network&#62;
network type
#### --ssid, -s &#60;ssid&#62;
wifi ssid, if network is wifi
#### --key, -k &#60;key&#62;
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 &#60;application&#62;
application name
#### --verbose, -v
show private environment variables
## env rm &#60;id&#62;
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 &#60;key&#62; [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 &#60;application&#62;
application name
## env rename &#60;id&#62; &#60;value&#62;
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 &#60;id&#62;
Use this command to show information of a single example application
Example:
$ resin example 3
## example clone &#60;id&#62;
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 &#60;id&#62;
Use this command to show information about a single SSH key.
Examples:
$ resin key 17
## key rm &#60;id&#62;
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 &#60;name&#62; [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 &#60;uuid&#62;
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.
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 &#60;num&#62;
number of lines to display
#### --tail, -t
continuously stream output
# Notes
## note &#60;|note&#62;
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 &#60;device&#62;
device name
# OS
## os download &#60;name&#62;
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 MyApp --output ~/MyResinOS.zip
$ resin os download MyApp --network ethernet --output ~/MyResinOS.zip
$ resin os download MyApp --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip
$ resin os download MyApp --network ethernet --output ~/MyResinOS.zip
### Options
#### --network, -n &#60;network&#62;
network type
#### --ssid, -s &#60;ssid&#62;
wifi ssid, if network is wifi
#### --key, -k &#60;key&#62;
wifi key, if network is wifi
#### --output, -o &#60;output&#62;
output file
## os install &#60;image&#62; [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.
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 &#60;name&#62;
Use this command to install a resin plugin
Use `--quiet` to prevent information logging.
Examples:
$ resin plugin install hello
## plugin update &#60;name&#62;
Use this command to update a resin plugin
Use `--quiet` to prevent information logging.
Examples:
$ resin plugin update hello
## plugin rm &#60;name&#62;
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

View File

@ -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

View File

@ -1,7 +0,0 @@
# device <id>
Use this command to show information about a single device.
Examples:
$ resin device 317

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +0,0 @@
# devices supported
Use this command to get the list of all supported devices
Examples:
$ resin devices supported

View File

@ -1,7 +0,0 @@
# drives
Use this command to list all drives that are connected to your machine.
Examples:
$ resin drives

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +0,0 @@
# example <id>
Use this command to show information of a single example application
Example:
$ resin example 3

View File

@ -1,7 +0,0 @@
# examples
Use this command to list available example applications from resin.io
Example:
$ resin examples

View File

@ -1,8 +0,0 @@
# help [command...]
Get detailed help for an specific command.
Examples:
$ resin help apps
$ resin help os download

View File

@ -1,3 +0,0 @@
# version
Display the Resin CLI, as well as the bundled NodeJS version.

View File

@ -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

View File

@ -1,7 +0,0 @@
# key <id>
Use this command to show information about a single SSH key.
Examples:
$ resin key 17

View File

@ -1,7 +0,0 @@
# keys
Use this command to list all your SSH keys.
Examples:
$ resin keys

View File

@ -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

View File

@ -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

View File

@ -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

View 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

View File

@ -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

View File

@ -1,7 +0,0 @@
# plugins
Use this command to list all the installed resin plugins.
Examples:
$ resin plugins

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View 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))

View 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

View File

@ -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)

View File

@ -54,6 +54,6 @@ gulp.task 'build', [
'man'
]
gulp.task 'watch', [ 'test', 'lint' ], ->
gulp.task 'watch', [ 'test', 'lint', 'coffee' ], ->
gulp.watch([ OPTIONS.files.coffee, OPTIONS.files.json ], [ 'coffee' ])
gulp.watch([ OPTIONS.files.man ], [ 'man' ])

View File

@ -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>'
@ -35,6 +37,12 @@ exports.create =
async.waterfall([
(callback) ->
resin.models.application.has(params.name, callback)
(hasApplication, callback) ->
if hasApplication
return callback(new Error('You already have an application with that name!'))
return callback(null, options.type) if options.type?
resin.models.device.getSupportedDeviceTypes (error, deviceTypes) ->
@ -53,7 +61,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 +81,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 +104,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 +128,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 +158,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)

View File

@ -1,62 +1,55 @@
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'
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.
TOKEN_URL = url.resolve(settings.get('remoteUrl'), '/preferences')
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.
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 --username <username> --password <password>
$ resin login
'''
options: [
{
signature: 'username'
parameter: 'username'
description: 'user name'
alias: 'u'
}
{
signature: 'password'
parameter: 'password'
description: 'user password'
alias: 'p'
}
]
$ resin login "eyJ0eXAiOiJKV1Qi..."
"""
action: (params, options, done) ->
hasOptionCredentials = not _.isEmpty(options)
if hasOptionCredentials
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)
return callback(null, params.token) if params.token?
(credentials, callback) ->
resin.auth.login(credentials, callback)
console.info """
To login to the Resin CLI, you need your unique token, which is accesible from
the preferences page at #{TOKEN_URL}
], done
Attempting to open a browser at that location...
"""
open TOKEN_URL, (error) ->
if error?
console.error """
Unable to open a web browser in the current environment.
Please visit #{TOKEN_URL} manually.
"""
visuals.widgets.ask('What\'s your token? (visible in the preferences page)', null, callback)
(token, callback) ->
resin.auth.loginWithToken(token, done)
], done)
exports.logout =
signature: 'logout'
@ -155,8 +148,10 @@ exports.whoami =
permission: 'user'
action: (params, options, done) ->
resin.auth.whoami (error, username) ->
return done(error) if error?
if not username?
return done(new Error('Username not found'))
console.log(username)
return done()

View File

@ -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'

View File

@ -1,8 +1,15 @@
capitano = require('capitano')
_ = require('lodash-contrib')
path = require('path')
async = require('async')
resin = require('resin-sdk')
visuals = require('resin-cli-visuals')
vcs = require('resin-vcs')
tmp = require('tmp')
# Cleanup the temporary files even when an uncaught exception occurs
tmp.setGracefulCleanup()
commandOptions = require('./command-options')
osAction = require('./os')
@ -10,16 +17,27 @@ exports.list =
signature: 'devices'
description: 'list all devices'
help: '''
Use this command to list all devices that belong to a certain application.
Use this command to list all devices that belong to you.
You can filter the devices by application by using the `--application` option.
Examples:
$ resin devices --application 91
$ resin devices
$ resin devices --application MyApp
$ resin devices --app MyApp
$ resin devices -a MyApp
'''
options: [ commandOptions.application ]
options: [ commandOptions.optionalApplication ]
permission: 'user'
action: (params, options, done) ->
resin.models.device.getAllByApplication options.application, (error, devices) ->
if options.application?
getFunction = _.partial(resin.models.device.getAllByApplication, options.application)
else
getFunction = resin.models.device.getAll
getFunction (error, devices) ->
return done(error) if error?
console.log visuals.widgets.table.horizontal devices, [
'id'
@ -31,21 +49,21 @@ exports.list =
'last_seen'
]
return done()
return done(null, devices)
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 +84,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 +94,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 +121,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 +130,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
@ -146,6 +164,46 @@ exports.supported =
_.each(devices, _.unary(console.log))
done()
exports.await =
signature: 'device await <name>'
description: 'await for a device to become online'
help: '''
Use this command to await for a device to become online.
The process will exit when the device becomes online.
Notice that there is no time limit for this command, so it might run forever.
You can configure the poll interval with the --interval option (defaults to 3000ms).
Examples:
$ resin device await MyDevice
$ resin device await MyDevice --interval 1000
'''
options: [
signature: 'interval'
parameter: 'interval'
description: 'poll interval'
alias: 'i'
]
permission: 'user'
action: (params, options, done) ->
options.interval ?= 3000
poll = ->
resin.models.device.isOnline params.name, (error, isOnline) ->
return done(error) if error?
if isOnline
console.info("Device became online: #{params.name}")
return done()
else
console.info("Polling device network status: #{params.name}")
setTimeout(poll, options.interval)
poll()
exports.init =
signature: 'device init [device]'
description: 'initialise a device with resin os'
@ -172,13 +230,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 --application 91 --network ethernet
$ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret
$ resin device init
$ resin device init --application MyApp
$ resin device init --application MyApp --network ethernet
$ resin device init /dev/disk2 --application MyApp --network wifi --ssid MyNetwork --key secret
'''
options: [
commandOptions.application
commandOptions.optionalApplication
commandOptions.network
commandOptions.wifiSsid
commandOptions.wifiKey
@ -186,25 +248,45 @@ exports.init =
permission: 'user'
action: (params, options, done) ->
params.id = options.application
async.waterfall([
(callback) ->
return callback(null, options.application) if options.application?
vcs.getApplicationName(process.cwd(), callback)
(applicationName, callback) ->
params.name = applicationName
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
options.yes = confirmed
osAction.download.action(params, options, callback)
(outputFile, callback) ->
params.image = outputFile
osAction.install.action(params, options, callback)
tmp.file
prefix: 'resin-image-'
postfix: '.img'
, callback
(tmpPath, tmpFd, cleanupCallback, callback) ->
options.output = tmpPath
# TODO: Figure out how to make use of capitano.run()
# here given the complexity of converting network
# params object to string options
osAction.download.action params, options, (error, outputFile) ->
return callback(error) if error?
return callback(null, outputFile, cleanupCallback)
(outputFile, cleanupCallback, callback) ->
capitano.run "os install #{outputFile} #{params.device}", (error) ->
return callback(error) if error?
cleanupCallback()
return callback()
], done)

View File

@ -1,10 +1,11 @@
mkdirp = require('mkdirp')
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 +86,11 @@ exports.clone =
if not example?
return done(new Error("Unknown example: #{id}"))
async.waterfall [
currentDirectory = process.cwd()
destination = path.join(currentDirectory, example.name)
(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
mkdirp destination, (error) ->
return done(error) if error?
console.info("Cloning #{example.display_name} to #{destination}")
vcs.clone(example.repository, destination, done)
return done()

View File

@ -4,8 +4,8 @@ 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}")
action: (params, options, done) ->
console.log(packageJSON.version)
return done()

View File

@ -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()

View File

@ -16,8 +16,7 @@ exports.logs =
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.
Note that for now you need to provide the whole UUID for this command to work correctly.
This is due to some technical limitations that we plan to address soon.
@ -50,7 +49,7 @@ exports.logs =
return done(error) if error?
if _.isArray(message)
_.each message, (line) ->
console.log(line)
console.log(line.message)
else
console.log(message)
console.log(message.message)
return done()

View File

@ -1,3 +1,4 @@
_ = require('lodash')
async = require('async')
resin = require('resin-sdk')
@ -9,20 +10,24 @@ 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'
]
permission: 'user'
action: (params, options, done) ->
if _.isEmpty(params.note)
return done(new Error('Missing note content'))
resin.models.device.note(options.device, params.note, done)

View File

@ -1,17 +1,19 @@
capitano = require('capitano')
_ = require('lodash-contrib')
fs = require('fs')
os = require('os')
async = require('async')
path = require('path')
mkdirp = require('mkdirp')
resin = require('resin-sdk')
image = require('resin-image')
visuals = require('resin-cli-visuals')
progressStream = require('progress-stream')
diskio = require('diskio')
selfupdate = require('selfupdate')
commandOptions = require('./command-options')
packageJSON = require('../../package.json')
elevate = require('../elevate')
exports.download =
signature: 'os download <id>'
signature: 'os download <name>'
description: 'download device OS'
help: '''
Use this command to download the device OS configured to a specific network.
@ -23,14 +25,16 @@ 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 --network ethernet --output ~/MyResinOS.zip
$ resin os download MyApp --output ~/MyResinOS.zip
$ resin os download MyApp --network ethernet --output ~/MyResinOS.zip
$ resin os download MyApp --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip
$ resin os download MyApp --network ethernet --output ~/MyResinOS.zip
'''
options: [
commandOptions.network
@ -42,38 +46,53 @@ exports.download =
parameter: 'output'
description: 'output file'
alias: 'o'
required: 'You need to specify an output file'
}
]
permission: 'user'
action: (params, options, done) ->
osParams =
network: options.network
wifiSsid: options.ssid
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) ->
# We need to ensure this directory exists
mkdirp(path.dirname(options.output), _.unary(callback))
(callback) ->
console.info("Destination file: #{options.output}\n")
bar = new visuals.widgets.Progress('Downloading Device OS')
resin.models.os.download osParams, options.output, callback, (state) ->
bar.update(state)
], (error) ->
resin.models.application.get params.name, (error, application) ->
return done(error) if error?
console.info("\nFinished downloading #{options.output}")
return done(null, options.output)
osParams =
network: options.network
wifiSsid: options.ssid
wifiKey: options.key
appId: application.id
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
mkdirp(path.dirname(options.output), _.unary(callback))
(callback) ->
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, (error) ->
spinner.stop()
return callback(error)
, (state) ->
if state?
bar.update(state)
else
spinner.start()
], (error) ->
return done(error) if error?
console.info("\nFinished downloading #{options.output}")
return done(null, options.output)
exports.install =
signature: 'os install <image> [device]'
@ -90,18 +109,6 @@ exports.install =
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
@ -109,8 +116,26 @@ exports.install =
options: [ commandOptions.yes ]
permission: 'user'
action: (params, options, done) ->
async.waterfall [
(callback) ->
selfupdate.isUpdated(packageJSON, 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...
'''
capitano.run('update', _.unary(callback))
(callback) ->
return callback(null, params.device) if params.device?
@ -130,42 +155,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)
image.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)

View File

@ -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)

View File

@ -1,6 +1,4 @@
async = require('async')
_ = require('lodash-contrib')
npm = require('npm')
selfupdate = require('selfupdate')
packageJSON = require('../../package.json')
exports.update =
@ -22,30 +20,7 @@ exports.update =
$ resin update
'''
action: (params, options, done) ->
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.update [ packageJSON.name ], (error, data) ->
return callback(error, data)
(data, callback) ->
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()
], done)
selfupdate.update packageJSON, (error, version) ->
return done(error) if error?
console.info("Updated #{packageJSON.name} to version #{version}.")
return done()

View File

@ -31,6 +31,12 @@ capitano.globalOption
description: 'project path'
alias: 'j'
capitano.globalOption
signature: 'version'
description: actions.info.version.description
boolean: true
alias: 'v'
# We don't do anything in response to this options
# explicitly. We use InquirerJS to provide CLI widgets,
# and that module understands --no-color automatically.
@ -57,6 +63,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 ----------
@ -67,6 +74,7 @@ capitano.command(actions.device.init)
capitano.command(actions.device.info)
capitano.command(actions.device.remove)
capitano.command(actions.device.identify)
capitano.command(actions.device.await)
# ---------- Drive Module ----------
capitano.command(actions.drive.list)
@ -124,10 +132,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)
@ -137,6 +141,9 @@ async.waterfall([
if cli.global.project?
changeProjectDirectory(cli.global.project)
capitano.execute(cli, callback)
if cli.global.version
actions.info.version.action(null, null, callback)
else
capitano.execute(cli, callback)
], errors.handle)

16
lib/elevate.coffee Normal file
View 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)

View File

@ -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)

View File

@ -1,4 +1,4 @@
.TH "RESIN" "1" "March 2015" "" ""
.TH "RESIN" "1" "May 2015" "" ""
.SH "NAME"
\fBresin\fR \- tab completion for resin
.SH DESCRIPTION

View File

@ -1,4 +1,4 @@
.TH "RESIN\-PLUGINS" "1" "March 2015" "" ""
.TH "RESIN\-PLUGINS" "1" "May 2015" "" ""
.SH "NAME"
\fBresin-plugins\fR \- Creating Resin CLI plugins
.SH DESCRIPTION

View File

@ -1,4 +1,4 @@
.TH "RESIN" "1" "March 2015" "" ""
.TH "RESIN" "1" "May 2015" "" ""
.SH "NAME"
\fBresin\fR \- command line tool to interact with resin\.io
.SH SYNOPSIS

View File

@ -1,6 +1,6 @@
{
"name": "resin-cli",
"version": "0.2.1",
"version": "0.10.6",
"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",
@ -48,21 +49,23 @@
},
"dependencies": {
"async": "~0.9.0",
"capitano": "~1.5.0",
"capitano": "~1.6.0",
"coffee-script": "~1.8.0",
"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",
"progress-stream": "^0.5.0",
"resin-cli-visuals": "resin-io/resin-cli-visuals",
"resin-sdk": "^0.0.1",
"resin-cli-visuals": "^0.1.0",
"resin-image": "^1.1.2",
"resin-sdk": "^1.4.3",
"resin-settings-client": "^1.0.0",
"resin-vcs": "^1.2.0",
"selfupdate": "^1.1.0",
"tmp": "^0.0.25",
"underscore.string": "~2.4.0",
"update-notifier": "^0.3.1"
}

View File

@ -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

View File

@ -1 +0,0 @@
Thanks for installing the Resin CLI. Enjoy!

View File

@ -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.

View File

@ -1,4 +0,0 @@
#!/bin/sh
# Add binary symbolic link
ln -s /opt/resin.io/cli/bin/resin /usr/bin/resin

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

Before

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@ -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

View File

@ -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