Commit graph

109 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
57c347e4cc hugofs: Fix GoDoc 2016-04-07 13:56:11 +02:00
Bjørn Erik Pedersen
c6c2c689d6 hugofs: Add missing not nil checks to tests 2016-04-02 01:23:12 +02:00
Bjørn Erik Pedersen
4f66f790b1 Add readFile template func
This also includes a refactor of the hugofs package and its usage.

The motivation for that is:

The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)

Fixes #1551
2016-03-31 21:24:18 +02:00
Bjørn Erik Pedersen
e445c35d6a Fix copyright headers in source files
Still need to add some missing headers and an AUTHORS file.

See #1646
2015-12-07 19:57:01 +01:00
Steve Francia
f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05:00
spf13
df824fa31b Hugo server renders and serves from memory by default (30%+ improvement) 2015-11-16 22:00:11 -05:00
bep
be8c067577 Add support for Ace base and inner templates
Fixes #994
Fixes #511
2015-03-26 17:22:35 +01:00
spf13
4b9ea105c2 Setting to filesystems to the afero.fs interface so can be easily swapped out. 2014-11-04 00:30:35 -05:00
spf13
141f3e19e0 Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00