generate

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionCmd = &cobra.Command{
	Use:     "action [name] [handler name...]",
	Aliases: []string{"a", "actions"},
	Short:   "Generates new action(s)",
	RunE: func(cmd *cobra.Command, args []string) error {
		a, err := action.New(args...)
		if err != nil {
			return errors.WithStack(err)
		}
		a.SkipTemplate = actionOptions.SkipTemplate
		a.Method = actionOptions.Method

		data := makr.Data{}

		return a.Run(".", data)
	},
}

ActionCmd is the cmd that generates actions.

View Source
var DockerCmd = &cobra.Command{
	Use:   "docker",
	Short: "Generates a Dockerfile",
	RunE: func(cmd *cobra.Command, args []string) error {
		dockerOptions.Version = Version
		return dockerOptions.Run(".", makr.Data{})
	},
}

DockerCmd generates a new Dockerfile

View Source
var MailCmd = &cobra.Command{
	Use:   "mailer [name]",
	Short: "Generates a new mailer for Buffalo",
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			return errors.New("you must supply a name for your mailer")
		}
		mailer.App = meta.New(".")
		mailer.Name = inflect.Name(args[0])
		data := makr.Data{}
		return mailer.Run(".", data)

	},
}

MailCmd for generating mailers

View Source
var ResourceCmd = &cobra.Command{
	Use:     "resource [name]",
	Example: resourceExamples,
	Aliases: []string{"r"},
	Short:   "Generates a new actions/resource file",
	RunE: func(cmd *cobra.Command, args []string) error {
		o, err := resource.New(resourceOptions.Name, args...)
		if err != nil {
			return errors.WithStack(err)
		}
		o.SkipModel = resourceOptions.SkipModel
		o.SkipMigration = resourceOptions.SkipMigration
		o.SkipTemplates = resourceOptions.SkipTemplates
		if resourceOptions.ModelName != "" {
			o.UseModel = true
			o.Model = inflect.Name(resourceOptions.ModelName)
		}

		if err := o.Validate(); err != nil {
			return err
		}

		return o.Run(".", makr.Data{})
	},
}

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

View Source
var TaskCmd = &cobra.Command{
	Use:     "task [name]",
	Aliases: []string{"t", "grift"},
	Short:   "Generates a grift task",
	RunE: func(cmd *cobra.Command, args []string) error {
		g, err := grift.New(args...)
		if err != nil {
			return errors.WithStack(err)
		}
		return g.Run(".", makr.Data{})
	},
}

TaskCmd is the command called with the generate grift cli.

View Source
var Version string

Version is set by the cmd package, to all the generate package to have this information withouth cyclical deps

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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