diff --git a/README.md b/README.md index f4317998f..0abede950 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Buffalo is "idiomatic", for whatever that is worth. The purpose of a framework i If you were to look through the Buffalo code base you'll find little code, just enough to assemble the amazing packages that other's have written into one coherent system. +> I :heart: web dev in go again - Brian Ketelsen + ## Installation ```text diff --git a/buffalo/cmd/app_generators.go b/buffalo/cmd/app_generators.go index ceefc7769..9bde54823 100644 --- a/buffalo/cmd/app_generators.go +++ b/buffalo/cmd/app_generators.go @@ -3,6 +3,7 @@ package cmd import ( "os/exec" + "github.com/markbates/buffalo/buffalo/cmd/generate" "github.com/markbates/gentronics" ) @@ -26,10 +27,11 @@ func newAppGenerator() *gentronics.Generator { g.Add(gentronics.NewCommand(goInstall("github.com/markbates/refresh"))) g.Add(gentronics.NewCommand(goGet("github.com/markbates/grift/..."))) g.Add(gentronics.NewCommand(goInstall("github.com/markbates/grift"))) - g.Add(newJQueryGenerator()) + g.Add(generate.NewJQueryGenerator()) + g.Add(generate.NewBootstrapGenerator()) g.Add(newSodaGenerator()) g.Add(gentronics.NewCommand(appGoGet())) - g.Add(gentronics.NewCommand(exec.Command("gofmt", "-w", "."))) + g.Add(generate.Fmt) return g } @@ -153,15 +155,22 @@ const nIndexHTML = `

Welcome to Buffalo!

` const nApplicationHTML = ` - Buffalo - {{ .name }} + Buffalo - {{ .titleName }} + {{if .withBootstrap -}} + + {{end -}} + {{"{{"}} yield {{"}}"}} - {{if .withJQuery -}} + {{if .withJQuery -}} - {{end -}} + {{end -}} + {{if .withBootstrap -}} + + {{end -}} diff --git a/buffalo/cmd/generate.go b/buffalo/cmd/generate.go new file mode 100644 index 000000000..a2475878d --- /dev/null +++ b/buffalo/cmd/generate.go @@ -0,0 +1,40 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package cmd + +import ( + "github.com/markbates/buffalo/buffalo/cmd/generate" + "github.com/spf13/cobra" +) + +var generateCmd = &cobra.Command{ + Use: "generate", + Aliases: []string{"g"}, +} + +func init() { + generateCmd.AddCommand(generate.JQueryCmd) + generateCmd.AddCommand(generate.RailsJSCmd) + generateCmd.AddCommand(generate.BootstrapCmd) + generateCmd.AddCommand(generate.BootswatchCmd) + generateCmd.AddCommand(generate.ResourceCmd) + RootCmd.AddCommand(generateCmd) +} diff --git a/buffalo/cmd/generate/bootstrap.go b/buffalo/cmd/generate/bootstrap.go new file mode 100644 index 000000000..3d2036320 --- /dev/null +++ b/buffalo/cmd/generate/bootstrap.go @@ -0,0 +1,75 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package generate + +import ( + "path/filepath" + + "github.com/markbates/gentronics" + "github.com/spf13/cobra" +) + +// BootstrapCmd will generate new Bootstrap files. Regardless of whatever +// other settings you might, this will generate jQuery files as that is a +// pre-requisite of Bootstrap. +var BootstrapCmd = &cobra.Command{ + Use: "bootstrap", + Short: "Generates Bootstrap 3 files", + RunE: func(cmd *cobra.Command, args []string) error { + return NewBootstrapGenerator().Run(".", gentronics.Data{ + "withBootstrap": true, + }) + }, +} + +// NewBootstrapGenerator will generate new Bootstrap files. Regardless of whatever +// other settings you might, this will generate jQuery files as that is a +// pre-requisite of Bootstrap. +func NewBootstrapGenerator() *gentronics.Generator { + should := func(data gentronics.Data) bool { + if p, ok := data["withBootstrap"]; ok { + return p.(bool) + } + return false + } + g := gentronics.New() + jf := &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "bootstrap.css"), ""), + } + jf.Should = should + jf.RemotePath = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" + g.Add(jf) + + jf = &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "bootstrap.js"), ""), + } + jf.Should = should + jf.RemotePath = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" + g.Add(jf) + g.Add(&gentronics.Func{ + Should: should, + Runner: func(rootPath string, data gentronics.Data) error { + data["withJQuery"] = true + return NewJQueryGenerator().Run(rootPath, data) + }, + }) + return g +} diff --git a/buffalo/cmd/generate/bootswatch.go b/buffalo/cmd/generate/bootswatch.go new file mode 100644 index 000000000..c0c60dccc --- /dev/null +++ b/buffalo/cmd/generate/bootswatch.go @@ -0,0 +1,88 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package generate + +import ( + "fmt" + "path/filepath" + "strings" + + "github.com/markbates/gentronics" + "github.com/spf13/cobra" +) + +// BootswatchCmd will generate new Bootswatch themes. Regardless of whatever +// other settings you have, this will generate jQuery and Bootstrap files as +// they are pre-requisites for Bootswatch +var BootswatchCmd = &cobra.Command{ + Use: "bootswatch [theme]", + Short: "Generates Bootswatch 3 files", + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return fmt.Errorf("You must choose a theme! [%s]", strings.Join(bootswatchThemes, ", ")) + } + g, err := NewBootswatchGenerator(args[0]) + if err != nil { + return err + } + return g.Run(".", gentronics.Data{ + "withBootswatch": true, + }) + }, +} + +// NewBootswatchGenerator will generate new Bootswatch themes. Regardless of whatever +// other settings you have, this will generate jQuery and Bootstrap files as +// they are pre-requisites for Bootswatch +func NewBootswatchGenerator(theme string) (*gentronics.Generator, error) { + themeFound := false + for _, t := range bootswatchThemes { + if t == theme { + themeFound = true + break + } + } + if !themeFound { + return nil, fmt.Errorf("Could not find a Bootswatch theme for %s!", theme) + } + g := gentronics.New() + g.Add(&gentronics.Func{ + Should: func(data gentronics.Data) bool { return true }, + Runner: func(rootPath string, data gentronics.Data) error { + data["withJQuery"] = true + data["withBootstrap"] = true + err := NewJQueryGenerator().Run(rootPath, data) + if err != nil { + return err + } + return NewBootstrapGenerator().Run(rootPath, data) + }, + }) + jf := &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "bootstrap.css"), ""), + } + jf.RemotePath = fmt.Sprintf("https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/%s/bootstrap.min.css", theme) + g.Add(jf) + + return g, nil +} + +var bootswatchThemes = []string{"cerulean", "cosmo", "cyborg", "darkly", "flatly", "journal", "lumen", "paper", "readable", "sandstone", "simplex", "slate", "spacelab", "superhero", "united", "yeti"} diff --git a/buffalo/cmd/generate/gofmt.go b/buffalo/cmd/generate/gofmt.go new file mode 100644 index 000000000..b0acf06b2 --- /dev/null +++ b/buffalo/cmd/generate/gofmt.go @@ -0,0 +1,20 @@ +package generate + +import ( + "os/exec" + + "github.com/markbates/gentronics" +) + +// Fmt is command that will use `goimports` if available, +// or fail back to `gofmt` otherwise. +var Fmt *gentronics.Command + +func init() { + c := "gofmt" + _, err := exec.LookPath("goimports") + if err == nil { + c = "goimports" + } + Fmt = gentronics.NewCommand(exec.Command(c, "-w", ".")) +} diff --git a/buffalo/cmd/generate/jquery.go b/buffalo/cmd/generate/jquery.go new file mode 100644 index 000000000..059317437 --- /dev/null +++ b/buffalo/cmd/generate/jquery.go @@ -0,0 +1,66 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package generate + +import ( + "path/filepath" + + "github.com/markbates/gentronics" + "github.com/spf13/cobra" +) + +// JQueryCmd will generate jQuery files. +var JQueryCmd = &cobra.Command{ + Use: "jquery", + Short: "Generates an assets/jquery.js file", + RunE: func(cmd *cobra.Command, args []string) error { + data := gentronics.Data{ + "withJQuery": true, + } + return NewJQueryGenerator().Run(".", data) + }, +} + +// NewJQueryGenerator will generate jQuery files. +func NewJQueryGenerator() *gentronics.Generator { + should := func(data gentronics.Data) bool { + if p, ok := data["withJQuery"]; ok { + return p.(bool) + } + return false + } + + g := gentronics.New() + jf := &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "jquery.js"), ""), + } + jf.Should = should + jf.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" + g.Add(jf) + + jm := &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "jquery.map"), ""), + } + jm.Should = should + jm.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.map" + g.Add(jm) + return g +} diff --git a/buffalo/cmd/generate/railjs.go b/buffalo/cmd/generate/railjs.go new file mode 100644 index 000000000..5ed88d724 --- /dev/null +++ b/buffalo/cmd/generate/railjs.go @@ -0,0 +1,51 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package generate + +import ( + "path/filepath" + + "github.com/markbates/gentronics" + "github.com/spf13/cobra" +) + +// RailsJSCmd generates the jQuery UJS file from the Rails project. +var RailsJSCmd = &cobra.Command{ + Use: "railsjs", + Short: "Generates an assets/rails.js file", + Long: `Generates the jQuery UJS file from the Rails project. +More information can be found at: +https://github.com/rails/jquery-ujs`, + RunE: func(cmd *cobra.Command, args []string) error { + return NewRailsJSGenerator().Run(".", gentronics.Data{}) + }, +} + +// NewRailsJSGenerator generates the jQuery UJS file from the Rails project. +func NewRailsJSGenerator() *gentronics.Generator { + g := gentronics.New() + jf := &gentronics.RemoteFile{ + File: gentronics.NewFile(filepath.Join("assets", "rails.js"), ""), + } + jf.RemotePath = "https://raw.githubusercontent.com/rails/jquery-ujs/master/src/rails.js" + g.Add(jf) + return g +} diff --git a/buffalo/cmd/generate/resource.go b/buffalo/cmd/generate/resource.go new file mode 100644 index 000000000..f26cf99f5 --- /dev/null +++ b/buffalo/cmd/generate/resource.go @@ -0,0 +1,146 @@ +// Copyright © 2016 Mark Bates +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package generate + +import ( + "errors" + "fmt" + "path/filepath" + + "github.com/markbates/gentronics" + "github.com/markbates/inflect" + "github.com/spf13/cobra" +) + +// ResourceCmd generates a new actions/resource file and a stub test. +var ResourceCmd = &cobra.Command{ + Use: "resource [name]", + Aliases: []string{"r"}, + Short: "Generates a new actions/resource file", + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return errors.New("You must specifiy a resource name!") + } + name := args[0] + data := gentronics.Data{ + "name": name, + "singular": inflect.Singularize(name), + "plural": inflect.Pluralize(name), + "camel": inflect.Camelize(name), + "underscore": inflect.Underscore(name), + } + return NewResourceGenerator(data).Run(".", data) + }, +} + +// NewResourceGenerator generates a new actions/resource file and a stub test. +func NewResourceGenerator(data gentronics.Data) *gentronics.Generator { + g := gentronics.New() + g.Add(gentronics.NewFile(filepath.Join("actions", fmt.Sprintf("%s.go", data["underscore"])), rAction)) + g.Add(gentronics.NewFile(filepath.Join("actions", fmt.Sprintf("%s_test.go", data["underscore"])), rActionTest)) + g.Add(Fmt) + return g +} + +var rAction = `package actions + +import "github.com/markbates/buffalo" + +type {{.camel}}Resource struct{} + +// List default implementation. Returns a 404 +func (v *{{.camel}}Resource) List(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// Show default implementation. Returns a 404 +func (v *{{.camel}}Resource) Show(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// New default implementation. Returns a 404 +func (v *{{.camel}}Resource) New(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// Create default implementation. Returns a 404 +func (v *{{.camel}}Resource) Create(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// Edit default implementation. Returns a 404 +func (v *{{.camel}}Resource) Edit(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// Update default implementation. Returns a 404 +func (v *{{.camel}}Resource) Update(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +} + +// Destroy default implementation. Returns a 404 +func (v *{{.camel}}Resource) Destroy(c buffalo.Context) error { + return c.Error(404, errors.New("resource not implemented")) +}` + +var rActionTest = `package actions_test + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_{{.camel}}Resource_List(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_Show(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_New(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_Create(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_Edit(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_Update(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} + +func Test_{{.camel}}Resource_Destroy(t *testing.T) { + r := require.New(t) + r.Fail("Not Implemented!") +} +` diff --git a/buffalo/cmd/jquery_generators.go b/buffalo/cmd/jquery_generators.go deleted file mode 100644 index fc03ff768..000000000 --- a/buffalo/cmd/jquery_generators.go +++ /dev/null @@ -1,28 +0,0 @@ -package cmd - -import "github.com/markbates/gentronics" - -func newJQueryGenerator() *gentronics.Generator { - should := func(data gentronics.Data) bool { - if p, ok := data["withJQuery"]; ok { - return p.(bool) - } - return false - } - - g := gentronics.New() - jf := &gentronics.RemoteFile{ - File: gentronics.NewFile("assets/jquery.js", ""), - } - jf.Should = should - jf.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" - g.Add(jf) - - jm := &gentronics.RemoteFile{ - File: gentronics.NewFile("assets/jquery.map", ""), - } - jm.Should = should - jm.RemotePath = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.map" - g.Add(jm) - return g -} diff --git a/buffalo/cmd/new.go b/buffalo/cmd/new.go index bb7dc9dd7..daa767395 100644 --- a/buffalo/cmd/new.go +++ b/buffalo/cmd/new.go @@ -28,6 +28,7 @@ import ( "path/filepath" "strings" + "github.com/markbates/inflect" "github.com/spf13/cobra" ) @@ -35,6 +36,7 @@ var force bool var verbose bool var skipPop bool var skipJQuery bool +var skipBootstrap bool var dbType = "postgres" var newCmd = &cobra.Command{ @@ -86,13 +88,15 @@ func genNewFiles(name, rootPath string) error { packagePath := strings.Replace(rootPath, filepath.Join(os.Getenv("GOPATH"), "src")+"/", "", 1) data := map[string]interface{}{ - "name": name, - "packagePath": packagePath, - "actionsPath": filepath.Join(packagePath, "actions"), - "modelsPath": filepath.Join(packagePath, "models"), - "withPop": !skipPop, - "withJQuery": !skipJQuery, - "dbType": dbType, + "name": name, + "titleName": inflect.Titleize(name), + "packagePath": packagePath, + "actionsPath": filepath.Join(packagePath, "actions"), + "modelsPath": filepath.Join(packagePath, "models"), + "withPop": !skipPop, + "withJQuery": !skipJQuery, + "withBootstrap": !skipBootstrap, + "dbType": dbType, } g := newAppGenerator() @@ -105,5 +109,6 @@ func init() { newCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "verbosely print out the go get/install commands") newCmd.Flags().BoolVar(&skipPop, "skip-pop", false, "skips adding pop/soda to your app") newCmd.Flags().BoolVar(&skipJQuery, "skip-jquery", false, "skips adding jQuery to your app") + newCmd.Flags().BoolVar(&skipBootstrap, "skip-bootstrap", false, "skips adding Bootstrap to your app") newCmd.Flags().StringVar(&dbType, "db-type", "postgres", "specify the type of database you want to use [postgres, mysql, sqlite3]") } diff --git a/buffalo/cmd/soda_generators.go b/buffalo/cmd/soda_generators.go index e9c1efcb1..3b15422b6 100644 --- a/buffalo/cmd/soda_generators.go +++ b/buffalo/cmd/soda_generators.go @@ -30,7 +30,8 @@ func newSodaGenerator() *gentronics.Generator { g.Add(&gentronics.Func{ Should: should, Runner: func(rootPath string, data gentronics.Data) error { - generate.GenerateConfig(data["dbType"].(string), "./database.yml") + data["dialect"] = data["dbType"] + generate.GenerateConfig("./database.yml", data) return nil }, }) diff --git a/buffalo/cmd/version.go b/buffalo/cmd/version.go index 32ddf5c06..26dfc032e 100644 --- a/buffalo/cmd/version.go +++ b/buffalo/cmd/version.go @@ -1,4 +1,4 @@ package cmd // Version is the current version of the buffalo binary -var Version = "0.4.3.1" +var Version = "0.4.4"