Skip to content

Commit

Permalink
Merge pull request #903 from revel/develop
Browse files Browse the repository at this point in the history
v0.12 Release
  • Loading branch information
brendensoares committed Mar 25, 2015
2 parents 869b3e4 + 3bac80e commit 67891f9
Show file tree
Hide file tree
Showing 225 changed files with 292 additions and 27,161 deletions.
32 changes: 15 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ services:
- redis-server
install:
- export PATH=$PATH:$HOME/gopath/bin
# Annoyingly, we can not use go get revel/... because references to app/routes package fail
- export REVEL_BRANCH="master"
- 'if [[ "$TRAVIS_BRANCH" == "master" ]]; then export REVEL_BRANCH="master"; fi'
- 'echo "Travis branch: $TRAVIS_BRANCH, Revel dependency branch: $REVEL_BRANCH"'
- go get -v github.com/revel/revel/...
- git clone -b $REVEL_BRANCH git://github.com/revel/modules ../modules/
- git clone -b $REVEL_BRANCH git://github.com/revel/cmd ../cmd/
- git clone git://github.com/revel/samples ../samples/
- go get -v github.com/revel/cmd/revel
- go get -v github.com/revel/revel/cache
- go get -v github.com/revel/revel/harness
- go get -v github.com/coopernurse/gorp
- go get -v code.google.com/p/go.crypto/bcrypt
- go get -v github.com/mattn/go-sqlite3
- go get -v github.com/robfig/cron
- go get -v code.google.com/p/goauth2/oauth
- go get -v github.com/mrjones/oauth
script:
- go test github.com/revel/revel
- go test github.com/revel/revel/cache
- go test github.com/revel/revel/harness
- go test github.com/revel/cmd/harness

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

# Build & run the sample apps
# Sleep between tests to avoid spurious "address already in use" failures.
- revel test github.com/revel/revel/samples/booking
- revel test github.com/revel/samples/booking
- sleep 30
- revel test github.com/revel/revel/samples/chat
- revel test github.com/revel/samples/chat
- sleep 30
- revel test github.com/revel/revel/samples/facebook-oauth2
- revel test github.com/revel/samples/facebook-oauth2
- sleep 30
- revel test github.com/revel/revel/samples/twitter-oauth
- revel test github.com/revel/samples/twitter-oauth
- sleep 30
- revel test github.com/revel/revel/samples/validation
- revel test github.com/revel/samples/validation
- sleep 30
- revel test github.com/revel/revel/samples/persona
- revel test github.com/revel/samples/persona
- sleep 30
- revel test github.com/revel/revel/samples/upload
- revel test github.com/revel/samples/upload
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

Current Version: 0.11.3 (Jan 3, 2015)
Current Version: 0.12.0 (Mar 25, 2015)

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

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

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

## Join The Community

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

## Announcements

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

We are now encouraging the community to both ask and answer common Revel workflow questions
on [StackOverflow](http://stackoverflow.com/questions/tagged/revel). Our hope is that this
will help grow our community a well as relieve the core development team's cognitive load
and therefore allow them the time they need to reach the goals on
[Revel's Roadmap](https://github.com/revel/revel/wiki/Roadmap).

The new Roadmap wiki page will allow us to more quickly complete Revel's v1.0 feature set
goal. Please join us on our mailing list to discuss the Roadmap and any thoughts you may have.

One final note, we have added a [Collection of Articles](https://github.com/revel/revel/wiki/Articles)
that discuss Revel and developer's opinion on our chosen approach. The goal here is to stay in touch
with pracitcality and remaing open to feedback.

As always, thanks for your continued support!
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!
18 changes: 11 additions & 7 deletions compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ type CompressResponseWriter struct {
}

func CompressFilter(c *Controller, fc []Filter) {
fc[0](c, fc[1:])
if Config.BoolDefault("results.compressed", false) {
writer := CompressResponseWriter{c.Response.Out, nil, "", false, make(chan bool, 1), nil, false}
writer.DetectCompressionType(c.Request, c.Response)
w, ok := c.Response.Out.(http.CloseNotifier)
if ok {
writer.parentNotify = w.CloseNotify()
if c.Response.Status != http.StatusNoContent && c.Response.Status != http.StatusNotModified {
writer := CompressResponseWriter{c.Response.Out, nil, "", false, make(chan bool, 1), nil, false}
writer.DetectCompressionType(c.Request, c.Response)
w, ok := c.Response.Out.(http.CloseNotifier)
if ok {
writer.parentNotify = w.CloseNotify()
}
c.Response.Out = &writer
} else {
TRACE.Printf("Compression disabled for response status (%d)", c.Response.Status)
}
c.Response.Out = &writer
}
fc[0](c, fc[1:])
}

func (c CompressResponseWriter) CloseNotify() <-chan bool {
Expand Down
27 changes: 27 additions & 0 deletions controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ func (c *Controller) SetCookie(cookie *http.Cookie) {
}

func (c *Controller) RenderError(err error) Result {
c.setStatusIfNil(http.StatusInternalServerError)

return ErrorResult{c.RenderArgs, err}
}

func (c *Controller) setStatusIfNil(status int) {
if c.Response.Status == 0 {
c.Response.Status = status
}
}

// Render a template corresponding to the calling Controller method.
// Arguments will be added to c.RenderArgs prior to rendering the template.
// They are keyed on their local identifier.
Expand All @@ -76,6 +84,8 @@ func (c *Controller) RenderError(err error) Result {
// This action will render views/Users/ShowUser.html, passing in an extra
// key-value "user": (User).
func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
c.setStatusIfNil(http.StatusOK)

// Get the calling function name.
_, _, line, ok := runtime.Caller(1)
if !ok {
Expand Down Expand Up @@ -103,6 +113,7 @@ func (c *Controller) Render(extraRenderArgs ...interface{}) Result {
// A less magical way to render a template.
// Renders the given template, using the current RenderArgs.
func (c *Controller) RenderTemplate(templatePath string) Result {
c.setStatusIfNil(http.StatusOK)

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

// Uses encoding/json.Marshal to return JSON to the client.
func (c *Controller) RenderJson(o interface{}) Result {
c.setStatusIfNil(http.StatusOK)

return RenderJsonResult{o, ""}
}

// Renders a JSONP result using encoding/json.Marshal
func (c *Controller) RenderJsonP(callback string, o interface{}) Result {
c.setStatusIfNil(http.StatusOK)

return RenderJsonResult{o, callback}
}

// Uses encoding/xml.Marshal to return XML to the client.
func (c *Controller) RenderXml(o interface{}) Result {
c.setStatusIfNil(http.StatusOK)

return RenderXmlResult{o}
}

// Render plaintext in response, printf style.
func (c *Controller) RenderText(text string, objs ...interface{}) Result {
c.setStatusIfNil(http.StatusOK)

finalText := text
if len(objs) > 0 {
finalText = fmt.Sprintf(text, objs...)
Expand All @@ -142,6 +161,8 @@ func (c *Controller) RenderText(text string, objs ...interface{}) Result {

// Render html in response
func (c *Controller) RenderHtml(html string) Result {
c.setStatusIfNil(http.StatusOK)

return &RenderHtmlResult{html}
}

Expand Down Expand Up @@ -186,6 +207,8 @@ func (c *Controller) Forbidden(msg string, objs ...interface{}) Result {
// RenderFile returns a file, either displayed inline or downloaded
// as an attachment. The name and size are taken from the file info.
func (c *Controller) RenderFile(file *os.File, delivery ContentDisposition) Result {
c.setStatusIfNil(http.StatusOK)

var (
modtime = time.Now()
fileInfo, err = file.Stat()
Expand All @@ -205,6 +228,8 @@ func (c *Controller) RenderFile(file *os.File, delivery ContentDisposition) Resu
// it implements io.Reader). When called directly on something generated or
// streamed, modtime should mostly likely be time.Now().
func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery ContentDisposition, modtime time.Time) Result {
c.setStatusIfNil(http.StatusOK)

return &BinaryResult{
Reader: memfile,
Name: filename,
Expand All @@ -219,6 +244,8 @@ func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery C
// c.Redirect("/controller/action")
// c.Redirect("/controller/%d/action", id)
func (c *Controller) Redirect(val interface{}, args ...interface{}) Result {
c.setStatusIfNil(http.StatusFound)

if url, ok := val.(string); ok {
if len(args) == 0 {
return &RedirectToUrlResult{url}
Expand Down
13 changes: 4 additions & 9 deletions fakeapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log"
"os"
"path"
"path/filepath"
"reflect"
)

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

func startFakeBookingApp() {
Init("prod", "github.com/revel/revel/samples/booking", "")
Init("prod", "github.com/revel/revel/testdata", "")

// Disable logging.
TRACE = log.New(ioutil.Discard, "", 0)
INFO = TRACE
WARN = TRACE
ERROR = TRACE

runStartupHooks()

MainRouter = NewRouter("")
routesFile, _ := ioutil.ReadFile(filepath.Join(BasePath, "conf", "routes"))
MainRouter.Routes, _ = parseRoutes("", "", string(routesFile), false)
MainRouter.updateTree()
MainTemplateLoader = NewTemplateLoader([]string{ViewsPath, path.Join(RevelPath, "templates")})
MainTemplateLoader.Refresh()

Expand All @@ -86,7 +79,7 @@ func startFakeBookingApp() {
Args: []*MethodArg{
{"id", reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{31: []string{"title", "hotel"}},
RenderArgNames: map[int][]string{30: []string{"title", "hotel"}},
},
&MethodType{
Name: "Book",
Expand All @@ -107,4 +100,6 @@ func startFakeBookingApp() {
RenderArgNames: map[int][]string{},
},
})

runStartupHooks()
}
1 change: 1 addition & 0 deletions flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// E.g. the Post/Redirect/Get pattern:
// http://en.wikipedia.org/wiki/Post/Redirect/Get
type Flash struct {
// `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()`
Data, Out map[string]string
}

Expand Down
118 changes: 0 additions & 118 deletions harness/app.go

This file was deleted.

0 comments on commit 67891f9

Please sign in to comment.