Big refactor of how source files are used. Also added default destination extension option.

This commit is contained in:
spf13 2014-10-16 20:20:09 -04:00
parent 24bbfe7d32
commit 5dfc1dedb8
24 changed files with 646 additions and 465 deletions

View file

@ -3,17 +3,15 @@ package source
import (
"bytes"
"fmt"
"path"
)
type ByteSource struct {
Name string
Content []byte
Section string
}
func (b *ByteSource) String() string {
return fmt.Sprintf("%s %s %s", b.Name, b.Section, string(b.Content))
return fmt.Sprintf("%s %s", b.Name, string(b.Content))
}
type InMemorySource struct {
@ -23,12 +21,7 @@ type InMemorySource struct {
func (i *InMemorySource) Files() (files []*File) {
files = make([]*File, len(i.ByteSource))
for i, fake := range i.ByteSource {
files[i] = &File{
LogicalName: fake.Name,
Contents: bytes.NewReader(fake.Content),
Section: fake.Section,
Dir: path.Dir(fake.Name),
}
files[i] = NewFileWithContents(fake.Name, bytes.NewReader(fake.Content))
}
return
}