這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
上一篇,簡單介紹了下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$
這個命令列工具代碼較少,如下:
下一篇,我們從代碼來詳細瞭解這個工具。