themekit: github.com/Shopify/themekit/src/file Index | Files

package file

import "github.com/Shopify/themekit/src/file"

Index

Package Files

filter.go hash.go path.go watcher.go

type Event Uses

type Event struct {
    Op   Op
    Path string
    // contains filtered or unexported fields
}

Event decsribes a file change event

type Filter Uses

type Filter struct {
    // contains filtered or unexported fields
}

Filter matches filepaths to a list of patterns

func NewFilter Uses

func NewFilter(rootDir string, patterns []string, files []string) (Filter, error)

NewFilter will create a new file path filter

func (Filter) Match Uses

func (f Filter) Match(path string) bool

Match will return true if the file path has matched a pattern in this filter

type Op Uses

type Op int

Op describes the different types of file operations

const (
    // Update is a file op where the file is updated
    Update Op  = iota
    // Remove is a file op where the file is removed
    Remove
)

type Watcher Uses

type Watcher struct {
    Events chan Event
    // contains filtered or unexported fields
}

Watcher is the object used to watch files for change and notify on any events, these events can then be passed along to kit to be sent to shopify.

func NewWatcher Uses

func NewWatcher(e *env.Env, configPath string) (*Watcher, error)

NewWatcher will create a new file change watching for a a given directory defined in an environment

func (*Watcher) Stop Uses

func (w *Watcher) Stop()

Stop will stop the Watcher from watching it's directories and clean up any go routines doing work.

func (*Watcher) Watch Uses

func (w *Watcher) Watch()

Watch will start the watcher actually receiving file change events and sending events to the Events channel

Package file imports 12 packages (graph) and is imported by 2 packages. Updated 2019-09-21. Refresh now. Tools for package owners.