~foosoft/goldsmith

5bd898f11f89b8b9bbb029cb25dcd61aeb3d622c — Alex Yatskov 9 years ago 619e3df
WIP
4 files changed, 18 insertions(+), 11 deletions(-)

M cmd/main.go
M file.go
M goldsmith.go
M types.go
M cmd/main.go => cmd/main.go +7 -1
@@ 22,7 22,13 @@

package main

import _ "github.com/FooSoft/goldsmith"
import (
	"github.com/FooSoft/goldsmith"
	_ "github.com/FooSoft/goldsmith-plugins/markdown"
)

func main() {
	gs := goldsmith.NewGoldsmith("/home/alex/projects/website/content/src")
	// gs.Apply(markdown.NewMarkdown()).Complete("/home/alex/projects/test")
	gs.Complete("/home/alex/projects/test")
}

M file.go => file.go +6 -2
@@ 42,9 42,13 @@ func (f *file) SetPath(path string) {
	f.path = path
}

func (f *file) Property(key string) (interface{}, bool) {
func (f *file) Property(key, def string) interface{} {
	value, ok := f.meta[key]
	return value, ok
	if ok {
		return value
	}

	return def
}

func (f *file) SetProperty(key string, value interface{}) {

M goldsmith.go => goldsmith.go +3 -6
@@ 38,13 38,10 @@ type goldsmith struct {
	files  chan File
}

func NewGoldsmith(path string) (Goldsmith, error) {
func NewGoldsmith(path string) Goldsmith {
	gs := new(goldsmith)
	if err := gs.scan(path); err != nil {
		return nil, err
	}

	return gs, nil
	gs.scan(path)
	return gs
}

func (gs *goldsmith) scan(path string) error {

M types.go => types.go +2 -2
@@ 32,7 32,7 @@ type File interface {
	Path() string
	SetPath(path string)

	Property(key string) (interface{}, bool)
	Property(key, def string) interface{}
	SetProperty(key string, value interface{})

	Error() error


@@ 42,7 42,7 @@ type File interface {
}

type Processor interface {
	Process(ctx Context, input chan File, output chan File) error
	Process(ctx Context, input, output chan File)
}

type Goldsmith interface {

Do not follow this link