storage

package
v0.0.0-...-536613a Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2016 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyConfig = "_config.yml"
	KeyPages  = "_pages.md"
	KeySites  = "_sites.md"
	KeyReadme = "README.md"

	PrefixLogs     = "_logs"
	PrefixPosts    = "_posts"
	PrefixIncludes = "_includes"
	PrefixLayouts  = "_layouts"
	PrefixSections = "_sections"
)

system const

View Source
const (
	ExtHTML = ".html"
	ExtMD   = ".md"
	ExtCSS  = ".css"
	ExtJS   = ".js"
	ExtPNG  = ".png"
)

system file or folder names

Variables

This section is empty.

Functions

func PostProcessing

func PostProcessing(parsedContent string) string

PostProcessing add additional content to html

Types

type Parser

type Parser struct {
	Owner   string
	Name    string
	Path    string
	Storage Storage
	Config  *get3w.Config
	Sites   []*get3w.Site

	Default *get3w.Site
	Current *get3w.Site
	// contains filtered or unexported fields
}

Parser contains attributes and operations of the app

func NewLocalParser

func NewLocalParser(owner, contextDir string) (*Parser, error)

NewLocalParser return local site

func NewS3Parser

func NewS3Parser(bucketSource, bucketDestination, owner, name string) (*Parser, error)

NewS3Parser returns a new s3 site

func (*Parser) APILoad

func (parser *Parser) APILoad()

APILoad load resources for each site

func (*Parser) APISave

func (parser *Parser) APISave(payloads []*get3w.SavePayload) error

APISave returns true if the file is local only

func (*Parser) Build

func (parser *Parser) Build(copy bool) error

Build all pages in the app.

func (*Parser) DeletePage

func (parser *Parser) DeletePage(summary *get3w.PageSummary) error

DeletePage delete page file

func (*Parser) EachSite

func (parser *Parser) EachSite(callback func())

EachSite trigger callback in each site

func (*Parser) GetPosts

func (parser *Parser) GetPosts(path string) []*get3w.Post

GetPosts get site's posts

func (*Parser) IsLocalFile

func (parser *Parser) IsLocalFile(file *get3w.File) bool

IsLocalFile returns true if the file is local only

func (*Parser) LoadBasicFiles

func (parser *Parser) LoadBasicFiles()

LoadBasicFiles load resources for each site

func (*Parser) LoadSiteLayouts

func (parser *Parser) LoadSiteLayouts()

LoadSiteLayouts load layouts for current site

func (*Parser) LoadSitePageSummaries

func (parser *Parser) LoadSitePageSummaries()

LoadSitePageSummaries load summary summaries for current site

func (*Parser) LoadSitePages

func (parser *Parser) LoadSitePages()

LoadSitePages load pages for current site

func (*Parser) LoadSiteParameters

func (parser *Parser) LoadSiteParameters()

LoadSiteParameters load parameters for current site

func (*Parser) LoadSitePosts

func (parser *Parser) LoadSitePosts()

LoadSitePosts load posts for current site

func (*Parser) LoadSiteSectionsFromDir

func (parser *Parser) LoadSiteSectionsFromDir()

LoadSiteSectionsFromDir load sections for _sections directory

func (*Parser) LoadSiteSectionsFromPages

func (parser *Parser) LoadSiteSectionsFromPages(pages []*get3w.Page)

LoadSiteSectionsFromPages load sections for pages

func (*Parser) LogError

func (parser *Parser) LogError(pageURL string, err error)

LogError write content to log file

func (*Parser) LogWarn

func (parser *Parser) LogWarn(templateURL, pageURL, warning string)

LogWarn write content to log file

func (*Parser) Push

func (parser *Parser) Push(authConfig *home.AuthConfig, out io.Writer) (shouldLogin bool, err error)

Push local to cloud.

func (*Parser) WriteConfig

func (parser *Parser) WriteConfig() error

WriteConfig write content to config file

func (*Parser) WritePage

func (parser *Parser) WritePage(page *get3w.Page) error

WritePage write content to page file

type Storage

type Storage interface {
	GetRootPrefix(prefix ...string) string
	GetRootKey(url ...string) string
	GetSourcePrefix(prefix ...string) string
	GetSourceKey(url ...string) string
	GetDestinationPrefix(prefix ...string) string
	GetDestinationKey(url ...string) string
	Read(key string) ([]byte, error)
	Checksum(key string) (string, error)
	Write(key string, bs []byte) error
	WriteDestination(key string, bs []byte) error
	Download(key, downloadURL string) error
	Rename(owner, newName string, deleteAll bool) error
	CopyToDestination(sourceKey, destinationKey string) error
	Delete(key string) error
	DeleteDestination(key string) error
	GetFiles(prefix string) ([]*get3w.File, error)
	GetAllFiles(prefix string) ([]*get3w.File, error)
	IsExist(key string) bool
	DeleteFolder(prefix string) error
	NewFolder(prefix string) error
}

Storage contains methods of storage operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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