summaryrefslogtreecommitdiffstats
path: root/cache/filecache
AgeCommit message (Collapse)Author
2023-06-19all: Fix typos in function names and commentsOleksandr Redko
2023-06-18Replace the old log setup, with structured logging etc.Bjørn Erik Pedersen
Fixes #11124
2023-05-18Allow empty params.mainSectionsBjørn Erik Pedersen
Updates #10953
2023-05-16Create a struct with all of Hugo's config optionsBjørn Erik Pedersen
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
2023-03-04cache: Fix --gc failure on WindowsOleksandr Redko
Fixes "Error: failed to prune cache" on Windows and removes work around from ec1c97e7e9d62ce5245135e0906fdedf14af0cae. Follows #10781.
2023-03-04Work around --gc failure on Windows <= 10Bjørn Erik Pedersen
This applies two related fixes/improvements: * The --gc now keeps empty `_resources/_gen/images` etc folders, even if empty. This should have been the behaviour from the start. * Also, if removal of an empty dir on Windows fails with the "used by another process" error, just ignore it for now. Fixes #10781
2023-03-02Correct typos in Go commentsOleksandr Redko
2023-03-01Replace deprecated ioutil with io and osOleksandr Redko
https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
2022-12-14Also consider wrapped errors when checking for file IsNotExist errorsBjørn Erik Pedersen
Fixes #10534
2022-05-09Revise the use of htime.Since/htime.NowBjørn Erik Pedersen
We cannot (also, it doesn't add any value) use that when the `clock` is set, * To measure time (before that global is set) * To compare file timestamps re cache eviction Fixes #9868
2022-05-08Add `clock` cli flagsatotake
Close #8787
2022-05-06Improve error messages, esp. when the server is runningBjørn Erik Pedersen
* Add file context to minifier errors when publishing * Misc fixes (see issues) * Allow custom server error template in layouts/server/error.html To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go. Fixes #9852 Fixes #9857 Fixes #9863
2022-04-08Rework the Destination filesystem to make --renderStaticToDisk workBjørn Erik Pedersen
See #9626
2021-12-10Remove the retries on error in remote resources.GetBjørn Erik Pedersen
Fixes #9271 See #9259
2021-12-02resources: Add timeout to the HTTP request in GetBjørn Erik Pedersen
Workaround for https://github.com/golang/go/issues/49366
2021-12-02Add a remote retry for resources.GetBjørn Erik Pedersen
2021-12-02Make resources.Get use a file cache for remote resourcesPaul van Brouwershaven
Closes #9228
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-09-10modules: Add noVendor to module configBjørn Erik Pedersen
Fixes #7647
2020-02-19commands: Add "hugo mod verify"Bjørn Erik Pedersen
See #6907
2019-11-25resources/images: Make the image cache more robustBjørn Erik Pedersen
Also allow timeout to be set as a duration string, e.g. `30s`. Fixes #6501
2019-10-21cache/filecache: Recover from file corruptionBjørn Erik Pedersen
Fixes #6401
2019-09-12filecache: Ignore "does not exist" errors in pruneBjørn Erik Pedersen
Fixes #6326 Fixes #5745
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-07-30Fix Jekyll importBjørn Erik Pedersen
Fixes #6131
2019-07-26Revert "cache/filecache: Skip resource cache init if the fs is missing"Bjørn Erik Pedersen
I need to revisit this. This reverts commit da4c4a7789d403af3f4f4fdd5dfd3327535e4050.
2019-07-26cache/filecache: Skip resource cache init if the fs is missingBjørn Erik Pedersen
Fixes #6113
2019-07-25Block symlink dir traversal for /staticBjørn Erik Pedersen
This is in line with how it behaved before, but it was lifted a little for the project mount for Hugo Modules, but that could create hard-to-detect loops.
2019-07-24Add Hugo ModulesBjørn Erik Pedersen
This commit implements Hugo Modules. This is a broad subject, but some keywords include: * A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project. * A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects. * Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running. * Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions. * A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`. All of the above is backed by Go Modules. Fixes #5973 Fixes #5996 Fixes #6010 Fixes #5911 Fixes #5940 Fixes #6074 Fixes #6082 Fixes #6092
2019-03-24all: Apply staticcheck recommendationsBjørn Erik Pedersen
2019-03-23Run gofmt -sBjørn Erik Pedersen
2018-12-04cache/filecache: Simplify testBjørn Erik Pedersen
See #5497
2018-12-04cache/filecache: Use OS fs for testBjørn Erik Pedersen
See #5497
2018-11-28Remove duplicate mapstructure depdendencyBjørn Erik Pedersen
2018-11-23Handle themes in the new file cache (for images, assets)Bjørn Erik Pedersen
In the newly consolidated file cache implementation, we forgot that we also look in the theme(s) for assets (SCSS transformations etc.), which is not good for Netlify and the demo sites. Fixes #5460
2018-11-14cache/filecache: Add a :project placeholderBjørn Erik Pedersen
This allows for "cache per Hugo project", making `hugo --gc` work as expected, even if you have several Hugo projects running on the same PC. See #5439
2018-11-14cache/filecache: Add a cache prune funcBjørn Erik Pedersen
Fixes #5439
2018-11-14cache/filecache: Add a filecache root dirBjørn Erik Pedersen
This is just a safe guard to make sure we don't evict/remove files that do not belong to the cache.
2018-11-14cache/filecache: Use time.Duration for maxAgeBjørn Erik Pedersen
Fixes #5438
2018-11-14cache/filecache: Split implementation and config into separate filesBjørn Erik Pedersen
2018-11-13More spelling correctionsBjørn Erik Pedersen
2018-11-13cache/filecache: Spelling correctionsBjørn Erik Pedersen
2018-11-13Add a consolidated file cacheBjørn Erik Pedersen
This commits reworks how file caching is performed in Hugo. Now there is only one way, and it can be configured. This is the default configuration: ```toml [caches] [caches.getjson] dir = ":cacheDir" maxAge = -1 [caches.getcsv] dir = ":cacheDir" maxAge = -1 [caches.images] dir = ":resourceDir/_gen" maxAge = -1 [caches.assets] dir = ":resourceDir/_gen" maxAge = -1 ``` You can override any of these cache setting in your own `config.toml`. The placeholders explained: `:cacheDir`: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others. `:resourceDir`: This is the value of the `resourceDir` config option. `maxAge` is the time in seconds before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml Fixes #5404