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

Commit

Permalink
Merge pull request #52 from fasmat/feature/update-templates-for-new-app
Browse files Browse the repository at this point in the history
Update templates for new app
  • Loading branch information
paganotoni authored Nov 25, 2021
2 parents d49e9f5 + aa8c493 commit 56701c6
Show file tree
Hide file tree
Showing 82 changed files with 1,190 additions and 2,132 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
id: go

- name: Checkout Code
uses: actions/checkout@master
uses: actions/checkout@v2

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
linters-settings:
errcheck:
exclude-functions:
- events.Emit
- events.EmitPayload
- events.EmitError
- events.NamedListen
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ADD . .
RUN go install ./cmd/buffalo

WORKDIR /
RUN go install github.com/gobuffalo/buffalo-pop/v2@latest
RUN go install github.com/gobuffalo/buffalo-pop/v3@latest

RUN mkdir /src
WORKDIR /src
2 changes: 1 addition & 1 deletion Dockerfile.slim.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ADD . .
RUN go install ./cmd/buffalo

WORKDIR /
RUN go install github.com/gobuffalo/buffalo-pop/v2@latest
RUN go install github.com/gobuffalo/buffalo-pop/v3@latest

RUN mkdir /src
WORKDIR /src
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ require (
github.com/BurntSushi/toml v0.4.1
github.com/fatih/color v1.13.0
github.com/gobuffalo/attrs v1.0.1
github.com/gobuffalo/buffalo-pop/v2 v2.3.0
github.com/gobuffalo/clara/v2 v2.0.2
github.com/gobuffalo/buffalo-pop/v3 v3.0.1
github.com/gobuffalo/clara/v2 v2.0.5
github.com/gobuffalo/envy v1.10.1
github.com/gobuffalo/events v1.4.2
github.com/gobuffalo/flect v0.2.4
github.com/gobuffalo/genny/v2 v2.0.7
github.com/gobuffalo/genny/v2 v2.0.8
github.com/gobuffalo/logger v1.0.6
github.com/gobuffalo/meta v0.3.1
github.com/gobuffalo/plush/v4 v4.1.8
github.com/gobuffalo/pop/v5 v5.3.4
github.com/gobuffalo/plush/v4 v4.1.9
github.com/gobuffalo/pop/v6 v6.0.0
github.com/google/go-cmp v0.5.6
github.com/karrick/godirwalk v1.16.1
github.com/markbates/grift v1.5.0
github.com/markbates/oncer v1.0.0
github.com/markbates/refresh v1.12.0
Expand Down
1,126 changes: 68 additions & 1,058 deletions go.sum

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions internal/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/gobuffalo/cli/internal/genny/build"

"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/logger"
"github.com/gobuffalo/meta"
Expand Down Expand Up @@ -63,7 +62,6 @@ var xbuildCmd = &cobra.Command{
if buildOptions.Verbose || buildOptions.Debug {
lg := logger.New(logger.DebugLevel)
run.Logger = lg
// plog.Logger = lg
buildOptions.BuildFlags = append(buildOptions.BuildFlags, "-v")
}

Expand All @@ -85,7 +83,7 @@ var xbuildCmd = &cobra.Command{
// defer clean(run)
defer func() {
if err := clean(run); err != nil {
log.Fatal("build:clean", err)
log.Fatalf("build:clean %s", err)
}
}()
if err := run.WithNew(build.New(opts)); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
"runtime"
"strings"

"github.com/fatih/color"
"github.com/gobuffalo/cli/internal/genny/assets/webpack"
rg "github.com/gobuffalo/cli/internal/genny/refresh"

"github.com/fatih/color"
"github.com/gobuffalo/events"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
Expand Down
9 changes: 5 additions & 4 deletions internal/cmd/fix/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var YesToAll bool
var replace = map[string]string{
"github.com/gobuffalo/buffalo-plugins": "github.com/gobuffalo/cli/internal/plugins",
"github.com/gobuffalo/genny": "github.com/gobuffalo/genny/v2",
"github.com/gobuffalo/pop": "github.com/gobuffalo/pop/v5",
"github.com/gobuffalo/pop": "github.com/gobuffalo/pop/v6",
"github.com/gobuffalo/pop/nulls": "github.com/gobuffalo/nulls",
"github.com/gobuffalo/uuid": "github.com/gofrs/uuid",
"github.com/markbates/pop": "github.com/gobuffalo/pop/v5",
Expand All @@ -26,10 +26,11 @@ var replace = map[string]string{
"github.com/shurcooL/github_flavored_markdown": "github.com/gobuffalo/github_flavored_markdown",
"github.com/gobuffalo/validate": "github.com/gobuffalo/validate/v3",
"github.com/gobuffalo/validate/validators": "github.com/gobuffalo/validate/v3/validators",
"github.com/gobuffalo/suite": "github.com/gobuffalo/suite/v3",
"github.com/gobuffalo/buffalo-pop/": "github.com/gobuffalo/buffalo-pop/v2",
"github.com/gobuffalo/buffalo-pop/pop/popmw": "github.com/gobuffalo/buffalo-pop/v2/pop/popmw",
"github.com/gobuffalo/suite": "github.com/gobuffalo/suite/v4",
"github.com/gobuffalo/buffalo-pop/": "github.com/gobuffalo/buffalo-pop/v3",
"github.com/gobuffalo/buffalo-pop/pop/popmw": "github.com/gobuffalo/buffalo-pop/v3/pop/popmw",
"github.com/gobuffalo/plush": "github.com/gobuffalo/plush/v4",
"github.com/gobuffalo/mw-i18n": "github.com/gobuffalo/mw-i18n/v2",
}

var ic = ImportConverter{
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/fix/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (mw MiddlewareTransformer) addMissingRootMiddlewareImports(fset *token.File
}

if strings.Contains(content, "popmw.Transaction") {
astutil.AddImport(fset, f, "github.com/gobuffalo/buffalo-pop/v2/pop/popmw")
astutil.AddImport(fset, f, "github.com/gobuffalo/buffalo-pop/v3/pop/popmw")
}

if strings.Contains(content, "contenttype.Add") || strings.Contains(content, "contenttype.Set") {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/fix/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func installTools(r *Runner) error {
g := genny.New()
app := r.App
if app.WithPop {
rTools = append(rTools, "github.com/gobuffalo/buffalo-pop/v2")
rTools = append(rTools, "github.com/gobuffalo/buffalo-pop/v3")
}
for _, t := range rTools {
g.Command(exec.Command("go", "get", t))
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"os/exec"
"time"

"github.com/gobuffalo/cli/internal/genny/info"

"github.com/gobuffalo/clara/v2/genny/rx"
"github.com/gobuffalo/cli/internal/genny/info"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/internal/integration/new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/gobuffalo/pop/v5"
"github.com/gobuffalo/pop/v6"
"github.com/stretchr/testify/require"
)

Expand Down
28 changes: 16 additions & 12 deletions internal/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"context"
"errors"
"fmt"
"log"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"

pop "github.com/gobuffalo/buffalo-pop/v3/genny/newapp"
"github.com/gobuffalo/cli/internal/genny/assets/standard"
"github.com/gobuffalo/cli/internal/genny/assets/webpack"
"github.com/gobuffalo/cli/internal/genny/ci"
Expand All @@ -21,8 +23,6 @@ import (
"github.com/gobuffalo/cli/internal/genny/newapp/web"
"github.com/gobuffalo/cli/internal/genny/refresh"
"github.com/gobuffalo/cli/internal/genny/vcs"

pop "github.com/gobuffalo/buffalo-pop/v2/genny/newapp"
"github.com/gobuffalo/envy"
fname "github.com/gobuffalo/flect/name"
"github.com/gobuffalo/genny/v2"
Expand Down Expand Up @@ -148,9 +148,13 @@ var newCmd = &cobra.Command{
// Restore default values after usage (useful for testing)
defer func() {
cmd.Flags().Visit(func(f *pflag.Flag) {
f.Value.Set(f.DefValue)
if err := f.Value.Set(f.DefValue); err != nil {
log.Fatalf("failed to restore default value: %s", err)
}
})
viper.BindPFlags(cmd.Flags())
if err := viper.BindPFlags(cmd.Flags()); err != nil {
log.Fatalf("failed to bind flags: %s", err)
}
}()

nopts, err := parseNewOptions(args)
Expand Down Expand Up @@ -318,20 +322,20 @@ func initConfig(skipConfig *bool, cfgFile *string) func() {
return
}

var err error
if *cfgFile != "" { // enable ability to specify config file via flag
// enable ability to specify config file via flag
if *cfgFile != "" {
viper.SetConfigFile(*cfgFile)
// Will error only if the --config flag is used
if err = viper.ReadInConfig(); err != nil {
if err := viper.ReadInConfig(); err != nil {
configError = err
}
} else {
viper.SetConfigName(".buffalo") // name of config file (without extension)
viper.AddConfigPath("$HOME") // adding home directory as first search path
viper.AutomaticEnv() // read in environment variables that match
viper.ReadInConfig()
return
}

viper.SetConfigName(".buffalo") // name of config file (without extension)
viper.AddConfigPath("$HOME") // adding home directory as first search path
viper.AutomaticEnv() // read in environment variables that match
viper.ReadInConfig()
}
}

Expand Down
1 change: 0 additions & 1 deletion internal/cmd/new_test.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/cmd/plugins/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"

"github.com/gobuffalo/cli/internal/genny/add"

"github.com/gobuffalo/cli/internal/plugins/plugdeps"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/meta"
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/plugins/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"

"github.com/gobuffalo/cli/internal/genny/plugins/install"

"github.com/gobuffalo/cli/internal/plugins/plugdeps"
"github.com/gobuffalo/genny/v2"
"github.com/gobuffalo/logger"
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/plugins/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/gobuffalo/cli/internal/genny/plugins/install"

"github.com/gobuffalo/cli/internal/plugins"
"github.com/gobuffalo/events"
"github.com/gobuffalo/genny/v2"
Expand All @@ -31,5 +30,6 @@ func Listen(e events.Event) error {
events.EmitError(plugins.EvtSetupErr, err, payload)
return err
}
return events.EmitPayload(plugins.EvtSetupFinished, payload)
events.EmitPayload(plugins.EvtSetupFinished, payload)
return nil
}
3 changes: 1 addition & 2 deletions internal/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (

"github.com/gobuffalo/envy"
"github.com/gobuffalo/meta"
"github.com/gobuffalo/pop/v6"
"github.com/sirupsen/logrus"

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

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ func Test_CutArg(t *testing.T) {
t.Errorf("got %s, want %s when cutting %s from %s", result, tt.expected, tt.arg, tt.args)
}
}
}
}
2 changes: 1 addition & 1 deletion internal/genny/add/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Test_New(t *testing.T) {
g, err := New(&Options{
App: meta.New("."),
Plugins: []plugdeps.Plugin{
{Binary: "buffalo-pop", GoGet: "github.com/gobuffalo/buffalo-pop/v2@latest"},
{Binary: "buffalo-pop", GoGet: "github.com/gobuffalo/buffalo-pop/v3@latest"},
{Binary: "buffalo-hello.rb", Local: "./plugins/buffalo-hello.rb"},
},
})
Expand Down
2 changes: 1 addition & 1 deletion internal/genny/assets/webpack/webpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Test_Webpack_New(t *testing.T) {
"assets/js/application.js",
"package.json",
"postcss.config.js",
"public/assets/.keep",
"public/assets/keep",
"templates/application.plush.html",
"webpack.config.js",
}
Expand Down
1 change: 0 additions & 1 deletion internal/genny/build/_fixtures/coke/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ bin/
tmp/
node_modules/
.sass-cache/
*-packr.go
public/assets/
.vscode/
.grifter/
Expand Down
3 changes: 1 addition & 2 deletions internal/genny/build/_fixtures/coke/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# This is a multi-stage Dockerfile and requires >= Docker 17.05
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
FROM gobuffalo/buffalo:v0.17.7 as builder
FROM gobuffalo/buffalo:v0.18.0 as builder

ENV GO111MODULE on
ENV GOPROXY http://proxy.golang.org

RUN mkdir -p /src/coke
Expand Down
10 changes: 7 additions & 3 deletions internal/genny/build/_fixtures/coke/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Welcome to Buffalo!
# Welcome to Buffalo

Thank you for choosing Buffalo for your web development needs.

Expand All @@ -14,13 +14,17 @@ You will also need to make sure that **you** start/install the database of your

Ok, so you've edited the "database.yml" file and started your database, now Buffalo can create the databases in that file for you:

$ buffalo pop create -a
```console
buffalo pop create -a
```

## Starting the Application

Buffalo ships with a command that will watch your application and automatically rebuild the Go binary and any assets for you. To do that run the "buffalo dev" command:

$ buffalo dev
```console
buffalo dev
```

If you point your browser to [http://127.0.0.1:3000](http://127.0.0.1:3000) you should see a "Welcome to Buffalo!" page.

Expand Down
6 changes: 3 additions & 3 deletions internal/genny/build/_fixtures/coke/actions/actions_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package actions

import (
"os"
"testing"

"github.com/gobuffalo/packr/v2"
"github.com/gobuffalo/suite"
"github.com/gobuffalo/suite/v4"
)

type ActionSuite struct {
*suite.Action
}

func Test_ActionSuite(t *testing.T) {
action, err := suite.NewActionWithFixtures(App(), packr.New("Test_ActionSuite", "../fixtures"))
action, err := suite.NewActionWithFixtures(App(), os.DirFS("../fixtures"))
if err != nil {
t.Fatal(err)
}
Expand Down
Loading

0 comments on commit 56701c6

Please sign in to comment.