Remove 'quickstart' command and deprecate 'local push'.

Change-type: major
Signed-off-by: Paulo Castro <paulo@balena.io>
This commit is contained in:
Paulo Castro 2019-04-02 18:01:28 +01:00
parent 79e240f630
commit 30698c62e3
14 changed files with 84 additions and 130 deletions

View File

@ -152,10 +152,6 @@ environment variable (in the same standard URL format).\
title: 'Settings',
files: ['build/actions/settings.js'],
},
{
title: 'Wizard',
files: ['build/actions/wizard.js'],
},
{
title: 'Local',
files: ['build/actions/local/index.js'],

View File

@ -188,10 +188,6 @@ environment variable (in the same standard URL format).
- [settings](#settings)
- Wizard
- [quickstart [name]](#quickstart-name)
- Local
- [local configure &#60;target&#62;](#local-configure-target)
@ -880,6 +876,12 @@ continuously stream output
## sync [uuid]
-------------------------------------------------------------------------
Deprecation notice: please note that `balena sync` is deprecated and will
be removed in a future release of the CLI. We are working on an exciting
"live push" alternative: https://github.com/balena-io-modules/livepush
-------------------------------------------------------------------------
Warning: 'balena sync' requires an openssh-compatible client and 'rsync' to
be correctly installed in your shell environment. For more information (including
Windows support) please check the README here: https://github.com/balena-io/balena-cli
@ -1098,7 +1100,7 @@ Note that device api keys are only supported on balenaOS 2.0.3+.
This command still supports the *deprecated* format where the UUID and optionally device key
are passed directly on the command line, but the recommended way is to pass either an --app or
--device argument. The deprecated format will be remove in a future release.
--device argument. The deprecated format will be removed in a future release.
In case that you want to configure an image for an application with mixed device types,
you can pass the --device-type argument along with --app to specify the target device type.
@ -1453,24 +1455,6 @@ Examples:
$ balena settings
# Wizard
## quickstart [name]
Use this command to run a friendly wizard to get started with balena.
The wizard will guide you through:
- Create an application.
- Initialise an SDCard with the balena operating system.
- Associate an existing project directory with your balena application.
- Push your project to your devices.
Examples:
$ balena quickstart
$ balena quickstart MyApp
# Local
## local configure &#60;target&#62;
@ -1583,11 +1567,18 @@ ssh port number (default: 22222)
## local push [deviceIp]
Warning: 'balena local push' requires an openssh-compatible client and 'rsync' to
be correctly installed in your shell environment. For more information (including
Windows support) please check the README here: https://github.com/balena-io/balena-cli
------------------------------------------------------------------------------
Deprecation notice: `balena local push` is deprecated and will be removed in a
future release of the CLI. Please use `balena push <ipAddress>` instead.
------------------------------------------------------------------------------
Use this command to push your local changes to a container on a LAN-accessible balenaOS device on the fly.
Use this command to push your local changes to a container on a LAN-accessible
balenaOS device on the fly.
This command requires an openssh-compatible 'ssh' client and 'rsync' to be
available in the executable PATH of the shell environment. For more information
(including Windows support) please check the README at:
https://github.com/balena-io/balena-cli
If `Dockerfile` or any file in the 'build-triggers' list is changed,
a new container will be built and run on your device.

View File

@ -21,7 +21,7 @@ messages = require('../utils/messages')
{ exitWithExpectedError } = require('../utils/patterns')
parse = (object) ->
return _.fromPairs _.map object, (item) ->
return _.fromPairs _.map(object, (item) ->
# Hacky way to determine if an object is
# a function or a command
@ -33,7 +33,7 @@ parse = (object) ->
return [
signature
item.description
]
]).sort()
indent = (text) ->
text = _.map text.split('\n'), (line) ->

View File

@ -15,7 +15,6 @@ limitations under the License.
###
module.exports =
wizard: require('./wizard')
apiKey: require('./api-key')
app: require('./app')
auth: require('./auth')

View File

@ -21,16 +21,27 @@ limitations under the License.
_ = require('lodash')
balenaPush = require('balena-sync').capitano('balena-toolbox')
originalAction = balenaPush.action
# TODO: This is a temporary workaround to reuse the existing `rdt push`
# capitano frontend in `balena local push`.
balenaPushHelp = '''
Warning: 'balena local push' requires an openssh-compatible client and 'rsync' to
be correctly installed in your shell environment. For more information (including
Windows support) please check the README here: https://github.com/balena-io/balena-cli
deprecationMsg = '''
------------------------------------------------------------------------------
Deprecation notice: `balena local push` is deprecated and will be removed in a
future release of the CLI. Please use `balena push <ipAddress>` instead.
------------------------------------------------------------------------------
Use this command to push your local changes to a container on a LAN-accessible balenaOS device on the fly.
'''
balenaPushHelp = """#{deprecationMsg}
Use this command to push your local changes to a container on a LAN-accessible
balenaOS device on the fly.
This command requires an openssh-compatible 'ssh' client and 'rsync' to be
available in the executable PATH of the shell environment. For more information
(including Windows support) please check the README at:
https://github.com/balena-io/balena-cli
If `Dockerfile` or any file in the 'build-triggers' list is changed,
a new container will be built and run on your device.
@ -68,11 +79,16 @@ balenaPushHelp = '''
$ balena local push --verbose false
$ balena local push 192.168.2.10 --source . --destination /usr/src/app
$ balena local push 192.168.2.10 -s /home/user/balenaProject -d /usr/src/app --before 'echo Hello' --after 'echo Done'
'''
"""
module.exports = _.assign balenaPush,
signature: 'local push [deviceIp]'
description: '[deprecated: use "balena push ipAddress"] ' + balenaPush.description
help: balenaPushHelp
primary: true
primary: false
root: true
action: (params, options, done) ->
console.log deprecationMsg
originalAction(params, options, done)

View File

@ -217,7 +217,7 @@ exports.configure =
This command still supports the *deprecated* format where the UUID and optionally device key
are passed directly on the command line, but the recommended way is to pass either an --app or
--device argument. The deprecated format will be remove in a future release.
--device argument. The deprecated format will be removed in a future release.
In case that you want to configure an image for an application with mixed device types,
you can pass the --device-type argument along with --app to specify the target device type.

View File

@ -132,7 +132,7 @@ offerToDisableAutomaticUpdates = (application, commit, pinDevice) ->
module.exports =
signature: 'preload <image>'
description: '(beta) preload an app on a disk image (or Edison zip archive)'
description: 'preload an app on a disk image (or Edison zip archive)'
help: '''
Warning: "balena preload" requires Docker to be correctly installed in
your shell environment. For more information (including Windows support)

View File

@ -110,6 +110,7 @@ export const push: CommandDefinition<
}
> = {
signature: 'push <applicationOrDevice>',
primary: true,
description:
'Start a remote build on the balena cloud build servers or a local mode device',
help: stripIndent`

View File

@ -19,7 +19,7 @@ commandOptions = require('./command-options')
module.exports =
signature: 'ssh [uuid]'
description: '(beta) get a shell into the running app container of a device'
description: 'get a shell into the running app container of a device'
help: '''
Warning: 'balena ssh' requires an openssh-compatible client to be correctly
installed in your shell environment. For more information (including Windows

View File

@ -1,5 +1,5 @@
/*
Copyright 2016-2017 Balena
Copyright 2016-2019 Balena
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -15,4 +15,30 @@ limitations under the License.
*/
import * as BalenaSync from 'balena-sync';
export = BalenaSync.capitano('balena-cli');
import { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
export = deprecateSyncCmd(BalenaSync.capitano('balena-cli'));
const deprecationMsg = stripIndent`\
-------------------------------------------------------------------------
Deprecation notice: please note that \`balena sync\` is deprecated and will
be removed in a future release of the CLI. We are working on an exciting
"live push" alternative: https://github.com/balena-io-modules/livepush
-------------------------------------------------------------------------
`;
function deprecateSyncCmd(syncCmd: CommandDefinition): CommandDefinition {
syncCmd.primary = false;
syncCmd.description = syncCmd.description.replace(
'(beta)',
'[deprecated: see "help sync"]',
);
syncCmd.help = deprecationMsg + '\n\n' + syncCmd.help;
const originalAction = syncCmd.action;
syncCmd.action = (params, options, done): void => {
console.log(deprecationMsg);
originalAction(params, options, done);
};
return syncCmd;
}

View File

@ -1,74 +0,0 @@
###
Copyright 2016-2017 Balena
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
###
exports.wizard =
signature: 'quickstart [name]'
description: 'getting started with balena'
help: '''
Use this command to run a friendly wizard to get started with balena.
The wizard will guide you through:
- Create an application.
- Initialise an SDCard with the balena operating system.
- Associate an existing project directory with your balena application.
- Push your project to your devices.
Examples:
$ balena quickstart
$ balena quickstart MyApp
'''
primary: true
action: (params, options, done) ->
balena = require('balena-sdk').fromSharedOptions()
patterns = require('../utils/patterns')
{ runCommand } = require('../utils/helpers')
balena.auth.isLoggedIn().then (isLoggedIn) ->
return if isLoggedIn
console.info('Looks like you\'re not logged in yet!')
console.info("Let's go through a quick wizard to get you started.\n")
return runCommand('login')
.then ->
return if params.name?
patterns.selectOrCreateApplication().tap (applicationName) ->
balena.models.application.has(applicationName).then (hasApplication) ->
return applicationName if hasApplication
runCommand("app create #{applicationName}")
.then (applicationName) ->
params.name = applicationName
.then ->
return runCommand("device init --application #{params.name}")
.tap(patterns.awaitDevice)
.then (uuid) ->
return runCommand("device #{uuid}")
.then ->
return balena.models.application.get(params.name)
.then (application) ->
console.log """
Your device is ready to start pushing some code!
Check our official documentation for more information:
http://balena.io/docs/#/pages/introduction/introduction.md
Clone an example or go to an existing application directory and run:
$ git remote add balena #{application.git_repository}
$ git push balena master
"""
.nodeify(done)

View File

@ -103,9 +103,6 @@ capitano.command(actions.info.version)
# ---------- Help Module ----------
capitano.command(actions.help.help)
# ---------- Wizard Module ----------
capitano.command(actions.wizard.wizard)
# ---------- Api key module ----------
capitano.command(actions.apiKey.generate)

View File

@ -1,10 +1,11 @@
const DEBUG_MODE = !!process.env.DEBUG;
export const reachingOut = `\
If you need help, or just want to say hi, don't hesitate in reaching out at:
If you need help, or just want to say hi, don't hesitate in reaching out
through our discussion and support forums at https://forums.balena.io
Forums: https://forums.balena.io
GitHub: https://github.com/balena-io/balena-cli/issues/new\
For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/\
`;
const debugHint = `\
@ -13,10 +14,11 @@ line with DEBUG=1, i.e.: DEBUG=1 balena ...
`;
export const getHelp = `${DEBUG_MODE ? '' : debugHint}\
If you need help, don't hesitate in contacting us at:
If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io
Forums: https://forums.balena.io
GitHub: https://github.com/balena-io/balena-cli/issues/new\
For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/\
`;
export const balenaAsciiArt = `\

View File

@ -113,7 +113,7 @@
"balena-preload": "^8.0.4",
"balena-sdk": "^11.2.0",
"balena-settings-client": "^4.0.0",
"balena-sync": "^10.0.2",
"balena-sync": "^10.0.3",
"bash": "0.0.1",
"bluebird": "^3.5.3",
"body-parser": "^1.14.1",