Commit graph

87 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
4ada1cab4d source: Remove unused code 2016-03-14 15:43:51 +01:00
Steve Francia
9f3796a31d Read/reread individual source content files
next is incremental conversion
2016-01-26 14:26:23 -05:00
Cameron Moore
4c596483e1 Update and refactor to ack Go Authors 2016-01-05 23:30:33 +01:00
Anthony Fok
8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07: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
Tatsushi Demachi
0c98d8e9ed Use LazyFileReader for reading file contents
Simple ioutil.ReadFile is used for reading file contents but it reads
all of the file contents and copies them into the memory and is run in a
single goroutine. It causes much memory consumption at copying media
files in content directory to publish directory and it is not good at
performance.

This improves the both issue by replacing ReadFile with LazyFileReader.

It postpones reading the file contents until it is really needed. As the
result, actual file read is run in parallelized goroutine. It improves
performance especially in a really big site.

In addition, if this reader is called from io.Copy, it does not copy the
file contents into the memory but just copies them into destination
file. It improves much memory consumption issue when the site has many
media files.

Fix #1181
2015-08-22 19:43:15 +02:00
Tatsushi Demachi
97eb55da89 Add LazyFileReader type to source library
LazyFileReader is an io.Reader implementation to postpone reading the
file contents until it is really needed. It is introduced for improving
performance and memory consumption at reading media files in content
directory.
2015-08-22 19:43:15 +02:00
Bjørn Erik Pedersen
aca0f60448 source/File: Fix data races 2015-07-21 20:02:42 +02:00
bep
beeae6ab69 Add some tests for IgnoreFiles
And log error on invalid regexp.

See #1189
2015-06-03 18:54:15 +02:00
bep
bec3f40359 Rename WatchIgnoreFiles to IgnoreFiles
Because this isn't just about server and watching.

See #1189
2015-06-03 13:45:52 +02:00
bep
bed227886b Add configurable list to ignore files in server watch
The following inside `config.toml` will ignore files ending with `.foo` and `.boo`.

```
watchIgnoreFiles = [ "\\.foo$", "\\.boo$" ]
```

The above is is a list of Reqular Expressions, but note the escaping of the `\` to make TOML happy.

Fixes #1189
2015-06-03 13:38:05 +02:00
bep
b190ad0ff9 source: add some test cases for File 2015-03-12 20:50:44 +01:00
Anthony Fok
67df33f500 Correct initialisms as suggested by golint
First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
2015-03-11 21:55:00 +01:00
bep
a91bcd85e2 source: apply some Golint rules 2015-03-07 12:58:39 +01:00
bep
6e1b0e0c00 Apply gofmt -s 2015-03-05 23:57:38 +01:00
René Jochum
d2e022f2a7 Suppress errors for symbolic links witch point to a file. 2015-02-17 19:18:28 -08:00
bep
e6541c45ab ERROR-log on symbolic links
filepath.Walk does not follow symbolic links.
There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements.

This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link.

Fixes #283
2014-12-10 20:32:39 +01:00
bep
9f77f93071 Fix various Windows-issues
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed.

There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests.

Fixes #687
Fixes #660
2014-12-09 09:43:15 -05:00
bep
cb3576b6de Fix broken convert
The front matter convert-feature didn't work. It placed converted content in the wrong directory.

This commit fixes this by doing the smallest and safest change possible; the path logic here should maybe
be revisited and generalized.

Fixes #643
2014-11-18 10:17:01 -05:00
Joel Scoble
7fd348cf79 convert path 2 filepath 2014-11-13 22:37:14 -05:00
spf13
ad69374f8b Source files can provide content as String or Bytes or Reader 2014-11-04 00:28:20 -05:00
spf13
5dfc1dedb8 Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
Christoph Burgdorf
f271faea06 Don't process dotfiles
This commit makes it so that not only files
but also folders which start with a dot
are ignored.

Fixes #239
2014-04-26 23:17:54 -06:00
Joe Kopena
d84f707da1 Also ignore Emacs lock & recovery files. 2014-03-04 22:07:40 -05:00
Ask Bjørn Hansen
2c0ded7f9f Add test for ignoring ~$ files 2014-02-28 23:24:09 -05:00
Ask Bjørn Hansen
e53bc948a5 Ignore content files ending in ~
Also add *~ to .gitignore
2014-02-28 23:23:59 -05:00
Egon Elbre
1979f7d9c7 Avoid locking the files for an extended amount of time. Sublime Text
doesn't like this and shows an error when modifying a file in rapid
succession.
2013-12-28 13:46:09 -05:00
Ruben
950d9f55a5 Testcases for multilevel structure were wrong 2013-12-16 17:43:53 -05:00
Ruben
de670ced86 Fixes #141: Wrong section in multi level structure 2013-12-16 17:40:33 -05:00
Noah Campbell
94a3184ad0 Fixing up source code formatting. 2013-10-08 18:37:50 +02:00
windch
8ce4bc7ab8 Update filesystem.go
bugfix: .Files() called twice in line 253, 256 in site.go. thus source files captured twice.

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-29 19:43:38 -07:00
Noah Campbell
c9223cfd7b source: Fix failing build on windows
The +build directive was not being picked up.  Apparently needs a space
after the +build line.
2013-09-24 14:36:22 -07:00
Noah Campbell
8df88496e2 Fix breaking test cases on unix platform
Rename platform parameter file to agnostic name. Both darwin and linux
can share the same paramters.
2013-09-20 20:08:52 -07:00
Noah Campbell
52e8c7a0ac Section is determined by the source, not the url
This change allows for top level html content to exists.
2013-09-20 17:03:43 -07:00
Noah Campbell
74b55fc7c8 Normalize paths within hugo
filepath was used inconsistently throughout the hugolib.  With the
introduction of source and target modules, all path are normalized to
"/".  This simplifies the processing of paths.  It does mean that
contributors need to be aware of using path/filepath in any module other
than source or target is not recommended.  The current exception is
hugolib/config.go
2013-09-12 10:48:59 -07:00
Noah Campbell
610c06e658 Introduce source.Filesystem
This provides an abstraction over how files are processed by Hugo.  This
allows for alternatives like CMS systems or Dropbox, etc.
2013-09-04 22:42:52 -07:00