create: Refactor NewContent to be testable

NewContent is refactored to use the afero.Fs interface that should allow
full testing.  This commit also pulls the metadata creation logic out of
NewContent and into a separate function to decrease the cyclomatic
complexity of NewContent.
This commit is contained in:
Cameron Moore 2016-03-17 13:30:33 -05:00 committed by Bjørn Erik Pedersen
parent bafb77172b
commit 9323707b32
3 changed files with 197 additions and 55 deletions

View file

@ -110,8 +110,7 @@ func NewContent(cmd *cobra.Command, args []string) error {
kind = contentType
}
return create.NewContent(kind, createpath)
return create.NewContent(hugofs.SourceFs, kind, createpath)
}
func doNewSite(basepath string, force bool) error {