brogger

package
v0.0.0-...-68d4356 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2015 License: BSD-3-Clause, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "v0.0.2"
	// JSONIndentCount how many spaces to indent the config file
	JSONIndentCount = 3
)
View Source
const (
	DebugVerbosity = "debug"
	WatchVerbosity = "watch"
	InfoVerbosity  = "info"
	WarnVerbosity  = "warn"
	ErrorVerbosity = "error"
)

Verbosity levels accepted by brog

View Source
const (
	// ConfigFilename where to find the Brog config file.
	ConfigFilename = "brog_config.json"
)

Variables

View Source
var (
	DefaultProdPort         = "80"
	DefaultDevelPort        = "3000"
	DefaultHostname         = "localhost"
	DefaultMaxCPUs          = runtime.NumCPU()
	DefaultTemplatePath     = "templates" + string(os.PathSeparator)
	DefaultPostPath         = "posts" + string(os.PathSeparator)
	DefaultPagePath         = "pages" + string(os.PathSeparator)
	DefaultAssetPath        = "assets" + string(os.PathSeparator)
	DefaultPostFileExt      = ".md"
	DefaultPidFilename      = "brog.pid"
	DefaultLogFilename      = "brog.log"
	DefaultLogVerbosity     = "watch"
	DefaultConsoleVerbosity = "watch"
	DefaultRewriteInvalid   = true  // True so that brog has stable default
	DefaultRewriteMissing   = true  // True so that brog has stable default
	DefaultMultilingual     = false // False because blogs are usually unilingual
	DefaultLanguages        = []string{"en"}
)

Defaults for Brog's configuration.

Functions

func CopyBlankToFilename

func CopyBlankToFilename(conf *Config, filename string, filenamepath string) error

CopyBlankToFilename creates a blank post at the given filename, under the asset path specified by conf

func CopyBrogBinaries

func CopyBrogBinaries() []error

CopyBrogBinaries writes the in-memory brog assets to the current working directory, effectively creating a brog structure that `brog server` can use to serve content.

Types

type Brog

type Brog struct {
	Config *Config
	Pid    int
	// contains filtered or unexported fields
}

Brog loads its configuration file, provide logging facility, serves brog posts and watches for changes in posts and templates.

func PrepareBrog

func PrepareBrog(isProd bool) (*Brog, error)

PrepareBrog creates a Brog instance, loading it's configuration from a file named `ConfigFilename` that must lie at the current working directory. It creates a logging file at the location specified in the config file. If anything goes wrong during that process, it will return an error explaining where it happened.

func (*Brog) Close

func (b *Brog) Close() error

Close ensures that all brog's resources are closed and released.

func (Brog) Debug

func (l Brog) Debug(format string, args ...interface{})

func (Brog) Err

func (l Brog) Err(format string, args ...interface{})

func (*Brog) HandleFunc

func (b *Brog) HandleFunc(path string, h http.HandlerFunc)

func (*Brog) ListenAndServe

func (b *Brog) ListenAndServe() error

ListenAndServe starts watching the path specified in `ConfigFilename` for changes and starts serving brog's content, again according to the settings in `ConfigFilename`.

func (Brog) Ok

func (l Brog) Ok(format string, args ...interface{})

func (Brog) Warn

func (l Brog) Warn(format string, args ...interface{})

func (Brog) Watch

func (l Brog) Watch(format string, args ...interface{})

type Config

type Config struct {
	ProdPort         string   `json:"prodPort"`
	DevelPort        string   `json:"develPort"`
	Hostname         string   `json:"hostName"`
	MaxCPUs          int      `json:"maxCpus"`
	TemplatePath     string   `json:"templatePath"`
	PostPath         string   `json:"postPath"`
	PagePath         string   `json:"pagePath"`
	AssetPath        string   `json:"assetPath"`
	PostFileExt      string   `json:"postFileExtension"`
	PidFilename      string   `json:"pidFilename"`
	LogFilename      string   `json:"logFilename"`
	LogFileVerbosity string   `json:"logFileVerbosity"`
	ConsoleVerbosity string   `json:"consoleVerbosity"`
	RewriteInvalid   bool     `json:"rewriteInvalid"`
	RewriteMissing   bool     `json:"rewriteMissing"`
	Multilingual     bool     `json:"multilingual"`
	Languages        []string `json:"languages"`
}

Config contains all the settings that a Brog uses to watch and create and serve posts, log events and execute in general.

Jump to

Keyboard shortcuts

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