Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶ added in v0.1.1
type Config struct {
// Name is made available to templates.
Name string
// Host is the project host, e.g. github.com. Available in templates.
Host string
// Owner is the project owner, e.g. SCM username. Available in templates.
Owner string
// ProjectDir is the directory where project files should be written.
ProjectDir string
// Gitignore template to use for creating .gitignore. If nil, no .gitignore
// is created.
Gitignore *gitignore.Template
// License info for the open source license to use. If nil, no LICENSE file
// is created.
License *license.Info
// If Overwrite is true, existing file in the target directory that matches
// the name of one of the skeleton files is overwritten.
Overwrite bool
// OverwriteFiles can be used to selectively overwrite existing files. File
// paths must be relative to the target directory.
OverwriteFiles []string
// SkipFiles can be used to selectively skip creation of files or
// directories. File paths must be relative to the target directory.
SkipFiles []string
// Skeleton provides the files and values for the new project.
Skeleton *kickoff.Skeleton
// Values are user defined values that are merged on top of values from the
// project skeleton.
Values template.Values
}
Config holds the configuration for a new project.
type Destination ¶
type Destination struct {
// Base is the base dir of the project.
Base string
// Path is the path relative to the base dir.
Path string
}
Destination describes the destination a project file should be written to.
func (Destination) AbsPath ¶
func (d Destination) AbsPath() string
AbsPath returns the absolute file path of the destination.
func (Destination) Exists ¶
func (d Destination) Exists() bool
Exists returns true if the destination already exists.
func (Destination) RelPath ¶
func (d Destination) RelPath() string
RelPath returns the path relative to the project root.
type OpType ¶ added in v0.3.0
type OpType uint8
OpType defines the type of operation that should be performed for a given project file, template or directory.
type Operation ¶ added in v0.3.0
type Operation struct {
Type OpType
Source *kickoff.BufferedFile
Dest *Destination
}
Operation defines an operation involving a source and destination file. This is produced by a plan to review it before actually performing it.
type Plan ¶ added in v0.3.0
type Plan struct {
OpCounts map[OpType]int
Operations []*Operation
// contains filtered or unexported fields
}
Plan holds the operations to create a new project. A plan is created from a project configuration and can be inspected/printed before being applied.
func (*Plan) Apply ¶ added in v0.3.0
Apply applies the plan. It will write all necessary project files to the target directory.
func (*Plan) IsNoOp ¶ added in v0.3.0
IsNoOp returns true if the plan does not contain any operations or if there are solely skip operations.
func (*Plan) SkipsExisting ¶ added in v0.3.0
SkipsExisting returns true if the plan skips some existing files.