2012-12-15 16:58:07 +00:00
|
|
|
bee
|
|
|
|
===
|
2013-07-27 01:44:44 +00:00
|
|
|
|
2013-10-30 23:54:53 +00:00
|
|
|
[![Build Status](https://drone.io/github.com/beego/bee/status.png)](https://drone.io/github.com/beego/bee/latest)
|
2012-12-15 16:58:07 +00:00
|
|
|
|
2014-08-29 07:06:05 +00:00
|
|
|
Bee is a command line tool facilitating development with beego framework.
|
2013-12-24 22:03:33 +00:00
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
2014-08-29 07:06:05 +00:00
|
|
|
- Go version >= 1.1.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
Begin by installing `bee` using `go get` command.
|
|
|
|
|
|
|
|
go get github.com/beego/bee
|
|
|
|
|
2014-08-29 07:17:22 +00:00
|
|
|
Then you can add `bee` binary to PATH environment variable in your `~/.bashrc` or `~/.bash_profile` file:
|
2014-08-29 07:06:05 +00:00
|
|
|
|
2014-08-29 07:17:22 +00:00
|
|
|
```bash
|
|
|
|
export PATH=$PATH:<your_main_gopath>/bin/bee
|
|
|
|
```
|
2014-08-29 07:06:05 +00:00
|
|
|
|
|
|
|
> If you already have `bee` installed, updating `bee` is simple:
|
|
|
|
|
|
|
|
go get -u github.com/beego/bee
|
|
|
|
|
|
|
|
## Basic commands
|
|
|
|
|
|
|
|
Bee provides a variety of commands which can be helpful at various stage of development. The top level commands include:
|
|
|
|
|
|
|
|
new create an application base on beego framework
|
|
|
|
run run the app which can hot compile
|
|
|
|
pack compress an beego project
|
|
|
|
api create an api application base on beego framework
|
|
|
|
bale packs non-Go files to Go source files
|
|
|
|
version show the bee & beego version
|
|
|
|
generate source code generator
|
|
|
|
migrate run database migrations
|
|
|
|
|
2014-08-29 07:32:13 +00:00
|
|
|
## bee version
|
2014-08-29 07:06:05 +00:00
|
|
|
|
2014-08-29 07:32:13 +00:00
|
|
|
The first command is the easiest: displaying which version of `bee`, `beego` and `go` is installed on your machine:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ bee version
|
|
|
|
bee :1.2.2
|
|
|
|
beego :1.4.0
|
|
|
|
Go :go version go1.2.1 linux/amd64
|
|
|
|
```
|
|
|
|
|
|
|
|
## bee new
|
|
|
|
|
|
|
|
|
|
|
|
## bee run
|
|
|
|
|
|
|
|
## bee pack
|
|
|
|
|
|
|
|
## bee api
|
|
|
|
|
|
|
|
## bee bale
|
|
|
|
|
|
|
|
## bee migrate
|
|
|
|
|
|
|
|
## bee generate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Shortcuts
|
|
|
|
|
|
|
|
Because you'll likely type these generator commands over and over, it makes sense to create aliases.
|
2014-08-29 07:06:05 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
# Generator Stuff
|
|
|
|
alias g:a="bee generate appcode"
|
|
|
|
alias g:m="bee generate model"
|
|
|
|
alias g:c="bee generate controller"
|
|
|
|
alias g:v="bee generate view"
|
2014-08-29 07:17:22 +00:00
|
|
|
alias g:mi="bee generate migration"
|
2014-08-29 07:06:05 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
These can be stored in, for example, your `~/.bash_profile` or `~/.bashrc` files.
|
2014-08-29 07:32:13 +00:00
|
|
|
|
|
|
|
## Help
|
|
|
|
|
|
|
|
If you happend to forget the usage of a command, you can always find the usage information by `bee help <command>`.
|
|
|
|
|
|
|
|
For instance, to get more information about the `run` command:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ bee help run
|
2014-08-29 07:34:07 +00:00
|
|
|
usage: bee run [appname] [watchall] [-main=*.go] [-downdoc=true] [-gendoc=true]
|
|
|
|
|
|
|
|
start the appname throw exec.Command
|
|
|
|
|
|
|
|
then start a inotify watch for current dir
|
|
|
|
|
|
|
|
when the file has changed bee will auto go build and restart the app
|
|
|
|
|
|
|
|
file changed
|
|
|
|
|
|
|
|
|
check if it's go file
|
|
|
|
|
|
|
|
|
yes no
|
|
|
|
| |
|
|
|
|
go build do nothing
|
|
|
|
|
|
|
|
|
restart app
|
|
|
|
|
2014-08-29 07:32:13 +00:00
|
|
|
```
|