generate

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2016 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
		})
	},
}

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.

View Source
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,
		})
	},
}

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

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

View Source
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)
	},
}

JQueryCmd will generate jQuery files.

View Source
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{})
	},
}

RailsJSCmd generates the jQuery UJS file from the Rails project.

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),
			"underscore": inflect.Underscore(name),
		}
		return NewResourceGenerator(data).Run(".", data)
	},
}

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

Functions

func NewBootstrapGenerator

func NewBootstrapGenerator() *gentronics.Generator

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 NewBootswatchGenerator

func NewBootswatchGenerator(theme string) (*gentronics.Generator, error)

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 NewJQueryGenerator

func NewJQueryGenerator() *gentronics.Generator

NewJQueryGenerator will generate jQuery files.

func NewRailsJSGenerator

func NewRailsJSGenerator() *gentronics.Generator

NewRailsJSGenerator generates the jQuery UJS file from the Rails project.

func NewResourceGenerator

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

NewResourceGenerator 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