Skip to content

Commit 678896c

Browse files
committed
Merging develop to master for v0.13.0 release
2 parents a9a2ff4 + 44973f4 commit 678896c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+924
-6155
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ revel/revel
55

66
# editor
77
*.swp
8+
9+
.idea/
10+
*.iml
11+

.travis.yml

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,69 @@
11
language: go
2-
go: 1.3
2+
3+
go:
4+
- 1.4
5+
- 1.5
6+
- 1.6
7+
- tip
8+
9+
os:
10+
- linux
11+
- osx
12+
13+
sudo: false
14+
315
services:
4-
- memcache # github.com/revel/revel/cache
16+
# github.com/revel/revel/cache
17+
- memcache
518
- redis-server
19+
20+
before_install:
21+
# TRAVIS_OS_NAME - linux and osx
22+
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install memcached redis; fi'
23+
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nohup /usr/local/opt/memcached/bin/memcached & fi'
24+
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nohup redis-server /usr/local/etc/redis.conf & fi'
25+
626
install:
27+
# Setting environments variables
728
- export PATH=$PATH:$HOME/gopath/bin
8-
- export REVEL_BRANCH="master"
29+
- export REVEL_BRANCH="develop"
930
- 'if [[ "$TRAVIS_BRANCH" == "master" ]]; then export REVEL_BRANCH="master"; fi'
1031
- 'echo "Travis branch: $TRAVIS_BRANCH, Revel dependency branch: $REVEL_BRANCH"'
1132
- go get -v github.com/revel/revel/...
33+
- 'if [[ "$TRAVIS_BRANCH" == "develop" ]]; then rm -rf ../config; fi'
1234
- git clone -b $REVEL_BRANCH git://github.com/revel/modules ../modules/
1335
- git clone -b $REVEL_BRANCH git://github.com/revel/cmd ../cmd/
36+
- git clone -b $REVEL_BRANCH git://github.com/revel/config ../config/
37+
- git clone -b $REVEL_BRANCH git://github.com/revel/cron ../cron/
1438
- git clone git://github.com/revel/samples ../samples/
1539
- go get -v github.com/revel/cmd/revel
40+
1641
script:
17-
- go test github.com/revel/revel
18-
- go test github.com/revel/revel/cache
19-
- go test github.com/revel/cmd/harness
42+
- go test -v github.com/revel/revel...
2043

2144
# Ensure the new-app flow works (plus the other commands).
45+
- revel version
2246
- revel new my/testapp
2347
- revel test my/testapp
2448
- revel clean my/testapp
2549
- revel build my/testapp build/testapp
50+
- revel build my/testapp build/testapp prod
2651
- revel package my/testapp
52+
- revel package my/testapp prod
2753

2854
# Build & run the sample apps
29-
# Sleep between tests to avoid spurious "address already in use" failures.
3055
- revel test github.com/revel/samples/booking
31-
- sleep 30
3256
- revel test github.com/revel/samples/chat
33-
- sleep 30
3457
- revel test github.com/revel/samples/facebook-oauth2
35-
- sleep 30
3658
- revel test github.com/revel/samples/twitter-oauth
37-
- sleep 30
3859
- revel test github.com/revel/samples/validation
39-
- sleep 30
40-
- revel test github.com/revel/samples/persona
41-
- sleep 30
4260
- revel test github.com/revel/samples/upload
61+
62+
# Commented out persona test sample, since persona.org gonna be shutdown.
63+
# Also http://personatestuser.org becomes non-responsive most of the time.
64+
# https://wiki.mozilla.org/Identity/Persona_Shutdown_Guidelines_for_Reliers
65+
# - revel test github.com/revel/samples/persona
66+
67+
matrix:
68+
allow_failures:
69+
- go: tip

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO Revel Framework Authors Information

LICENSE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
Copyright (C) 2012 Rob Figueiredo
2-
All Rights Reserved.
1+
The MIT License (MIT)
32

4-
MIT LICENSE
3+
Copyright (C) 2012-2016 The Revel Framework Authors.
54

65
Permission is hereby granted, free of charge, to any person obtaining a copy of
76
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Revel
1+
# Revel Framework
22

3-
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
3+
[![Build Status](https://secure.travis-ci.org/revel/revel.svg?branch=master)](http://travis-ci.org/revel/revel) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
44

5-
Current Version: 0.12.0 (Mar 25, 2015)
5+
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
66

7-
**As of Revel 0.11.0, Go 1.3+ is required.**
7+
Current Version: 0.13.0 (2016-06-05)
88

9-
[![Build Status](https://secure.travis-ci.org/revel/revel.svg?branch=master)](http://travis-ci.org/revel/revel)
9+
**As of Revel 0.13.0, Go 1.4+ is required.**
1010

1111
## Quick Start
1212

@@ -23,21 +23,42 @@ Open http://localhost:9000 in your browser and you should see "It works!"
2323

2424
## Learn More
2525

26-
[Manual, Samples, Godocs, etc](http://revel.github.com)
27-
[Revel's Roadmap](https://github.com/revel/revel/wiki/Roadmap)
28-
[Articles Featuring Revel](https://github.com/revel/revel/wiki/Articles)
26+
* [Manual, Samples, Godocs, etc](http://revel.github.com)
27+
* [Apps using Revel](https://github.com/revel/revel/wiki/Apps-in-the-Wild)
28+
* [Articles Featuring Revel](https://github.com/revel/revel/wiki/Articles)
2929

3030
## Contributing
3131

3232
* [Contributing Code Guidelines](https://github.com/revel/revel/blob/master/CONTRIBUTING.md)
33-
* [Google Groups](https://groups.google.com/forum/#!forum/revel-framework) via [revel-framework@googlegroups.com](mailto:revel-framework@googlegroups.com)
34-
* [GitHub Issues](https://github.com/revel/revel/issues)
35-
* [StackOverflow Questions](http://stackoverflow.com/questions/tagged/revel)
36-
* [IRC](http://webchat.freenode.net/?channels=%23revel&uio=d4) via #revel on Freenode
33+
* [Revel Contributors](https://github.com/revel/revel/graphs/contributors)
34+
35+
## Community
36+
37+
Join on [StackOverflow](http://stackoverflow.com/questions/tagged/revel), [IRC #revel](http://webchat.freenode.net/?channels=%23revel&uio=d4) and [Google Groups](https://groups.google.com/forum/#!forum/revel-framework)
38+
39+
* Report bugs [here](https://github.com/revel/revel/issues)
40+
* Answer questions of other community members (via [StackOverflow](http://stackoverflow.com/questions/tagged/revel), [Google Groups](https://groups.google.com/forum/#!forum/revel-framework) and [IRC](http://webchat.freenode.net/?channels=%23revel&uio=d4))
41+
* Give feedback on new feature discussions (via [GitHub Issues](https://github.com/revel/revel/issues) and [Google Groups](https://groups.google.com/forum/#!forum/revel-framework))
42+
* Propose your own ideas via [Google Groups](https://groups.google.com/forum/#!forum/revel-framework)
43+
44+
45+
## Gratitude
46+
47+
First and foremost, we'd like to thank the growing community of developers who enjoy using and contributing to Revel. Your patience, feedback, and moral support are vital to the ongoing development of Revel!
48+
49+
Also, thank you to those who have increased their level of involvement with Revel and revitalized the momentum of Revel:
50+
* [Jeeva](https://github.com/jeevatkm)
51+
* [Pedro](https://github.com/pedromorgan)
52+
* Many others who provided valuable Pull Requests, testing, and feedback.
53+
54+
Finally, we'd like to thank the professional organizations that have supported the development of Revel:
55+
* [Looking Glass](https://www.lookingglasscyber.com/)
56+
* [Surge](http://surgeforward.com/)
57+
3758

3859
## Announcements
3960

40-
View the [v0.12.0 release notes](https://github.com/revel/revel/releases/tag/v0.12.0)
61+
View the [v0.13.0 release notes](https://github.com/revel/revel/releases/tag/v0.13.0)
4162
for all of the relevant changes.
4263

4364
We are working on increasing the speed and quality of our releases. Your feedback has never been so valuable, please share your thoughts with us and help shape Revel!

cache/cache_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,20 @@ func testAdd(t *testing.T, newCache cacheFactory) {
178178
var err error
179179
cache := newCache(t, time.Hour)
180180
// Add to an empty cache.
181-
if err = cache.Add("int", 1, time.Second); err != nil {
181+
if err = cache.Add("int", 1, time.Second*3); err != nil {
182182
t.Errorf("Unexpected error adding to empty cache: %s", err)
183183
}
184184

185185
// Try to add again. (fail)
186-
if err = cache.Add("int", 2, time.Second); err != ErrNotStored {
187-
t.Errorf("Expected ErrNotStored adding dupe to cache: %s", err)
186+
if err = cache.Add("int", 2, time.Second*3); err != nil {
187+
if err != ErrNotStored {
188+
t.Errorf("Expected ErrNotStored adding dupe to cache: %s", err)
189+
}
188190
}
189191

190192
// Wait for it to expire, and add again.
191-
time.Sleep(2 * time.Second)
192-
if err = cache.Add("int", 3, time.Second); err != nil {
193+
time.Sleep(6 * time.Second)
194+
if err = cache.Add("int", 3, time.Second*3); err != nil {
193195
t.Errorf("Unexpected error adding to cache: %s", err)
194196
}
195197

@@ -215,7 +217,7 @@ func testGetMulti(t *testing.T, newCache cacheFactory) {
215217
var keys []string
216218
for key, value := range m {
217219
keys = append(keys, key)
218-
if err := cache.Set(key, value, DEFAULT); err != nil {
220+
if err := cache.Set(key, value, time.Second*3); err != nil {
219221
t.Errorf("Error setting a value: %s", err)
220222
}
221223
}

cache/redis.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package cache
22

33
import (
4+
"time"
5+
46
"github.com/garyburd/redigo/redis"
57
"github.com/revel/revel"
6-
"time"
78
)
89

910
// Wraps the Redis client to meet the Cache interface.
@@ -152,7 +153,7 @@ func (c RedisCache) Delete(key string) error {
152153
func (c RedisCache) Increment(key string, delta uint64) (uint64, error) {
153154
conn := c.pool.Get()
154155
defer conn.Close()
155-
// Check for existance *before* increment as per the cache contract.
156+
// Check for existence *before* increment as per the cache contract.
156157
// redis will auto create the key, and we don't want that. Since we need to do increment
157158
// ourselves instead of natively via INCRBY (redis doesn't support wrapping), we get the value
158159
// and do the exists check this way to minimize calls to Redis
@@ -177,7 +178,7 @@ func (c RedisCache) Increment(key string, delta uint64) (uint64, error) {
177178
func (c RedisCache) Decrement(key string, delta uint64) (newValue uint64, err error) {
178179
conn := c.pool.Get()
179180
defer conn.Close()
180-
// Check for existance *before* increment as per the cache contract.
181+
// Check for existence *before* increment as per the cache contract.
181182
// redis will auto create the key, and we don't want that, hence the exists call
182183
existed, err := exists(conn, key)
183184
if err != nil {

cache/redis_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package cache
22

33
import (
4-
"github.com/revel/revel"
54
"net"
65
"testing"
76
"time"
7+
8+
"github.com/revel/config"
9+
"github.com/revel/revel"
810
)
911

1012
// These tests require redis server running on localhost:6379 (the default)
1113
const redisTestServer = "localhost:6379"
1214

1315
var newRedisCache = func(t *testing.T, defaultExpiration time.Duration) Cache {
14-
revel.Config = revel.NewEmptyConfig()
16+
revel.Config = config.NewContext()
1517

1618
c, err := net.Dial("tcp", redisTestServer)
1719
if err == nil {

compress.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package revel
22

33
import (
4-
"compress/gzip"
5-
"compress/zlib"
64
"io"
75
"net/http"
86
"strconv"
97
"strings"
8+
9+
"github.com/klauspost/compress/gzip"
10+
"github.com/klauspost/compress/zlib"
1011
)
1112

1213
var compressionTypes = [...]string{
@@ -99,10 +100,10 @@ func (c *CompressResponseWriter) WriteHeader(status int) {
99100

100101
func (c *CompressResponseWriter) Close() error {
101102
if c.compressionType != "" {
102-
c.compressWriter.Close()
103+
_ = c.compressWriter.Close()
103104
}
104105
if w, ok := c.ResponseWriter.(io.Closer); ok {
105-
w.Close()
106+
_ = w.Close()
106107
}
107108
// Non-blocking write to the closenotifier, if we for some reason should
108109
// get called multiple times
@@ -134,26 +135,36 @@ func (c *CompressResponseWriter) Write(b []byte) (int, error) {
134135

135136
if c.compressionType != "" {
136137
return c.compressWriter.Write(b)
137-
} else {
138-
return c.ResponseWriter.Write(b)
139138
}
139+
140+
return c.ResponseWriter.Write(b)
140141
}
141142

143+
// DetectCompressionType method detects the comperssion type
144+
// from header "Accept-Encoding"
142145
func (c *CompressResponseWriter) DetectCompressionType(req *Request, resp *Response) {
143146
if Config.BoolDefault("results.compressed", false) {
144147
acceptedEncodings := strings.Split(req.Request.Header.Get("Accept-Encoding"), ",")
145148

146149
largestQ := 0.0
147150
chosenEncoding := len(compressionTypes)
148151

152+
// I have fixed one edge case for issue #914
153+
// But it's better to cover all possible edge cases or
154+
// Adapt to https://github.com/golang/gddo/blob/master/httputil/header/header.go#L172
149155
for _, encoding := range acceptedEncodings {
150156
encoding = strings.TrimSpace(encoding)
151157
encodingParts := strings.SplitN(encoding, ";", 2)
152158

153159
// If we are the format "gzip;q=0.8"
154160
if len(encodingParts) > 1 {
161+
q := strings.TrimSpace(encodingParts[1])
162+
if len(q) == 0 || !strings.HasPrefix(q, "q=") {
163+
continue
164+
}
165+
155166
// Strip off the q=
156-
num, err := strconv.ParseFloat(strings.TrimSpace(encodingParts[1])[2:], 32)
167+
num, err := strconv.ParseFloat(q[2:], 32)
157168
if err != nil {
158169
continue
159170
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy