上一篇,简单介绍了下Revel,这一篇我们看下 github.com/robfig/revel/cmd 这个命令行工具。
文档:http://robfig.github.com/revel/manual/tool.html
首先,编译Revel命令行工具,如下:
go build -o bin/revel github.com/robfig/revel/cmd
接着运行帮助,如下:
yourihua@ubuntu:~/workplace/rhino/bin$ revel help
~
~ revel! http://robfig.github.com/revel
~
usage: revel command [arguments]
The commands are:
run run a Revel application
new create a skeleton Revel application
clean clean a Revel application’s temp files
package package a Revel application (e.g. for deployment)
test run all tests from the command-line
Use "revel help [command]" for more information.
yourihua@ubuntu:~/workplace/rhino/bin$
从帮助可以知道关于run,new,clean等这几个简单的命令的用途,而更多详细的介绍可以使用:revel help [command]获得。
如下:
yourihua@ubuntu:~/workplace/rhino/bin$ revel help new
~
~ revel! http://robfig.github.com/revel
~
usage: revel new [path]
New creates a few files to get a new Revel application running quickly.
It puts all of the files in the given import path, taking the final element in
the path to be the app name.
For example:
revel new import/path/helloworld
yourihua@ubuntu:~/workplace/rhino/bin$ revel help clean
~
~ revel! http://robfig.github.com/revel
~
usage: revel clean [import path]
Clean the Revel web application named by the given import path.
For example:
revel clean github.com/robfig/revel/samples/chat
It removes the app/tmp directory.
yourihua@ubuntu:~/workplace/rhino/bin$ revel help package
~
~ revel! http://robfig.github.com/revel
~
usage: revel package [import path]
Package the Revel web application named by the given import path.
This allows it to be deployed and run on a machine that lacks a Go installation.
For example:
revel package github.com/robfig/revel/samples/chat
yourihua@ubuntu:~/workplace/rhino/bin$ revel help test
~
~ revel! http://robfig.github.com/revel
~
usage: revel test [import path] [run mode]
Run all tests for the Revel app named by the given import path.
For example, to run the booking sample application’s tests:
revel test github.com/robfig/revel/samples/booking dev
The run mode is used to select which set of app.conf configuration should
apply and may be used to determine logic in the application itself.
Run mode defaults to "dev".
yourihua@ubuntu:~/workplace/rhino/bin$
这个命令行工具代码较少,如下:
下一篇,我们从代码来详细了解这个工具。
有疑问加站长微信联系(非本文作者)