Buffalo@v0.14.7

Please read through the notes to see what is new, what has been improved, and most importantly, what might be breaking changes for existing applications.

In addition to what is listed here, it is recommended that you read the CHANGELOG for a complete list of what has changed since v0.14.6.


How to Upgrade

Pre-built Binaries

The easiest solution is to download one of the pre-built binaries:

https://github.com/gobuffalo/buffalo/releases/tag/v0.14.7

Using Go Get

$ go get -u github.com/gobuffalo/buffalo/buffalo

From Source

$ go get github.com/gobuffalo/buffalo
$ cd $GOPATH/src/github.com/gobuffalo/buffalo
$ git checkout tags/v0.14.7 -b v0.14.7
$ make install

Once you have an upgraded binary you can run the following command to attempt to upgrade your application from v0.14.6 to v0.14.7.

$ buffalo fix

Note: While we have done our best to make this update command work well, please understand that it might not get you to a complete upgrade depending on your application and its complexities, but it will get you pretty close.


Middler Interface

The gobuffalo/buffalo#Middler interface allows gobuffalo/buffalo#Resource implementations to provide additional custom gobuffalo/buffalo#MiddlewareFunc to the those already configured for the application

// Middler allows Resource implementations to provide
// additional custom Middleware to the those already
// configured.
type Middler interface {
  Use() []MiddlewareFunc
}
 func (w WidgetResource) AuthMW(next buffalo.Handler) buffalo.Handler {
   return func(c buffalo.Context) error {
     // do work
     return next(c)
  }
}

func (w WidgetResource) Use() []MiddlewareFunc {
  mw := []buffalo.MiddlewareFunc{
    w.AuthMW,
  }

  mw = append(mw, func(next buffalo.Handler) buffalo.Handler {
  return func(c buffalo.Context) error {
      // do work
      return next(c)
    }
  })

  return mw
}

Plugins Moved Into Core

The gobuffalo/buffalo-plugins package, and binary, have been moved into the core gobuffalo/buffalo repository.

This does not mean that plugins like gobuffalo/buffalo-pop or gobuffalo/buffalo-heroku are going to be brought into core.

We are pulling in the tool chain that third-party plugins use to develop with.

    // buffalo-coke/cmd/available.go@v0.14.7
    
    package cmd
    
    import (
        "github.com/gobuffalo/buffalo/plugins/plugcmds"
        "github.com/markbates/buffalo-coke/coke"
    )
    
    var Available = plugcmds.NewAvailable()
    
    func init() {
        Available.Add("root", cokeCmd)
        Available.Listen(coke.Listen)
        Available.Mount(rootCmd)
    }
    
    
    // buffalo-coke/cmd/available.go@v0.14.6
    
    package cmd
    
    import (
        "github.com/gobuffalo/buffalo-plugins/plugins/plugcmds"
        "github.com/markbates/buffalo-coke/coke"
    )
    
    var Available = plugcmds.NewAvailable()
    
    func init() {
        Available.Add("root", cokeCmd)
        Available.Listen(coke.Listen)
        Available.Mount(rootCmd)
    }
    
    
    // DIFF
        "package cmd",
        "",
        "import (",
    -   `   "github.com/gobuffalo/buffalo-plugins/plugins/plugcmds"`,
    +   `   "github.com/gobuffalo/buffalo/plugins/plugcmds"`,
        `   "github.com/markbates/buffalo-coke/coke"`,
        ")",
        ... // 9 identical lines
      
    

    Template File Extensions

    In an effort to make future versions of Buffalo more extensible in regards to file processors and templating systems, Buffalo has introduced multiple file extensions, similar to Rails.

    In this release, when running buffalo fix, all .html files in the templates/ directory will be renamed to .plush.html. All files generated by Buffalo will also have these extensions.

    Custom Asset Pipeline Commands

    This release replaces the hard coded Webpack commands (dev & build) with standard package.json scripts which can be called with either NPM or Yarn.

    The new applications will be generated with the following new section in the package.json:

    "scripts": {
        "build": "webpack -p --progress",
        "dev": "webpack --watch"
    }
    

    Buffalo will then call yarn run build (or npm run build) when you call buffalo build; and it will call yarn run dev (or npm run dev) when you call buffalo dev. This allows you to customize the scripts Buffalo calls on these steps, providing custom arguments to the Webpack command or even running your own tool chain instead.

    If the build or dev scripts can't be found, Buffalo will fall back on the old behavior running the hard coded Webpack commands.

    Buffalo Plugin Cache Improvements

    When running buffalo fix on an existing application the Buffalo plugins cache will be cleared to prevent issues with out of date caches.

    The cache will also now only store plugins that can provide a successful available sub-command.


    Breaking Changes

    Minimum Go Version

    In Go 1.12 the Go team introduced a go 1.x directive for go.mod files. Unfortunately this does not work on versions of Go <1.11.4. Because of this issue if you are using a version less than 1.11.4 then it is recommended you update as soon as possible.

    When Go 1.13 is released 1.11.x will reach end of life for support of Buffalo projects.


    Module Changes

    Buffalo Library/CLI Changes

    These are changes to the Buffalo library, as well as the buffalo binary.

      // gobuffalo/buffalo/go.mod@v0.14.7
      
      module github.com/gobuffalo/buffalo
      
      go 1.12
      
      require (
          github.com/BurntSushi/toml v0.3.1
          github.com/dustin/go-humanize v1.0.0
          github.com/fatih/color v1.7.0
          github.com/gobuffalo/attrs v0.1.0
          github.com/gobuffalo/buffalo-pop v1.16.0
          github.com/gobuffalo/clara v0.7.0
          github.com/gobuffalo/envy v1.7.0
          github.com/gobuffalo/events v1.4.0
          github.com/gobuffalo/fizz v1.9.2 // indirect
          github.com/gobuffalo/flect v0.1.5
          github.com/gobuffalo/genny v0.3.0
          github.com/gobuffalo/github_flavored_markdown v1.1.0
          github.com/gobuffalo/helpers v0.2.4
          github.com/gobuffalo/httptest v1.4.0
          github.com/gobuffalo/licenser v1.2.0
          github.com/gobuffalo/logger v1.0.1
          github.com/gobuffalo/meta v0.1.0
          github.com/gobuffalo/nulls v0.1.0
          github.com/gobuffalo/packd v0.3.0
          github.com/gobuffalo/packr/v2 v2.5.2
          github.com/gobuffalo/plush v3.8.3+incompatible
          github.com/gobuffalo/pop v4.11.2+incompatible
          github.com/gobuffalo/release v1.8.3
          github.com/gobuffalo/tags v2.1.0+incompatible
          github.com/google/go-cmp v0.3.0
          github.com/gorilla/mux v1.7.3
          github.com/gorilla/sessions v1.2.0
          github.com/karrick/godirwalk v1.10.12
          github.com/markbates/deplist v1.3.0
          github.com/markbates/grift v1.1.0
          github.com/markbates/oncer v1.0.0
          github.com/markbates/refresh v1.8.0
          github.com/markbates/safe v1.0.1
          github.com/markbates/sigtx v1.0.0
          github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd
          github.com/sirupsen/logrus v1.4.2
          github.com/spf13/afero v1.2.1 // indirect
          github.com/spf13/cobra v0.0.5
          github.com/spf13/pflag v1.0.3
          github.com/spf13/viper v1.4.0
          github.com/stretchr/testify v1.3.0
          golang.org/x/sync v0.0.0-20190423024810-112230192c58
          golang.org/x/tools v0.0.0-20190716221150-e98af2309876
          gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
          gopkg.in/yaml.v2 v2.2.2
      )
      
      
      // gobuffalo/buffalo/go.mod@v0.14.6
      
      module github.com/gobuffalo/buffalo
      
      go 1.12
      
      require (
          github.com/BurntSushi/toml v0.3.1
          github.com/dustin/go-humanize v1.0.0
          github.com/fatih/color v1.7.0
          github.com/gobuffalo/attrs v0.1.0
          github.com/gobuffalo/buffalo-docker v1.0.7
          github.com/gobuffalo/buffalo-pop v1.13.0
          github.com/gobuffalo/clara v0.6.0
          github.com/gobuffalo/depgen v0.2.0
          github.com/gobuffalo/envy v1.7.0
          github.com/gobuffalo/events v1.3.1
          github.com/gobuffalo/fizz v1.9.0 // indirect
          github.com/gobuffalo/flect v0.1.5
          github.com/gobuffalo/genny v0.2.0
          github.com/gobuffalo/github_flavored_markdown v1.0.7
          github.com/gobuffalo/gogen v0.2.0
          github.com/gobuffalo/helpers v0.2.2
          github.com/gobuffalo/httptest v1.3.0
          github.com/gobuffalo/licenser v1.1.0
          github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2
          github.com/gobuffalo/meta v0.0.0-20190329152330-e161e8a93e3b
          github.com/gobuffalo/nulls v0.0.0-20190305142546-85f3c9250d87
          github.com/gobuffalo/packd v0.2.0
          github.com/gobuffalo/packr/v2 v2.4.0
          github.com/gobuffalo/plush v3.8.2+incompatible
          github.com/gobuffalo/plushgen v0.1.2
          github.com/gobuffalo/pop v4.11.1+incompatible
          github.com/gobuffalo/release v1.7.0
          github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754
          github.com/gobuffalo/tags v2.1.0+incompatible
          github.com/gobuffalo/x v0.0.0-20190224155809-6bb134105960
          github.com/gorilla/context v1.1.1
          github.com/gorilla/mux v1.7.2
          github.com/gorilla/sessions v1.1.3
          github.com/karrick/godirwalk v1.10.3
          github.com/markbates/deplist v1.1.3
          github.com/markbates/grift v1.0.6
          github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2
          github.com/markbates/refresh v1.7.1
          github.com/markbates/safe v1.0.1
          github.com/markbates/sigtx v1.0.0
          github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd
          github.com/pkg/errors v0.8.1
          github.com/sirupsen/logrus v1.4.2
          github.com/spf13/cobra v0.0.5
          github.com/spf13/pflag v1.0.3
          github.com/spf13/viper v1.4.0
          github.com/stretchr/testify v1.3.0
          golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
          golang.org/x/sync v0.0.0-20190423024810-112230192c58
          golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f
          gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
      )
      
      
      // DIFF
          ... // 7 identical lines
          `   github.com/fatih/color v1.7.0`,
          `   github.com/gobuffalo/attrs v0.1.0`,
      -   `   github.com/gobuffalo/buffalo-docker v1.0.7`,
      -    `   github.com/gobuffalo/buffalo-pop v1.13.0`,
      -   `   github.com/gobuffalo/clara v0.6.0`,
      -   `   github.com/gobuffalo/depgen v0.2.0`,
      +   `   github.com/gobuffalo/buffalo-pop v1.16.0`,
      +   `   github.com/gobuffalo/clara v0.7.0`,
          `   github.com/gobuffalo/envy v1.7.0`,
      -   `   github.com/gobuffalo/events v1.3.1`,
      -   `   github.com/gobuffalo/fizz v1.9.0 // indirect`,
      +   `   github.com/gobuffalo/events v1.4.0`,
      +   `   github.com/gobuffalo/fizz v1.9.2 // indirect`,
          `   github.com/gobuffalo/flect v0.1.5`,
      -   `   github.com/gobuffalo/genny v0.2.0`,
      -   `   github.com/gobuffalo/github_flavored_markdown v1.0.7`,
      -   `   github.com/gobuffalo/gogen v0.2.0`,
      -   `   github.com/gobuffalo/helpers v0.2.2`,
      -   `   github.com/gobuffalo/httptest v1.3.0`,
      -   `   github.com/gobuffalo/licenser v1.1.0`,
      -   `   github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2`,
      -   `   github.com/gobuffalo/meta v0.0.0-20190329152330-e161e8a93e3b`,
      -   `   github.com/gobuffalo/nulls v0.0.0-20190305142546-85f3c9250d87`,
      -   `   github.com/gobuffalo/packd v0.2.0`,
      -   `   github.com/gobuffalo/packr/v2 v2.4.0`,
      -   `   github.com/gobuffalo/plush v3.8.2+incompatible`,
      -   `   github.com/gobuffalo/plushgen v0.1.2`,
      -   `   github.com/gobuffalo/pop v4.11.1+incompatible`,
      -   `   github.com/gobuffalo/release v1.7.0`,
      -   `   github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754`,
      +   `   github.com/gobuffalo/genny v0.3.0`,
      +   `   github.com/gobuffalo/github_flavored_markdown v1.1.0`,
      +   `   github.com/gobuffalo/helpers v0.2.4`,
      +   `   github.com/gobuffalo/httptest v1.4.0`,
      +   `   github.com/gobuffalo/licenser v1.2.0`,
      +   `   github.com/gobuffalo/logger v1.0.1`,
      +   `   github.com/gobuffalo/meta v0.1.0`,
      +   `   github.com/gobuffalo/nulls v0.1.0`,
      +   `   github.com/gobuffalo/packd v0.3.0`,
      +   `   github.com/gobuffalo/packr/v2 v2.5.2`,
      +   `   github.com/gobuffalo/plush v3.8.3+incompatible`,
      +   `   github.com/gobuffalo/pop v4.11.2+incompatible`,
      +   `   github.com/gobuffalo/release v1.8.3`,
          `   github.com/gobuffalo/tags v2.1.0+incompatible`,
      -   `   github.com/gobuffalo/x v0.0.0-20190224155809-6bb134105960`,
      -   `   github.com/gorilla/context v1.1.1`,
      -   `   github.com/gorilla/mux v1.7.2`,
      -   `   github.com/gorilla/sessions v1.1.3`,
      -   `   github.com/karrick/godirwalk v1.10.3`,
      -   `   github.com/markbates/deplist v1.1.3`,
      -   `   github.com/markbates/grift v1.0.6`,
      -   `   github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2`,
      -   `   github.com/markbates/refresh v1.7.1`,
      +   `   github.com/google/go-cmp v0.3.0`,
      +   `   github.com/gorilla/mux v1.7.3`,
      +   `   github.com/gorilla/sessions v1.2.0`,
      +   `   github.com/karrick/godirwalk v1.10.12`,
      +   `   github.com/markbates/deplist v1.3.0`,
      +   `   github.com/markbates/grift v1.1.0`,
      +   `   github.com/markbates/oncer v1.0.0`,
      +   `   github.com/markbates/refresh v1.8.0`,
          `   github.com/markbates/safe v1.0.1`,
          `   github.com/markbates/sigtx v1.0.0`,
          `   github.com/monoculum/formam v0.0.0-20190307031628-bc555adff0cd`,
      -   `   github.com/pkg/errors v0.8.1`,
           `   github.com/sirupsen/logrus v1.4.2`,
      +   `   github.com/spf13/afero v1.2.1 // indirect`,
           `   github.com/spf13/cobra v0.0.5`,
          `   github.com/spf13/pflag v1.0.3`,
          `   github.com/spf13/viper v1.4.0`,
          `   github.com/stretchr/testify v1.3.0`,
      -   `   golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8`,
           `   golang.org/x/sync v0.0.0-20190423024810-112230192c58`,
      -   `   golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f`,
      +   `   golang.org/x/tools v0.0.0-20190716221150-e98af2309876`,
          `   gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc`,
      +   `   gopkg.in/yaml.v2 v2.2.2`,
           ")",
          "",
        
      

      Application Changes

      These are changes for a brand new application @v0.14.7 with the following command:

      $ buffalo new coke
      
        // @v0.14.7/go.mod
        
        module github.com/markbates/coke
        
        go 1.12
        
        require (
            github.com/cockroachdb/apd v1.1.0 // indirect
            github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c // indirect
            github.com/codegangsta/negroni v1.0.0 // indirect
            github.com/gobuffalo/buffalo v0.14.7
            github.com/gobuffalo/buffalo-pop v1.16.0
            github.com/gobuffalo/envy v1.7.0
            github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
            github.com/gobuffalo/mw-forcessl v0.0.0-20190224202501-6d1ef7ffb276
            github.com/gobuffalo/mw-i18n v0.0.0-20190224203426-337de00e4c33
            github.com/gobuffalo/mw-paramlogger v0.0.0-20190224201358-0d45762ab655
            github.com/gobuffalo/packr v1.30.1
            github.com/gobuffalo/packr/v2 v2.5.2
            github.com/gobuffalo/pop v4.11.2+incompatible
            github.com/gobuffalo/suite v2.8.1+incompatible
            github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 // indirect
            github.com/markbates/grift v1.1.0
            github.com/satori/go.uuid v1.2.0 // indirect
            github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
            github.com/unrolled/secure v1.0.0
        )
        
        
        // @v0.14.6/go.mod
        
        module github.com/markbates/coke
        
        go 1.12
        
        require (
            github.com/codegangsta/negroni v1.0.0 // indirect
            github.com/gobuffalo/buffalo v0.14.6
            github.com/gobuffalo/buffalo-pop v1.13.0
            github.com/gobuffalo/envy v1.7.0
            github.com/gobuffalo/fizz v1.9.2 // indirect
            github.com/gobuffalo/httptest v1.4.0 // indirect
            github.com/gobuffalo/logger v1.0.1 // indirect
            github.com/gobuffalo/makr v1.2.0 // indirect
            github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517
            github.com/gobuffalo/mw-forcessl v0.0.0-20190224202501-6d1ef7ffb276
            github.com/gobuffalo/mw-i18n v0.0.0-20190224203426-337de00e4c33
            github.com/gobuffalo/mw-paramlogger v0.0.0-20190224201358-0d45762ab655
            github.com/gobuffalo/nulls v0.1.0 // indirect
            github.com/gobuffalo/packr v1.30.1
            github.com/gobuffalo/packr/v2 v2.5.2
            github.com/gobuffalo/plush v3.8.3+incompatible // indirect
            github.com/gobuffalo/pop v4.11.2+incompatible
            github.com/gobuffalo/suite v2.8.1+incompatible
            github.com/gorilla/mux v1.7.3 // indirect
            github.com/gorilla/sessions v1.2.0 // indirect
            github.com/jackc/pgx v3.3.0+incompatible // indirect
            github.com/markbates/grift v1.1.0
            github.com/markbates/oncer v1.0.0 // indirect
            github.com/markbates/refresh v1.8.0 // indirect
            github.com/unrolled/secure v1.0.0
            golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
        )
        
        
        // DIFF
            ... // 3 identical lines
            "",
            "require (",
        +   `   github.com/cockroachdb/apd v1.1.0 // indirect`,
        +   `   github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c // indirect`,
             `   github.com/codegangsta/negroni v1.0.0 // indirect`,
        -   `   github.com/gobuffalo/buffalo v0.14.6`,
        -   `   github.com/gobuffalo/buffalo-pop v1.13.0`,
        +   `   github.com/gobuffalo/buffalo v0.14.7`,
        +   `   github.com/gobuffalo/buffalo-pop v1.16.0`,
            `   github.com/gobuffalo/envy v1.7.0`,
        -   `   github.com/gobuffalo/fizz v1.9.2 // indirect`,
        -   `   github.com/gobuffalo/httptest v1.4.0 // indirect`,
        -   `   github.com/gobuffalo/logger v1.0.1 // indirect`,
        -   `   github.com/gobuffalo/makr v1.2.0 // indirect`,
             `   github.com/gobuffalo/mw-csrf v0.0.0-20190129204204-25460a055517`,
            `   github.com/gobuffalo/mw-forcessl v0.0.0-20190224202501-6d1ef7ffb276`,
            `   github.com/gobuffalo/mw-i18n v0.0.0-20190224203426-337de00e4c33`,
            `   github.com/gobuffalo/mw-paramlogger v0.0.0-20190224201358-0d45762ab655`,
        -   `   github.com/gobuffalo/nulls v0.1.0 // indirect`,
             `   github.com/gobuffalo/packr v1.30.1`,
            `   github.com/gobuffalo/packr/v2 v2.5.2`,
        -   `   github.com/gobuffalo/plush v3.8.3+incompatible // indirect`,
             `   github.com/gobuffalo/pop v4.11.2+incompatible`,
            `   github.com/gobuffalo/suite v2.8.1+incompatible`,
        -   `   github.com/gorilla/mux v1.7.3 // indirect`,
        -   `   github.com/gorilla/sessions v1.2.0 // indirect`,
        -   `   github.com/jackc/pgx v3.3.0+incompatible // indirect`,
        +   `   github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 // indirect`,
            `   github.com/markbates/grift v1.1.0`,
        -   `   github.com/markbates/oncer v1.0.0 // indirect`,
        -   `   github.com/markbates/refresh v1.8.0 // indirect`,
        +   `   github.com/satori/go.uuid v1.2.0 // indirect`,
        +   `   github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect`,
            `   github.com/unrolled/secure v1.0.0`,
        -   `   golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect`,
             ")",
            "",