Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
move from markbates/pop to gobuffalo/pop (#933)
Browse files Browse the repository at this point in the history
* wip r.Interface

* renamed render.Interface to render.Auto

* cleaned up tests for auto

* Handle multiple types for resources fixes #389

* removed a few unneeded lines in the generated resource code

* fixed broken test

* wip moving to gobuffalo/pop

* updated a dep

* wip r.Interface

* renamed render.Interface to render.Auto

* cleaned up tests for auto

* wip moving to gobuffalo/pop

* Handle multiple types for resources fixes #389

* updated a dep

* remove the unneeded go get willie call

* Added a command to upgrade v0.10.3 to v0.11.0

* added updating of buffalo project dependencies

* improved the updater to work a bit better
  • Loading branch information
markbates authored Feb 26, 2018
1 parent 23634f0 commit cf5d501
Show file tree
Hide file tree
Showing 29 changed files with 1,446 additions and 234 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ADD . .

RUN go get -v -t ./...

RUN go install -v ./buffalo
RUN go install -v -tags sqlite ./buffalo

RUN go test -race $(go list ./... | grep -v /vendor/)
RUN go test -tags sqlite -race $(go list ./... | grep -v /vendor/)

RUN golint -set_exit_status $(go list ./... | grep -v /vendor/)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Buffalo would not be possible if not for all of the great projects it depends on

### Models/ORM (Optional)

[github.com/markbates/pop](https://github.com/markbates/pop) - Accessing databases is nothing new in web applications. Pop, and its command line tool, Soda, were chosen because they strike a nice balance between simplifying common tasks, being idiomatic, and giving you the flexibility you need to built your app. Pop and Soda share the same core philosphies as Buffalo so they were a natural choice.
[github.com/gobuffalo/pop](https://github.com/gobuffalo/pop) - Accessing databases is nothing new in web applications. Pop, and its command line tool, Soda, were chosen because they strike a nice balance between simplifying common tasks, being idiomatic, and giving you the flexibility you need to built your app. Pop and Soda share the same core philosphies as Buffalo so they were a natural choice.

### Sessions, Cookies, Websockets, and more...

Expand Down
16 changes: 8 additions & 8 deletions SHOULDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,21 @@ Thank you to the following **GIANTS**:

* [github.com/markbates/inflect](https://github.com/markbates/inflect)

* [github.com/markbates/pop](https://github.com/markbates/pop)
* [github.com/gobuffalo/pop](https://github.com/gobuffalo/pop)

* [github.com/markbates/pop/columns](https://github.com/markbates/pop/columns)
* [github.com/gobuffalo/pop/columns](https://github.com/gobuffalo/pop/columns)

* [github.com/markbates/pop/fizz](https://github.com/markbates/pop/fizz)
* [github.com/gobuffalo/pop/fizz](https://github.com/gobuffalo/pop/fizz)

* [github.com/markbates/pop/fizz/translators](https://github.com/markbates/pop/fizz/translators)
* [github.com/gobuffalo/pop/fizz/translators](https://github.com/gobuffalo/pop/fizz/translators)

* [github.com/markbates/pop/nulls](https://github.com/markbates/pop/nulls)
* [github.com/gobuffalo/pop/nulls](https://github.com/gobuffalo/pop/nulls)

* [github.com/markbates/pop/soda/cmd](https://github.com/markbates/pop/soda/cmd)
* [github.com/gobuffalo/pop/soda/cmd](https://github.com/gobuffalo/pop/soda/cmd)

* [github.com/markbates/pop/soda/cmd/generate](https://github.com/markbates/pop/soda/cmd/generate)
* [github.com/gobuffalo/pop/soda/cmd/generate](https://github.com/gobuffalo/pop/soda/cmd/generate)

* [github.com/markbates/pop/soda/cmd/schema](https://github.com/markbates/pop/soda/cmd/schema)
* [github.com/gobuffalo/pop/soda/cmd/schema](https://github.com/gobuffalo/pop/soda/cmd/schema)

* [github.com/markbates/refresh/refresh](https://github.com/markbates/refresh/refresh)

Expand Down
2 changes: 1 addition & 1 deletion binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"sync"
"time"

"github.com/gobuffalo/pop/nulls"
"github.com/gobuffalo/x/httpx"
"github.com/markbates/pop/nulls"
"github.com/monoculum/formam"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/build/templates/a.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package a
import (
"log"
"strings"
"github.com/markbates/pop"
"github.com/gobuffalo/pop"
"github.com/markbates/inflect"
"github.com/gobuffalo/packr"
<%= if (opts.Environment != "development") { %>
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/build/templates/main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
_ "<%= opts.ActionsPkg %>"
<%= if (opts.WithPop) { %>
"github.com/gobuffalo/packr"
"github.com/markbates/pop"
"github.com/gobuffalo/pop"
"<%= opts.ModelsPkg %>"
<% } %>
<%= if (opts.WithGrifts) { %>
Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/gobuffalo/buffalo/buffalo/cmd/destroy"
"github.com/markbates/pop/soda/cmd"
"github.com/gobuffalo/pop/soda/cmd"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion buffalo/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/markbates/pop"
"github.com/gobuffalo/pop"
"github.com/spf13/cobra"
)

Expand Down
23 changes: 23 additions & 0 deletions buffalo/cmd/update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"fmt"

"github.com/gobuffalo/buffalo/buffalo/cmd/updater"
"github.com/spf13/cobra"
)

// updateCmd represents the info command
var updateCmd = &cobra.Command{
Use: "update",
Short: fmt.Sprintf("will attempt to upgrade a Buffalo application to version %s", Version),
RunE: func(cmd *cobra.Command, args []string) error {
updater.Version = Version
return updater.Run()
},
}

func init() {
decorate("update", RootCmd)
RootCmd.AddCommand(updateCmd)
}
86 changes: 86 additions & 0 deletions buffalo/cmd/updater/dep.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package updater

import (
"context"
"fmt"
"os"
"os/exec"

"github.com/gobuffalo/envy"
"github.com/markbates/deplist"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)

type lockToml struct {
Name string `toml:"name"`
Branch string `toml:"branch"`
Packages []string `toml:"packages"`
Revision string `toml:"revision"`
Version string `toml:"version"`
}

func goGetUpdate(r *Runner) error {
fmt.Println("~~~ Running go get ~~~")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
wg, _ := errgroup.WithContext(ctx)
deps, err := deplist.List()
if err != nil {
return errors.WithStack(err)
}
for dep := range deps {
args := []string{"get", "-u"}
args = append(args, dep)
cc := exec.Command(envy.Get("GO_BIN", "go"), args...)
f := func() error {
cc.Stdin = os.Stdin
cc.Stderr = os.Stderr
cc.Stdout = os.Stdout
return cc.Run()
}
wg.Go(f)
}
err = wg.Wait()
if err != nil {
return errors.Errorf("We encountered the following error trying to install and update the dependencies for this application:\n%s", err)
}
return nil
}

// DepEnsure runs `dep ensure -v` to make sure that any newly changed
// imports are added to dep.
func DepEnsure(r *Runner) error {
if !r.App.WithDep {
return goGetUpdate(r)
}
fmt.Println("~~~ Running dep ensure ~~~")
cc := exec.Command("dep", "ensure", "-v")
cc.Stdin = os.Stdin
cc.Stderr = os.Stderr
cc.Stdout = os.Stdout
if err := cc.Run(); err != nil {
return errors.WithStack(err)
}

for _, p := range []string{"github.com/gobuffalo/[email protected]", "github.com/gobuffalo/[email protected]"} {
cc = exec.Command("dep", "ensure", "-v", "-add", p)
cc.Stdin = os.Stdin
cc.Stderr = os.Stderr
cc.Stdout = os.Stdout
if err := cc.Run(); err != nil {
return errors.WithStack(err)
}
}

for _, p := range []string{"github.com/markbates/inflect"} {
cc = exec.Command("dep", "ensure", "-v", "-update", p)
cc.Stdin = os.Stdin
cc.Stderr = os.Stderr
cc.Stdout = os.Stdout
if err := cc.Run(); err != nil {
return errors.WithStack(err)
}
}
return nil
}
43 changes: 43 additions & 0 deletions buffalo/cmd/updater/deprecations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package updater

import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"

"github.com/pkg/errors"
)

// DeprecrationsCheck will either log, or fix, deprecated items in the application
func DeprecrationsCheck(r *Runner) error {
fmt.Println("~~~ Checking for deprecations ~~~")
b, err := ioutil.ReadFile("main.go")
if err != nil {
return errors.WithStack(err)
}
if bytes.Contains(b, []byte("app.Start")) {
r.Warnings = append(r.Warnings, "app.Start has been removed in v0.11.0. Use app.Serve Instead. [main.go]")
}

return filepath.Walk(filepath.Join(r.App.Root, "actions"), func(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
}

if filepath.Ext(path) != ".go" {
return nil
}

b, err := ioutil.ReadFile(path)
if err != nil {
return errors.WithStack(err)
}
if bytes.Contains(b, []byte("Websocket()")) {
r.Warnings = append(r.Warnings, fmt.Sprintf("buffalo.Context#Websocket has been deprecated in v0.11.0. Use github.com/gorilla/websocket directly. [%s]", path))
}

return nil
})
}
Loading

0 comments on commit cf5d501

Please sign in to comment.