From e9dc429cb81c65ed992c0d84eb00d2c8e2f5c913 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 25 Feb 2017 20:31:49 +0800 Subject: [PATCH] feat: embed code into markdown and keep everything in sync (#191) * feat: embed code into markdown and keep everything in sync * fix: update readme. * fix: update travis. --- .drone.yml | 2 ++ .drone.yml.sig | 2 +- .travis.yml | 4 +++- Makefile | 6 ++++++ README.md | 9 ++++----- config/config.yml | 20 +++++++++----------- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.drone.yml b/.drone.yml index c7ca7a3..7dbc746 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,9 +11,11 @@ pipeline: environment: - GOPATH=/go commands: + - make deps - make vet - make lint - make build + - make embedmd - coverage all # send coverage report - make coverage diff --git a/.drone.yml.sig b/.drone.yml.sig index 7140d11..be0cadc 100644 --- a/.drone.yml.sig +++ b/.drone.yml.sig @@ -1 +1 @@ -eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIHBhdGg6IC9nby9zcmMvZ2l0aHViLmNvbS9hcHBsZWJveS9nb3J1c2gKCnBpcGVsaW5lOgogIGNsb25lOgogICAgaW1hZ2U6IHBsdWdpbnMvZ2l0CiAgICB0YWdzOiB0cnVlCgogIGJ1aWxkOgogICAgaW1hZ2U6IGFwcGxlYm95L2dvbGFuZy10ZXN0aW5nOiR7R09fVkVSU0lPTn0KICAgIGVudmlyb25tZW50OgogICAgICAtIEdPUEFUSD0vZ28KICAgIGNvbW1hbmRzOgogICAgICAtIG1ha2UgdmV0CiAgICAgIC0gbWFrZSBsaW50CiAgICAgIC0gbWFrZSBidWlsZAogICAgICAtIGNvdmVyYWdlIGFsbAogICAgICAjIHNlbmQgY292ZXJhZ2UgcmVwb3J0CiAgICAgIC0gbWFrZSBjb3ZlcmFnZQogICAgICAjIGJ1aWxkIGJpbmFyeSBmb3IgZG9ja2VyIGltYWdlCiAgICAgIC0gbWFrZSBkb2NrZXJfYnVpbGQKCiAgcmV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RhZ3MvKiBdCiAgICAgIG1hdHJpeDoKICAgICAgICBHT19WRVJTSU9OOiAxLjguMAoKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6YWxwaW5lCgptYXRyaXg6CiAgR09fVkVSU0lPTjoKICAgIC0gMS44LjAKICAgIC0gMS43LjUKICAgIC0gMS42LjQK.iN00BApOMrBjB45OwRNmWh438xJMxFrTmzsx6Eeu-NY \ No newline at end of file +eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIHBhdGg6IC9nby9zcmMvZ2l0aHViLmNvbS9hcHBsZWJveS9nb3J1c2gKCnBpcGVsaW5lOgogIGNsb25lOgogICAgaW1hZ2U6IHBsdWdpbnMvZ2l0CiAgICB0YWdzOiB0cnVlCgogIGJ1aWxkOgogICAgaW1hZ2U6IGFwcGxlYm95L2dvbGFuZy10ZXN0aW5nOiR7R09fVkVSU0lPTn0KICAgIGVudmlyb25tZW50OgogICAgICAtIEdPUEFUSD0vZ28KICAgIGNvbW1hbmRzOgogICAgICAtIG1ha2UgZGVwcwogICAgICAtIG1ha2UgdmV0CiAgICAgIC0gbWFrZSBsaW50CiAgICAgIC0gbWFrZSBidWlsZAogICAgICAtIG1ha2UgZW1iZWRtZAogICAgICAtIGNvdmVyYWdlIGFsbAogICAgICAjIHNlbmQgY292ZXJhZ2UgcmVwb3J0CiAgICAgIC0gbWFrZSBjb3ZlcmFnZQogICAgICAjIGJ1aWxkIGJpbmFyeSBmb3IgZG9ja2VyIGltYWdlCiAgICAgIC0gbWFrZSBkb2NrZXJfYnVpbGQKCiAgcmVsZWFzZToKICAgIGltYWdlOiBhcHBsZWJveS9nb2xhbmctdGVzdGluZzoke0dPX1ZFUlNJT059CiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9ubWVudDoKICAgICAgVEFHUzogbmV0Z28KICAgIGNvbW1hbmRzOgogICAgICAtIG1ha2UgcmVsZWFzZQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgdG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0Dbu9RRm_H36d0b9_fw38tqLOU \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 800576f..8db1e73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ go: - 1.6.x - 1.7.x - 1.8.x - - tip + - master env: global: @@ -18,6 +18,8 @@ env: - secure: jbMSWnlmLHAXtI1A22aDyUvVWbXq1aRjW1EXcMyzAamBMl4c+47lrkoCnHuQaCY4kOWJ4ux7zPrnXL2j0HTqF7ZXzbw0TixG9dm8MK4TEImCcTcR8VQYbCCdiCM+MKy3XTewN2e1lCAzYu4oKO6xt424yvlowuWiunWZ9YVFfKRpXvfWDd9Rt20PYP7cPyqifRdk4aKI8H+hXWGdeRkRoQvZMa1TdFwRmyg0jfrw94xz/GKNLsSXIu3XBY4LSzzBNUmfcIPpK2TuqAyLxb4d/L+OXG5KQZpydLJgE+GGxtqyAcNkK1ps4Qf3ua6DbGVdQ6Zg0db3g5OLu5LsyvO2jQQIPUQbVDRwwHmT2pDRhz8e8VUMGmokgMX2gAXjxJJ3CFPZAaR9VAzhtlQxbrFi5zSU7VAv92XLNNAdQhA+FFQryC/myI0V82reVWUlXMZsKqBdn5Zq7EA2AsW06NxW8REewUb3o9gauz+B8jAAXtIXZEXWVGqVLXLQceokAWQgrhOBKuE8H3Fuq1tT5VqaDcbvPT0LEU4FdSVBd1+JU0W9nJ4SF2nivJ4tCeZRgtKhaoG2n5gwM9L3fSdZTSrcZL4Gn9XfDZL5hV5GezrdGGGMfhtfIllJPFv3TjYNUlo3F2L3QB9D6SQR3VeLXHAB+IHw6VWwkOSqfEQVf4d8kHo= script: + - make deps + - make embedmd - make vet - make lint - make test diff --git a/Makefile b/Makefile index d4b347d..a9122a5 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,12 @@ fmt: vet: go vet $(PACKAGES) +deps: + go get github.com/campoy/embedmd + +embedmd: + embedmd -d *.md + errcheck: @which errcheck > /dev/null; if [ $$? -ne 0 ]; then \ go get -u github.com/kisielk/errcheck; \ diff --git a/README.md b/README.md index 684511f..9b24adf 100644 --- a/README.md +++ b/README.md @@ -54,13 +54,12 @@ A push notification micro server using [Gin](https://github.com/gin-gonic/gin) f See the [YAML config example](config/config.yml): +[embedmd]:# (config/config.yml yaml) ```yaml core: port: "8088" - # default worker number is runtime.NumCPU() - worker_num: 0 - # default queue number is 8192 - queue_num: 0 + worker_num: 0 # default worker number is runtime.NumCPU() + queue_num: 0 # default queue number is 8192 max_notification: 100 mode: "release" ssl: false @@ -68,7 +67,7 @@ core: key_path: "key.pem" http_proxy: "" # only working for GCM server pid: - enabled: true + enabled: false path: "gorush.pid" override: true diff --git a/config/config.yml b/config/config.yml index b387c18..f5378da 100644 --- a/config/config.yml +++ b/config/config.yml @@ -1,15 +1,13 @@ core: port: "8088" - # default worker number is runtime.NumCPU() - worker_num: 0 - # default queue number is 8192 - queue_num: 0 + worker_num: 0 # default worker number is runtime.NumCPU() + queue_num: 0 # default queue number is 8192 max_notification: 100 mode: "release" ssl: false cert_path: "cert.pem" key_path: "key.pem" - http_proxy: "" + http_proxy: "" # only working for GCM server pid: enabled: false path: "gorush.pid" @@ -26,25 +24,25 @@ api: android: enabled: true apikey: "YOUR_API_KEY" - max_retry: 0 + max_retry: 0 # resend fail notification, default value zero is disabled ios: enabled: false key_path: "key.pem" - password: "" + password: "" # certificate password, default as empty string. production: false - max_retry: 0 + max_retry: 0 # resend fail notification, default value zero is disabled log: format: "string" # string or json - access_log: "stdout" + access_log: "stdout" # stdout: output to console, or define log path like "log/access_log" access_level: "debug" - error_log: "stderr" + error_log: "stderr" # stderr: output to console, or define log path like "log/error_log" error_level: "error" hide_token: true stat: - engine: "memory" + engine: "memory" # support memory, redis, boltdb, buntdb or leveldb redis: addr: "localhost:6379" password: ""