task

package
v0.0.0-...-bb167ce Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: EPL-1.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGrillerConf = ".griller"

DefaultGrillerConf is the name of the file a user can add to their home directory and it's name defaults to ~/.griller

Variables

View Source
var ErrGrillerDoesNotExist = errors.New("error ~/.griller does not exist")

ErrGrillerDoesNotExist occurs internally when the .griller file can not be located.

View Source
var ErrNoTemplateFiles = fmt.Errorf("no template files found error")

ErrNoTemplateFiles occurs when the template name doesn't map to any files.

View Source
var ErrTemplatePlateMissingParams = fmt.Errorf("template plate missing params error")

ErrTemplatePlateMissingParams occurs when template command is given without the rest of the required parameters.

Functions

func Generate

func Generate(conf *config.Conf) error

Generate constructs a Gen instance with the given conf and immediately call Run returning the error.

Types

type Data

type Data struct {
	PackageName string
	Remote      string
}

Data here represents a few key data points used by the generator and is exported for ease of debugging.

func (Data) String

func (d Data) String() string

String is a convenience for writing the Data instance in Json

type DotLoader

type DotLoader struct {
	Env     func(key string) (string, bool)
	DotName string
}

DotLoader is a struct used to read various 'dot' files.

func NewDotLoader

func NewDotLoader() *DotLoader

NewDotLoader creates a DotLoader that will read values from the environment and look for the DefaultGrillerConf file.

func (DotLoader) Exists

func (d DotLoader) Exists() (string, bool)

Exists checks that the griller file does indeed exist.

func (*DotLoader) Filename

func (d *DotLoader) Filename() (string, bool)

Filename joins the value of HOME and the griller file name.

func (*DotLoader) Home

func (d *DotLoader) Home() (string, bool)

Home returns the value HOME in the environment.

func (*DotLoader) Load

func (d *DotLoader) Load() error

Load injects GRILLER_DEST and GRILLDER_REMOVE in the environment from those values found in the griller file.

func (*DotLoader) Open

func (d *DotLoader) Open() (*os.File, error)

Open opens the griller file for reading.

func (*DotLoader) Read

func (d *DotLoader) Read() (*Dotfile, error)

Read parses the griller file found and deserializes into a Dotfile.

type Dotfile

type Dotfile struct {
	Remote string // example: github.com/lcaballero
	Dest   string // example: github.com/lcaballero
}

Dotfile represents a configuration file (ie .griller JSON file) can be located from the user's home directory which can provide the flag values for --dest and --remote.

For example:

{
  "Remote": "github.com/saber",
  "Dest": "$GOPATH/src/github.com/saber"
}

type Gen

type Gen struct {
	// contains filtered or unexported fields
}

Gen is project generator based on a configuration.

func NewGen

func NewGen(config *config.Conf) *Gen

NewGen allocates a Gen instance capable of producing Go project generator based on the given config.

func (*Gen) Run

func (g *Gen) Run() error

Run carries out project generation, making directories and files, returning an error if one is produced during generation.

func (*Gen) TemplateAssets

func (g *Gen) TemplateAssets() (string, []string, []string)

TemplateAssets provides those assets for the configured template name.

func (*Gen) TemplateData

func (g *Gen) TemplateData() Data

TemplateData exposes some key values from the generator for debugging purposes.

type Log

type Log struct {
	// contains filtered or unexported fields
}

Log outputs log writes when the --debug flag is present on the command line.

func NewLog

func NewLog(conf *config.Conf) *Log

NewLog requires a Conf to conditionally output logging.

func (*Log) Printf

func (g *Log) Printf(format string, args ...interface{})

Printf interpolates the values into the given format string.

func (*Log) Println

func (g *Log) Println(args ...interface{})

Println simply outputs each argument with a common separator.

Jump to

Keyboard shortcuts

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