云引擎命令行工具使用指南
命令行工具是用来管理和部署云引擎项目的工具。它不仅可以部署、发布和回滚云引擎代码,对同一个云引擎项目做多应用管理,还能查看云引擎日志,批量将文件上传到云端。
安装命令行工具
macOS
目前 tds 暂未发布到 Homebrew,macOS 用户请先到 GitHub releases 页面 下载二进制文件 tds-macos-x64,赋予可执行权限(chmod a+x tds-macos-x64),重命名为 tds 并放到已经在 PATH 环境变量中声明的任意目录中即可。
Windows
Windows 用户可以在 GitHub releases 页面根据操作系统版本下载最新的 32 位 或 64 位 msi 安装包进行安装,安装成功之后在 Windows 命令提示符(或 PowerShell)下直接输入 tds 命令即可使用。
也可以选择编译好的绿色版 exe 文件,下载后将此文件更名为 tds.exe,并将其路径加入到系统 PATH 环境变量(设置方法)中去。这样使用时在 Windows 命令提示符(或 PowerShell)下,在任意目录下输入 tds 就可以使用命令行工具了。当然也可以将此文件直接放到已经在 PATH 环境变量中声明的任意目录中去,比如 C:\Windows\System32 中。
Linux
基于 Debian 的发行版可以从 GitHub releases 页面 下载 deb 包安装。
其他发行版可以从 GitHub releases 页面 下载预编译好的二进制文件 tds-linux-x64,赋予可执行权限(chmod a+x tds-linux-x64),重命名为 tds 并放到已经在 PATH 环境变量中声明的任意目录中即可。
通过源码安装
请参考项目源码 README。
升级
下载最新的文件,重新执行一遍安装流程,即可把旧版本的命令行工具覆盖,升级到最新版。
使用
安装成功之后,直接在 terminal 终端运行 tds help,输出帮助信息:
NAME:
tds - Command line to manage and deploy LeanCloud apps
USAGE:
tds [global options] command [command options] [arguments...]
VERSION:
0.25.0
COMMANDS:
login Log in to LeanCloud
switch Change the associated LeanCloud app
metric Obtain LeanStorage performance metrics of current project
info Show information about the current user and app
up Start a development instance locally
init Initialize a LeanEngine project
deploy Deploy the project to LeanEngine
publish Publish code from staging to production
upload Upload files to the current application (available in the '_File' class)
logs Show LeanEngine logs
debug Start the debug console without running the project
env Output environment variables used by the current project
cache LeanCache shell
cql Start CQL interactive mode (warn: CQL is deprecated)
help, h Show all commands or help info for one command
GLOBAL OPTIONS:
--version, -v print the version
简单介绍下主要的子命令:
命令 | 用途
- | -
login| 登录 LeanCloud 账号switch| 切换关联的云引擎项目metric| 当前项目的 LeanStorage 统计信息info| 当前用户、应用up| 启动本地开发调试实例init| 初始化云引擎项目deploy| 部署项目至云引擎publish| 部署至生产环境upload| 上传文件至当前应用(可以在_File类中查看)logs| 显示云引擎日志debug| 单独运行云函数调试功能,而不在本地运行项目本身env| 显示当前项目的环境变量cache| LeanCache 命令行