compose

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const Asciidoc = "ASCIIDOC"

Asciidoc is a const for identifying Asciidoc Documents

View Source
const Markdown = "MARKDOWN"

Markdown is a const for identifying Markdown Documents

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandLineSettings added in v0.0.11

type CommandLineSettings struct {
	// ConfigFilePath is the path to the Monako config
	ConfigFilePath string
	// MenuConfigFilePath is the path to the Menu config
	MenuConfigFilePath string
	// ContentWorkingDir is the directory where files should be created. Home of the compose folder.
	ContentWorkingDir string
	// BaseURL is the BaseURL of the site
	BaseURL string
	// Trace activates function name based logging
	Trace bool
	// ShowVersion shows the current version and exists
	ShowVersion bool
	// FailOnHugoError will fail Monako when there are Hugo errors during build
	FailOnHugoError bool
	// OnlyCompose will only compose files but not generate HTML
	OnlyCompose bool
	// OnlyRender will only render HTML files but not compose them
	OnlyRender bool
}

CommandLineSettings contains all the flags and settings made via the command line in main

type Config

type Config struct {
	BaseURL       string   `yaml:"baseURL"`
	Title         string   `yaml:"title"`
	Origins       []Origin `yaml:"origins"`
	FileWhitelist []string `yaml:"whitelist"`
	FileBlacklist []string `yaml:"blacklist"`

	DisableCommitInfo bool `yaml:"disableCommitInfo"`

	// HugoWorkingDir is the working dir for the Composition. For example "your/dir/compose"
	HugoWorkingDir string

	// ContentWorkingDir is the main working dir and where all the content is stored in. For example "your/dir/"
	ContentWorkingDir string
}

Config is the root of the Monako config

func Init added in v0.0.11

func Init(cliSettings CommandLineSettings) (config *Config)

Init loads the Monako config, adds Workarounds, runs Hugo for initializing the working directory

func LoadConfig

func LoadConfig(configfilepath string, workingdir string) (config *Config, err error)

LoadConfig returns the Monako config from the given configfilepath

func (*Config) CleanUp

func (config *Config) CleanUp()

CleanUp removes the compose folder

func (*Config) Compose

func (config *Config) Compose() error

Compose builds the Monako directory structure

func (*Config) Generate added in v0.0.12

func (config *Config) Generate() error

Generate runs Hugo on the composed Monako source

type Origin

type Origin struct {
	URL           string   `yaml:"src"`
	Branch        string   `yaml:"branch,omitempty"`
	EnvUsername   string   `yaml:"envusername,omitempty"`
	EnvPassword   string   `yaml:"envpassword,omitempty"`
	SourceDir     string   `yaml:"docdir,omitempty"`
	TargetDir     string   `yaml:"targetdir,omitempty"`
	FileWhitelist []string `yaml:"whitelist,omitempty"`
	FileBlacklist []string `yaml:"blacklist,omitempty"`

	Files []OriginFile
	// contains filtered or unexported fields
}

Origin contains all information for a document origin

func NewOrigin

func NewOrigin(url string, branch string, sourceDir string, targetDir string) *Origin

NewOrigin returns a new origin with all needed fields

func (*Origin) CloneDir

func (origin *Origin) CloneDir() (filesystem billy.Filesystem, err error)

CloneDir clones a HTTPS or lokal Git repository with the given branch and optional username and password. A virtual filesystem is returned containing the cloned files.

func (*Origin) ComposeDir

func (origin *Origin) ComposeDir(filesystem billy.Filesystem) error

ComposeDir copies a subdir of a virtual filesystem to a target in the local relative filesystem. The copied files can be limited by a whitelist. The Git repository is used to obtain Git commit information

type OriginFile

type OriginFile struct {

	// Commit is the commit info about this file
	Commit *OriginFileCommit
	// RemotePath is the path in the origin repository
	RemotePath string
	// LocalPath is the absolute path on the local disk
	LocalPath string
	// contains filtered or unexported fields
}

OriginFile represents a single file of an origin

func (*OriginFile) ExpandFrontmatter added in v0.0.11

func (file *OriginFile) ExpandFrontmatter(content string) (expandedFrontmatter string, err error)

ExpandFrontmatter expands the existing frontmatter with the parameters given

func (*OriginFile) GetFormat

func (file *OriginFile) GetFormat() string

GetFormat determines the markup format of a file by it's filename. Results can be Markdown and Asciidoc

type OriginFileCommit added in v0.0.14

type OriginFileCommit struct {
	Hash   string
	Author OriginFileCommitter
	Date   time.Time
}

OriginFileCommit represents a commit

type OriginFileCommitter added in v0.0.14

type OriginFileCommitter struct {
	Name  string
	Email string
}

OriginFileCommitter represents the committer of a commit

Jump to

Keyboard shortcuts

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