compose

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 17 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 Config

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

	// HugoWorkingDir is the working dir for the Composition
	HugoWorkingDir string

	// ContentWorkingDir is the main working dir and where all the content is stored in
	ContentWorkingDir string
}

Config is the root of the Monako config

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()

Compose builds the Monako directory structure

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"`

	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()

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()

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

func (*Origin) GetCommitInfo

func (origin *Origin) GetCommitInfo(filename string) (*object.Commit, error)

GetCommitInfo returns the Commit Info for a given file of the repository identified by it's filename

type OriginFile

type OriginFile struct {

	// Commit is the commit info about this file
	Commit *object.Commit
	// 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) GetFormat

func (file OriginFile) GetFormat() string

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

Jump to

Keyboard shortcuts

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