1 Star 0 Fork 0

ifa6/fresh

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
Andrea Franz 提交于 2014-01-16 01:48 +08:00 . docs
/*
Fresh is a command line tool that builds and (re)starts your web application everytime you save a go or template file.
If the web framework you are using supports the Fresh runner, it will show build errors on your browser.
It currently works with Traffic (https://github.com/pilu/traffic), Martini (https://github.com/codegangsta/martini) and gocraft/web (https://github.com/gocraft/web).
Fresh will watch for file events, and every time you create/modifiy/delete a file it will build and restart the application.
If `go build` returns an error, it will logs it in the tmp folder.
Traffic (https://github.com/pilu/traffic) already has a middleware that shows the content of that file if it is present. This middleware is automatically added if you run a Traffic web app in dev mode with Fresh.
*/
package main
import (
"flag"
"fmt"
"github.com/pilu/fresh/runner"
"os"
)
func main() {
configPath := flag.String("c", "", "config file path")
flag.Parse()
if *configPath != "" {
if _, err := os.Stat(*configPath); err != nil {
fmt.Printf("Can't find config file `%s`\n", *configPath)
os.Exit(1)
} else {
os.Setenv("RUNNER_CONFIG_PATH", *configPath)
}
}
runner.Start()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ifa6/fresh.git
git@gitee.com:ifa6/fresh.git
ifa6
fresh
fresh
0fa698148017

搜索帮助