destroy

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionCmd = &cobra.Command{
	Use: "action [name]",

	Aliases: []string{"a"},
	Short:   "Destroys action files.",
	RunE: func(cmd *cobra.Command, args []string) error {
		if _, err := os.Stat(".buffalo.dev.yml"); os.IsNotExist(err) {
			return errors.New("destroy needs to run in your buffalo project root")
		}

		if len(args) == 0 {
			return errors.New("you need to provide a valid action file name in order to destroy it")
		}

		name := args[0]

		fileName := inflect.Underscore(name)

		removeActions(fileName)
		return nil
	},
}

ActionCmd destroys passed action file

View Source
var ModelCmd = &cobra.Command{
	Use: "model [name]",

	Aliases: []string{"m"},
	Short:   "Destroys model files.",
	RunE: func(cmd *cobra.Command, args []string) error {
		if _, err := os.Stat(".buffalo.dev.yml"); os.IsNotExist(err) {
			return errors.New("destroy needs to run in your buffalo project root")
		}

		if len(args) == 0 {
			return errors.New("you need to provide a valid model name in order to destroy it")
		}

		name := args[0]
		fileName := inflect.Pluralize(inflect.Underscore(name))

		removeModel(name)
		removeMigrations(fileName)

		return nil
	},
}

ModelCmd destroys a passed model

View Source
var ResourceCmd = &cobra.Command{
	Use: "resource [name]",

	Aliases: []string{"r"},
	Short:   "Destroys resource files.",
	RunE: func(cmd *cobra.Command, args []string) error {
		if _, err := os.Stat(".buffalo.dev.yml"); os.IsNotExist(err) {
			return errors.New("destroy needs to run in your buffalo project root")
		}

		if len(args) == 0 {
			return errors.New("you need to provide a valid resource name in order to destroy it")
		}

		name := args[0]
		fileName := inflect.Pluralize(inflect.Underscore(name))

		removeTemplates(fileName)
		removeActions(fileName)
		removeLocales(fileName)
		removeModel(name)
		removeMigrations(fileName)

		return nil
	},
}

ResourceCmd destroys a passed resource

View Source
var YesToAll = false

YesToAll means not to ask when destroying but simply confirm all beforehand.

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