config

package
Version: v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2014 License: BSD-2-Clause Imports: 8 Imported by: 1

README

##About gonew/config

Gonew/config uses a json configuration. There is an example file in the base repository.

##Documentation

Because gonew/config serializes structs for its configuration, its most convenient to read the documentation with godoc or on godoc.org.

##Points of interest

###Templates

Project file templates are specified in your config file. Each file specified a list of templates (excluding license templates) which compose the file. These templates are found in either one of the "ExternalTemplates" directories specified in your config file, or in templates directory hierarchy.

###Hooks

Gonew can be fully integrated with version control systems like git and mercurial, as well as with hosts like Github and Google Code by using "Pre" and "Post" hooks in your configuration file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Defaults

type Defaults struct {
	Environment string // The default environment to use from the command line
	Project     string // The default project to use from the command line
}

type Environment

type Environment struct {
	BaseImportPath string                 // Base import path for templates
	Inherits       []string               // Environments to inherit configs from
	User           *EnvironmentUserConfig // User info for templates
}

Specifies the environment for template generation.

func (*Environment) Merge

func (config *Environment) Merge(other *Environment)

Merges other into config. Inherits are not merged, as this is used to eliminate inheritence.

func (*Environment) Validate

func (config *Environment) Validate() (err error)

Requires a User.

type EnvironmentUserConfig

type EnvironmentUserConfig struct {
	Name  string // A real name or pseudonym
	Email string // An email address (potentially malformed)
}

User (project author) details. All fields are optional.

func (*EnvironmentUserConfig) Merge

func (config *EnvironmentUserConfig) Merge(other *EnvironmentUserConfig)

type Environments

type Environments map[string]*Environment

A set of uniquely named environments.

func (Environments) Validate

func (config Environments) Validate() (err error)

Validates the following for each environment

  • The name must not contain spaces
  • The environment must be valid (see Environment.Validate)
  • All inherited environments must exist.

type ExternalTemplate

type ExternalTemplate string

func (ExternalTemplate) Validate

func (config ExternalTemplate) Validate() (err error)

type Gonew

type Gonew struct {
	Default           Defaults
	Environments      Environments
	ExternalTemplates []ExternalTemplate
	Projects          Projects
}

func (Gonew) Environment

func (config Gonew) Environment(name string) (*Environment, error)

func (*Gonew) MarshalFileJSON

func (config *Gonew) MarshalFileJSON(filename string) error

func (Gonew) Project

func (config Gonew) Project(name string) (*Project, error)

func (*Gonew) UnmarshalFileJSON

func (config *Gonew) UnmarshalFileJSON(filename string) error

func (Gonew) Validate

func (config Gonew) Validate() (err error)

type HookConfig

type HookConfig struct {
	Cwd      string   // The working directory Cammonds should be executed from.
	Commands []string // A list of commands executed in order.
}

func (*HookConfig) Merge

func (config *HookConfig) Merge(other *ProjectHooksConfig)

type Project

type Project struct {
	Inherits []string                      // Projects to inherit config from
	Hooks    *ProjectHooksConfig           // Hooks that run at specific times
	Files    map[string]*ProjectFileConfig // Project file specifications
}

func (*Project) Merge

func (config *Project) Merge(other *Project)

func (*Project) Validate

func (config *Project) Validate() (err error)

type ProjectFileConfig

type ProjectFileConfig struct {
	Path      string   // a template
	Type      string   // a 'filetype' that can be used in templates
	Templates []string // template names
}

func (*ProjectFileConfig) Merge

func (config *ProjectFileConfig) Merge(other *ProjectFileConfig)

type ProjectHooksConfig

type ProjectHooksConfig struct {
	Pre  []*HookConfig // Hooks that run before the project is generated.
	Post []*HookConfig // Hooks that run after the project is generated.
}

func (*ProjectHooksConfig) Merge

func (config *ProjectHooksConfig) Merge(other *ProjectHooksConfig)

type Projects

type Projects map[string]*Project

A set of uniquely named project types.

func (Projects) Validate

func (config Projects) Validate() (err error)

Validates the following for each project

  • The name must not contain spaces
  • The environment must be valid (see Environment.Validate)
  • All inherited environments must exist.

Jump to

Keyboard shortcuts

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