Update DONATIONS.md summary & iris updater runs async unless CheckForUpdatesSync is true

This commit is contained in:
Gerasimos Maropoulos 2016-09-18 00:50:10 +03:00
parent e9d40577ea
commit 27f2ba7be9
5 changed files with 35 additions and 7 deletions

View File

@ -26,7 +26,7 @@ I'm grateful for all the generous donations. Iris is fully funded by these dona
- [Ryan Brooks](https://github.com/ryanbyyc) donated 50 EUR at May 11
- [Juan Sebastián Suárez Valencia](https://github.com/Juanses) donated 20 EUR at September 11
- Anonymous(PRIVACY PROTECTION) donated 20 EUR at September 16
- [Bob Lee](https://github.com/li3p) donated 20 EUR at September 16
> The name of the donator added after his/her permission.

View File

@ -2,6 +2,10 @@
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris`.
## 4.2.5 -> 4.2.6
- **CHANGE**: Updater (See 4.2.4 and 4.2.3) runs in its own goroutine now, unless the `iris.Config.CheckForUpdatesSync` is true.
## 4.2.4 -> 4.2.5
- **ADDED**: `iris.CheckForUpdates(force bool)` which can run the updater(look 4.2.4) at runtime too, updater is tested and worked at dev machine.

View File

@ -19,7 +19,7 @@
<br/>
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.2.5%20-blue.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.2.6%20-blue.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a>
@ -181,7 +181,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
Versioning
------------
Current: **v4.2.5**
Current: **v4.2.6**
> Iris is an active project
@ -224,7 +224,7 @@ License can be found [here](LICENSE).
[Travis]: http://travis-ci.org/kataras/iris
[License Widget]: https://img.shields.io/badge/license-Apache%202.0%20%20-E91E63.svg?style=flat-square
[License]: https://github.com/kataras/iris/blob/master/LICENSE
[Release Widget]: https://img.shields.io/badge/release-v4.2.5-blue.svg?style=flat-square
[Release Widget]: https://img.shields.io/badge/release-v4.2.6-blue.svg?style=flat-square
[Release]: https://github.com/kataras/iris/releases
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
[Chat]: https://kataras.rocket.chat/channel/iris

View File

@ -47,7 +47,8 @@ type Configuration struct {
// the updater, will notify the dev/user that the update is finished and should restart the App manually.
// Notes:
// 1. Experimental feature
// 2. If setted to true, the app will have a little startup delay
// 2. If setted to true, the app will start the server normally and runs the updater in its own goroutine,
// for a sync operation see CheckForUpdatesSync.
// 3. If you as developer edited the $GOPATH/src/github/kataras or any other Iris' Go dependencies at the past
// then the update process will fail.
//
@ -56,6 +57,14 @@ type Configuration struct {
// app := iris.New(iris.OptionCheckForUpdates(true))
// Default is false
CheckForUpdates bool
// CheckForUpdatesSync checks for updates before server starts, it will have a little delay depends on the machine's download's speed
// See CheckForUpdates for more
// Notes:
// 1. you could use the CheckForUpdatesSync while CheckForUpdates is false, set this or CheckForUpdates to true not both
// 2. if both CheckForUpdates and CheckForUpdatesSync are setted to true then the updater will run in sync mode, before server server starts.
//
// Default is false
CheckForUpdatesSync bool
// DisablePathCorrection corrects and redirects the requested path to the registed path
// for example, if /home/ path is requested but no handler for this Route found,
@ -187,6 +196,18 @@ var (
}
}
// CheckForUpdatesSync checks for updates before server starts, it will have a little delay depends on the machine's download's speed
// See CheckForUpdates for more
// Notes:
// 1. you could use the CheckForUpdatesSync while CheckForUpdates is false, set this or CheckForUpdates to true not both
// 2. if both CheckForUpdates and CheckForUpdatesSync are setted to true then the updater will run in sync mode, before server server starts.
//
// Default is false
OptionCheckForUpdatesSync = func(val bool) OptionSet {
return func(c *Configuration) {
c.CheckForUpdatesSync = val
}
}
// OptionDisablePathCorrection corrects and redirects the requested path to the registed path
// for example, if /home/ path is requested but no handler for this Route found,
@ -330,6 +351,7 @@ var (
func DefaultConfiguration() Configuration {
return Configuration{
CheckForUpdates: false,
CheckForUpdatesSync: false,
DisablePathCorrection: DefaultDisablePathCorrection,
DisablePathEscape: DefaultDisablePathEscape,
DisableBanner: false,

View File

@ -78,7 +78,7 @@ import (
const (
// Version is the current version of the Iris web framework
Version = "4.2.5"
Version = "4.2.6"
banner = ` _____ _
|_ _| (_)
@ -288,8 +288,10 @@ func (s *Framework) initialize() {
// updates, to cover the default station's irs.Config.checkForUpdates
// note: we could use the IsDevelopment configuration field to do that BUT
// the developer may want to check for updates without, for example, re-build template files (comes from IsDevelopment) on each request
if s.Config.CheckForUpdates {
if s.Config.CheckForUpdatesSync {
s.CheckForUpdates(false)
} else if s.Config.CheckForUpdates {
go func() { s.CheckForUpdates(false) }()
}
}