generate

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2016 License: MIT, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Fmt is command that will use `goimports` if available, or fail back to `gofmt` otherwise.

View Source
var GothCmd = &cobra.Command{
	Use:   "goth [provider provider...]",
	Short: "Generates a actions/goth.go file configured to the specified providers.",
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			return errors.New("You must specifiy at least one provider!")
		}
		return NewGothGenerator().Run(".", gentronics.Data{
			"providers": args,
		})
	},
}

GothCmd generates a actions/goth.go file configured to the specified providers.

View Source
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),
			"under":    inflect.Underscore(name),
			"actions":  []string{"List", "Show", "New", "Create", "Edit", "Update", "Destroy"},
		}
		return NewResourceGenerator(data).Run(".", data)
	},
}

ResourceCmd generates a new actions/resource file and a stub test.

View Source
var WebpackCmd = &cobra.Command{
	Use:   "webpack",
	Short: "Generates a webpack asset pipeline.",
	RunE: func(cmd *cobra.Command, args []string) error {
		data := gentronics.Data{
			"withWebpack": true,
		}
		return NewWebpackGenerator(data).Run(".", data)
	},
}

WebpackCmd generates a new actions/resource file and a stub test.

Functions

func NewGothGenerator added in v0.4.7

func NewGothGenerator() *gentronics.Generator

NewGothGenerator a actions/goth.go file configured to the specified providers.

func NewResourceGenerator

func NewResourceGenerator(data gentronics.Data) *gentronics.Generator

NewResourceGenerator generates a new actions/resource file and a stub test.

func NewWebpackGenerator added in v0.5.0

func NewWebpackGenerator(data gentronics.Data) *gentronics.Generator

NewWebpackGenerator generates a new actions/resource file and a stub test.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL