mirror of https://github.com/maxcnunes/gaper.git
Compare commits
3 Commits
2a09c4e713
...
9229e8d69b
Author | SHA1 | Date |
---|---|---|
|
9229e8d69b | |
|
4eb2525b49 | |
|
7f381c7e58 |
|
@ -28,7 +28,7 @@ make setup
|
||||||
### Running gaper in development
|
### Running gaper in development
|
||||||
|
|
||||||
```
|
```
|
||||||
make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server
|
make build && ./gaper --verbose --bin-name srv --build-path ./testdata/server --build-args="-ldflags=\"-X 'main.Version=v1.0.0'\""
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running lint
|
### Running lint
|
||||||
|
|
16
README.md
16
README.md
|
@ -61,7 +61,7 @@ GLOBAL OPTIONS:
|
||||||
--watch value, -w value list of folders or files to watch for changes
|
--watch value, -w value list of folders or files to watch for changes
|
||||||
--ignore value, -i value list of folders or files to ignore for changes
|
--ignore value, -i value list of folders or files to ignore for changes
|
||||||
--poll-interval value, -p value how often in milliseconds to poll watched files for changes (default: 500)
|
--poll-interval value, -p value how often in milliseconds to poll watched files for changes (default: 500)
|
||||||
--extensions value, -e value a comma-delimited list of file extensions to watch for changes (default: "go")
|
--extensions value, -e value extensions to watch for changes (default: "go")
|
||||||
--no-restart-on value, -n value don't automatically restart the supervised program if it ends:
|
--no-restart-on value, -n value don't automatically restart the supervised program if it ends:
|
||||||
if "error", an exit code of 0 will still restart.
|
if "error", an exit code of 0 will still restart.
|
||||||
if "exit", no restart regardless of exit code.
|
if "exit", no restart regardless of exit code.
|
||||||
|
@ -98,7 +98,19 @@ Using all defaults provided by Gaper:
|
||||||
gaper
|
gaper
|
||||||
```
|
```
|
||||||
|
|
||||||
Ignore watch over all test files:
|
Example providing a few custom configurations:
|
||||||
|
|
||||||
|
```
|
||||||
|
gaper \
|
||||||
|
--bin-name build/api-dev \
|
||||||
|
--build-path cmd/server \
|
||||||
|
--build-args "-ldflags=\"-X 'main.Version=dev'" \
|
||||||
|
-w 'public/**' -w '*.go' \
|
||||||
|
-e js -e css -e html \
|
||||||
|
--watch .
|
||||||
|
```
|
||||||
|
|
||||||
|
Example to ignore watching over all test files:
|
||||||
|
|
||||||
> no need for this if you have not disabled the default ignore settings `--disable-default-ignore`
|
> no need for this if you have not disabled the default ignore settings `--disable-default-ignore`
|
||||||
|
|
||||||
|
|
2
gaper.go
2
gaper.go
|
@ -59,6 +59,8 @@ func Run(cfg *Config, chOSSiginal chan os.Signal) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Debugf("Config: %+v", cfg)
|
||||||
|
|
||||||
wCfg := WatcherConfig{
|
wCfg := WatcherConfig{
|
||||||
DefaultIgnore: !cfg.DisableDefaultIgnore,
|
DefaultIgnore: !cfg.DisableDefaultIgnore,
|
||||||
PollInterval: cfg.PollInterval,
|
PollInterval: cfg.PollInterval,
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
|
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) // nolint gas
|
||||||
|
@ -16,6 +18,6 @@ func main() {
|
||||||
log.Fatal("Forced failure")
|
log.Fatal("Forced failure")
|
||||||
})
|
})
|
||||||
|
|
||||||
log.Println("Starting server")
|
log.Println("Starting server: Version", Version)
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue