Skip to content

Commit 67891f9

Browse files
committed
Merge pull request revel#903 from revel/develop
v0.12 Release
2 parents 869b3e4 + 3bac80e commit 67891f9

File tree

225 files changed

+292
-27161
lines changed

Some content is hidden

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

225 files changed

+292
-27161
lines changed

.travis.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ services:
55
- redis-server
66
install:
77
- export PATH=$PATH:$HOME/gopath/bin
8-
# Annoyingly, we can not use go get revel/... because references to app/routes package fail
8+
- export REVEL_BRANCH="master"
9+
- 'if [[ "$TRAVIS_BRANCH" == "master" ]]; then export REVEL_BRANCH="master"; fi'
10+
- 'echo "Travis branch: $TRAVIS_BRANCH, Revel dependency branch: $REVEL_BRANCH"'
11+
- go get -v github.com/revel/revel/...
12+
- git clone -b $REVEL_BRANCH git://github.com/revel/modules ../modules/
13+
- git clone -b $REVEL_BRANCH git://github.com/revel/cmd ../cmd/
14+
- git clone git://github.com/revel/samples ../samples/
915
- go get -v github.com/revel/cmd/revel
10-
- go get -v github.com/revel/revel/cache
11-
- go get -v github.com/revel/revel/harness
12-
- go get -v github.com/coopernurse/gorp
13-
- go get -v code.google.com/p/go.crypto/bcrypt
14-
- go get -v github.com/mattn/go-sqlite3
15-
- go get -v github.com/robfig/cron
16-
- go get -v code.google.com/p/goauth2/oauth
17-
- go get -v github.com/mrjones/oauth
1816
script:
1917
- go test github.com/revel/revel
2018
- go test github.com/revel/revel/cache
21-
- go test github.com/revel/revel/harness
19+
- go test github.com/revel/cmd/harness
2220

2321
# Ensure the new-app flow works (plus the other commands).
2422
- revel new my/testapp
@@ -29,16 +27,16 @@ script:
2927

3028
# Build & run the sample apps
3129
# Sleep between tests to avoid spurious "address already in use" failures.
32-
- revel test github.com/revel/revel/samples/booking
30+
- revel test github.com/revel/samples/booking
3331
- sleep 30
34-
- revel test github.com/revel/revel/samples/chat
32+
- revel test github.com/revel/samples/chat
3533
- sleep 30
36-
- revel test github.com/revel/revel/samples/facebook-oauth2
34+
- revel test github.com/revel/samples/facebook-oauth2
3735
- sleep 30
38-
- revel test github.com/revel/revel/samples/twitter-oauth
36+
- revel test github.com/revel/samples/twitter-oauth
3937
- sleep 30
40-
- revel test github.com/revel/revel/samples/validation
38+
- revel test github.com/revel/samples/validation
4139
- sleep 30
42-
- revel test github.com/revel/revel/samples/persona
40+
- revel test github.com/revel/samples/persona
4341
- sleep 30
44-
- revel test github.com/revel/revel/samples/upload
42+
- revel test github.com/revel/samples/upload

README.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A high productivity, full-stack web framework for the [Go language](http://www.golang.org).
44

5-
Current Version: 0.11.3 (Jan 3, 2015)
5+
Current Version: 0.12.0 (Mar 25, 2015)
66

77
**As of Revel 0.11.0, Go 1.3+ is required.**
88

@@ -11,6 +11,8 @@ Current Version: 0.11.3 (Jan 3, 2015)
1111
## Learn More
1212

1313
[Manual, Samples, Godocs, etc](http://revel.github.com)
14+
[Revel's Roadmap](https://github.com/revel/revel/wiki/Roadmap)
15+
[Articles Featuring Revel](https://github.com/revel/revel/wiki/Articles)
1416

1517
## Join The Community
1618

@@ -21,20 +23,7 @@ Current Version: 0.11.3 (Jan 3, 2015)
2123

2224
## Announcements
2325

24-
View the [v0.11.0 release notes](https://github.com/revel/revel/releases/tag/v0.11.0)
26+
View the [v0.12.0 release notes](https://github.com/revel/revel/releases/tag/v0.12.0)
2527
for all of the relevant changes.
2628

27-
We are now encouraging the community to both ask and answer common Revel workflow questions
28-
on [StackOverflow](http://stackoverflow.com/questions/tagged/revel). Our hope is that this
29-
will help grow our community a well as relieve the core development team's cognitive load
30-
and therefore allow them the time they need to reach the goals on
31-
[Revel's Roadmap](https://github.com/revel/revel/wiki/Roadmap).
32-
33-
The new Roadmap wiki page will allow us to more quickly complete Revel's v1.0 feature set
34-
goal. Please join us on our mailing list to discuss the Roadmap and any thoughts you may have.
35-
36-
One final note, we have added a [Collection of Articles](https://github.com/revel/revel/wiki/Articles)
37-
that discuss Revel and developer's opinion on our chosen approach. The goal here is to stay in touch
38-
with pracitcality and remaing open to feedback.
39-
40-
As always, thanks for your continued support!
29+
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!

compress.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,20 @@ type CompressResponseWriter struct {
4444
}
4545

4646
func CompressFilter(c *Controller, fc []Filter) {
47+
fc[0](c, fc[1:])
4748
if Config.BoolDefault("results.compressed", false) {
48-
writer := CompressResponseWriter{c.Response.Out, nil, "", false, make(chan bool, 1), nil, false}
49-
writer.DetectCompressionType(c.Request, c.Response)
50-
w, ok := c.Response.Out.(http.CloseNotifier)
51-
if ok {
52-
writer.parentNotify = w.CloseNotify()
49+
if c.Response.Status != http.StatusNoContent && c.Response.Status != http.StatusNotModified {
50+
writer := CompressResponseWriter{c.Response.Out, nil, "", false, make(chan bool, 1), nil, false}
51+
writer.DetectCompressionType(c.Request, c.Response)
52+
w, ok := c.Response.Out.(http.CloseNotifier)
53+
if ok {
54+
writer.parentNotify = w.CloseNotify()
55+
}
56+
c.Response.Out = &writer
57+
} else {
58+
TRACE.Printf("Compression disabled for response status (%d)", c.Response.Status)
5359
}
54-
c.Response.Out = &writer
5560
}
56-
fc[0](c, fc[1:])
5761
}
5862

5963
func (c CompressResponseWriter) CloseNotify() <-chan bool {

controller.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,17 @@ func (c *Controller) SetCookie(cookie *http.Cookie) {
5959
}
6060

6161
func (c *Controller) RenderError(err error) Result {
62+
c.setStatusIfNil(http.StatusInternalServerError)
63+
6264
return ErrorResult{c.RenderArgs, err}
6365
}
6466

67+
func (c *Controller) setStatusIfNil(status int) {
68+
if c.Response.Status == 0 {
69+
c.Response.Status = status
70+
}
71+
}
72+
6573
// Render a template corresponding to the calling Controller method.
6674
// Arguments will be added to c.RenderArgs prior to rendering the template.
6775
// They are keyed on their local identifier.
@@ -76,6 +84,8 @@ func (c *Controller) RenderError(err error) Result {
7684
// This action will render views/Users/ShowUser.html, passing in an extra
7785
// key-value "user": (User).
7886
func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
87+
c.setStatusIfNil(http.StatusOK)
88+
7989
// Get the calling function name.
8090
_, _, line, ok := runtime.Caller(1)
8191
if !ok {
@@ -103,6 +113,7 @@ func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
103113
// A less magical way to render a template.
104114
// Renders the given template, using the current RenderArgs.
105115
func (c *Controller) RenderTemplate(templatePath string) Result {
116+
c.setStatusIfNil(http.StatusOK)
106117

107118
// Get the Template.
108119
template, err := MainTemplateLoader.Template(templatePath)
@@ -118,21 +129,29 @@ func (c *Controller) RenderTemplate(templatePath string) Result {
118129

119130
// Uses encoding/json.Marshal to return JSON to the client.
120131
func (c *Controller) RenderJson(o interface{}) Result {
132+
c.setStatusIfNil(http.StatusOK)
133+
121134
return RenderJsonResult{o, ""}
122135
}
123136

124137
// Renders a JSONP result using encoding/json.Marshal
125138
func (c *Controller) RenderJsonP(callback string, o interface{}) Result {
139+
c.setStatusIfNil(http.StatusOK)
140+
126141
return RenderJsonResult{o, callback}
127142
}
128143

129144
// Uses encoding/xml.Marshal to return XML to the client.
130145
func (c *Controller) RenderXml(o interface{}) Result {
146+
c.setStatusIfNil(http.StatusOK)
147+
131148
return RenderXmlResult{o}
132149
}
133150

134151
// Render plaintext in response, printf style.
135152
func (c *Controller) RenderText(text string, objs ...interface{}) Result {
153+
c.setStatusIfNil(http.StatusOK)
154+
136155
finalText := text
137156
if len(objs) > 0 {
138157
finalText = fmt.Sprintf(text, objs...)
@@ -142,6 +161,8 @@ func (c *Controller) RenderText(text string, objs ...interface{}) Result {
142161

143162
// Render html in response
144163
func (c *Controller) RenderHtml(html string) Result {
164+
c.setStatusIfNil(http.StatusOK)
165+
145166
return &RenderHtmlResult{html}
146167
}
147168

@@ -186,6 +207,8 @@ func (c *Controller) Forbidden(msg string, objs ...interface{}) Result {
186207
// RenderFile returns a file, either displayed inline or downloaded
187208
// as an attachment. The name and size are taken from the file info.
188209
func (c *Controller) RenderFile(file *os.File, delivery ContentDisposition) Result {
210+
c.setStatusIfNil(http.StatusOK)
211+
189212
var (
190213
modtime = time.Now()
191214
fileInfo, err = file.Stat()
@@ -205,6 +228,8 @@ func (c *Controller) RenderFile(file *os.File, delivery ContentDisposition) Resu
205228
// it implements io.Reader). When called directly on something generated or
206229
// streamed, modtime should mostly likely be time.Now().
207230
func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery ContentDisposition, modtime time.Time) Result {
231+
c.setStatusIfNil(http.StatusOK)
232+
208233
return &BinaryResult{
209234
Reader: memfile,
210235
Name: filename,
@@ -219,6 +244,8 @@ func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery C
219244
// c.Redirect("/controller/action")
220245
// c.Redirect("/controller/%d/action", id)
221246
func (c *Controller) Redirect(val interface{}, args ...interface{}) Result {
247+
c.setStatusIfNil(http.StatusFound)
248+
222249
if url, ok := val.(string); ok {
223250
if len(args) == 0 {
224251
return &RedirectToUrlResult{url}

fakeapp_test.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"log"
66
"os"
77
"path"
8-
"path/filepath"
98
"reflect"
109
)
1110

@@ -59,20 +58,14 @@ func (c Static) Serve(prefix, filepath string) Result {
5958
}
6059

6160
func startFakeBookingApp() {
62-
Init("prod", "github.com/revel/revel/samples/booking", "")
61+
Init("prod", "github.com/revel/revel/testdata", "")
6362

6463
// Disable logging.
6564
TRACE = log.New(ioutil.Discard, "", 0)
6665
INFO = TRACE
6766
WARN = TRACE
6867
ERROR = TRACE
6968

70-
runStartupHooks()
71-
72-
MainRouter = NewRouter("")
73-
routesFile, _ := ioutil.ReadFile(filepath.Join(BasePath, "conf", "routes"))
74-
MainRouter.Routes, _ = parseRoutes("", "", string(routesFile), false)
75-
MainRouter.updateTree()
7669
MainTemplateLoader = NewTemplateLoader([]string{ViewsPath, path.Join(RevelPath, "templates")})
7770
MainTemplateLoader.Refresh()
7871

@@ -86,7 +79,7 @@ func startFakeBookingApp() {
8679
Args: []*MethodArg{
8780
{"id", reflect.TypeOf((*int)(nil))},
8881
},
89-
RenderArgNames: map[int][]string{31: []string{"title", "hotel"}},
82+
RenderArgNames: map[int][]string{30: []string{"title", "hotel"}},
9083
},
9184
&MethodType{
9285
Name: "Book",
@@ -107,4 +100,6 @@ func startFakeBookingApp() {
107100
RenderArgNames: map[int][]string{},
108101
},
109102
})
103+
104+
runStartupHooks()
110105
}

flash.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
// E.g. the Post/Redirect/Get pattern:
1313
// http://en.wikipedia.org/wiki/Post/Redirect/Get
1414
type Flash struct {
15+
// `Data` is the input which is read in `restoreFlash`, `Out` is the output which is set in a FLASH cookie at the end of the `FlashFilter()`
1516
Data, Out map[string]string
1617
}
1718

harness/app.go

Lines changed: 0 additions & 118 deletions
This file was deleted.

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