Commit graph

266 commits

Author SHA1 Message Date
Vincent Prouillet 366e5c426f Avoid panics when binding addresses 2020-09-22 12:22:26 +02:00
WhizSid 41e436f331
serve command exiting when web socket port is already in use (#1179)
* Handled web socket port used issue

* Lint
2020-09-22 11:59:57 +02:00
Vincent Prouillet b313c97ceb Fix slugified taxonomies rendering
Closes #1177
2020-09-22 09:46:22 +02:00
John-John Tedro f9ae897190 Use platform-neutral path comparison for in-memory serving (fixes #1169) (#1175)
This introduces `relative-path`, a crate I've written for the specific
purpose of providing platform-neutral operations over paths the same way
they are used in URLs.

This means that `///hello///` == `/hello`, which should do the same as
the existing stripping minus the platform-specific path separators
causing the [bug being referenced](#1169).
2020-09-22 09:46:22 +02:00
Tim Visée c27f749a86 Fix #1165, improve situation for compile_sass errors (#1166)
* Update compile_sass docs, this is just for sass files in site root

* Improve file watch error, question whether the target exists
2020-09-22 09:46:22 +02:00
René Ribaud 5bf1687fa7
Use trim_start_matches instead of strip_prefix (#1156)
- This allow to not bump the pinned version to 1.45.0.
- Change this, despite trim_start_matches returns a &str and not an Option, which I
  like less.
2020-09-03 10:47:48 +02:00
René Ribaud 5ec3a9ca65
Strip unc if it exists, fix #1110 #1129 (#1151)
* Strip unc if it exists, fix #1110

* Bump pinned version to 1.45.2

* Bump to minimum version required.

- https://github.com/getzola/zola/pull/1129#discussion_r480172320

* Add unc comments and a required test

* Fix typo in rust pinned version

* Fix types not ok
2020-09-01 11:48:42 +02:00
Vincent Prouillet 278cc82fc7
Change zola serve to load HTML from memory instead of disk (#1114)
* Change zola serve to load HTML from memory instead of disk

* Be smart about assets copying

* Be a tiny bit smarter on template changes

* Add zola serve --fast
2020-08-16 18:39:04 +02:00
southerntofu b003a47d54
Support relative links for root directory (fix #1028) (#1106)
* serve command works from another working directory

* Root dir path is expanded (canonicalized) for relative links (#1028)

* Simplify watchers code

* Only watch sass/themes folders when they are enabled in config

Co-authored-by: southerntofu <southerntofu@thunix.net>
2020-07-29 20:08:25 +02:00
Vincent Prouillet 5fe1036a1d Extract some Tera logic out of site/lib.rs 2020-07-24 23:46:27 +02:00
Vincent Prouillet 9be7bc074d Extract sass code out of site/lib.rs 2020-07-24 23:46:27 +02:00
Vincent Prouillet d7a557f0b8 Update livereload.js 2020-07-24 23:46:27 +02:00
Per Lundberg 530f918955
Add --force/-f flag to init, for creation in non-empty dir (#1065) 2020-06-18 21:15:46 +02:00
Vincent Prouillet ade442a487 clippy + fmt + fix toml dates in extra arrays
Closes #1048
2020-06-18 21:12:46 +02:00
Tymoteusz Wiśniewski 974ae167a8
Make path to config.toml independent from root dir (#1023)
fixes #1022
2020-05-23 11:55:45 +02:00
Vincent Prouillet 0d5fefd446 Update image to 0.23 2020-02-10 20:48:52 +01:00
Vincent Prouillet ac3ced828b
Multiple slugification strategies (#929) 2020-02-05 09:13:14 +01:00
Vincent Prouillet be149646f6 Update livereload.js 2020-02-02 17:48:43 -08:00
ethereal 94445ae745 Add --root global argument. Fixes #899. (#932) 2020-02-02 17:48:43 -08:00
Sam Ford 2966adbe4e Migrate serve command to hyper (#904)
hyper is already included in Zola due to the reqwest dependency (used
in the link_checker and templates components). Replacing Actix with
hyper in the serve command reduces the number of dependencies and
slightly improves build times and binary size.
2020-02-02 17:48:43 -08:00
Vincent Prouillet adee654f30 Print remove_dir_all error on ctrl-c 2020-02-02 17:48:43 -08:00
Sam Ford 658e8a3a66 Update livereload.js to v3.1.0 (#891) 2020-02-02 17:48:43 -08:00
Sam Ford e804f907b2 Use Rust 2018 edition (#885) 2020-02-02 17:48:43 -08:00
Ryan Riginding 94b49dad09 fix(init): handle already existing path (#815)
* fix(init):  handle already existing path

* chore: add tests
2020-02-02 17:45:16 -08:00
Christopher Vittal 319985add4 Reset color after writing message in colorize
Presently when you `^C` in `zola serve` it is painted with the same
color as the previous message. This PR always ensures to reset the color
in colorize, before writing the newline.
2020-02-02 17:44:38 -08:00
Vincent Prouillet b396a1bc20 Add --drafts flag + rustfmt 2019-08-24 22:23:08 +02:00
Ever 4fff7508ba ADD: reload when themes change (#771)
* ADD: reload when themes change

close #713

* MOD: test can_detect_kind_of_changes
2019-08-24 19:05:02 +02:00
Vincent Prouillet f0c48b8a14 Add some more text to zola init
Closes #773
2019-08-13 20:16:09 +02:00
Vincent Prouillet 8942c15428 Add to changelog + rustfmt 2019-08-13 20:02:13 +02:00
southerntofu 13b395b536 zola init works inside existing directories (closes #406) (#777)
* zola init works without argument (defaults to current directory)

* zola init works with existing folders (no non-hidden files permitted)

* Update zola init documentation

* [docs] Optional argument is on a separate line for clarity

* Add tests for init subcommand's respect of existing folders
2019-08-13 19:56:57 +02:00
Vincent Prouillet 7f459940e1 Allow multiple taxonomies with same name in different language
Closes #766
2019-08-10 18:54:32 +02:00
Pyry Kovanen 4b43b75d22 Allow ignored_content to support markdown files (#759)
* Allow ignored_content to support markdown files

* Add test for markdown supported ignored_content
2019-08-01 10:18:42 +02:00
Vincent Prouillet 0e4e0c35b3 Remove all draft specific code 2019-07-19 11:10:28 +02:00
Vincent Prouillet ad6b713759 Do not use serve remove dir result
Closes #752
2019-07-17 09:55:14 +02:00
Vincent Prouillet 7c3a112d7d Render draft pages in serve mode 2019-07-12 23:47:15 +02:00
Vincent Prouillet a923f7005f Update site summary in zola check 2019-07-12 23:43:07 +02:00
Vincent Prouillet 28ecf553d5 Add counts in zola check
Closes #726
2019-07-12 23:38:46 +02:00
traviscross 46ee256ba4 Fix clippy warnings (#744)
Clippy is returning some warnings.  Let's fix or explicitly ignore
them.  In particular:

- In `components/imageproc/src/lib.rs`, we implement `Hash` explicitly
  but derive `PartialEq`.  We need to maintain the property that two
  keys being equal implies the hashes of those two keys are equal.
  Our `Hash` implementations preserve this, so we'll explicitly ignore
  the warnings.

- In `components/site/src/lib.rs`, we were calling `.into()` on some
  values that are already of the correct type.

- In `components/site/src/lib.rs`, we were using `.map(|x| *x)` in
  iterator chains to remove a level of indirection; we can instead say
  `.copied()` (introduced in Rust v1.36) or `.cloned()`.  Using
  `.copied` here is better from a type-checking point of view, but
  we'll use `.cloned` for now as Rust v1.36 was only recently
  released.

- In `components/templates/src/filters.rs` and
  `components/utils/src/site.rs`, we were taking `HashMap`s as
  function arguments but not generically accepting alternate `Hasher`
  implementations.

- In `src/cmd/check.rs`, we use `env::current_dir()` as a default
  value, but our use of `unwrap_or` meant that we would always
  retrieve the current directory even when not needed.

- In `components/errors/src/lib.rs`, we can use `if let` rather than
  `match`.

- In `components/library/src/content/page.rs`, we can collapse a
  nested conditional into `else if let ...`.

- In `components/library/src/sorting.rs`, a function takes `&&Page`
  arguments.  Clippy warns about this for efficiency reasons, but
  we're doing it here to match a particular sorting API, so we'll
  explicitly ignore the warning.
2019-07-12 22:54:18 +02:00
Jakub Turski 8a737d71fb Add an option to hard link files from static/ instead of copying. (#723)
* Add hard_link_static config option.

* Copy or hardlink file depending on an argument.

Modify the call sites for `copy_file` to account for the extra argument.

* Plug the config setting through to copy_file.

Don't apply the config option to theme's static directory.

* Update documentation.

* Backticks make no sense in this comment.

* Addressing PR comments.

* Be consistent with argument naming.
2019-07-12 22:54:18 +02:00
Tim Visée 90dad05c67 Add --open flag to serve command, to open URL in default browser (#739)
* Add --open flag to serve command, to open URL in default browser

* Mention serve --open flag in CLI documentation
2019-07-12 22:54:18 +02:00
Sam Ford 059ca55b36 Update LiveReload.js to v3.0.0 (#730) 2019-07-12 22:54:18 +02:00
Vincent Prouillet 9df9465080 Only check for port availability when not in watch-only for serve
Closes #712
2019-06-21 20:02:51 +02:00
Sam Ford 39f97f1520
Update actix-web to 1.0
* actix_web::fs is now found in the actix-files crate.

* NotFoundHandler is now implemented using ErrorHandlers and the
path to 404.html is provided to the not_found() function using
actix_web::App::data. This setup allows for additional StatusCodes
to be handled in the future, if desired.

* Cleanly serving index.html files for requests to directories now
appears to be possible simply by using index_file("index.html") in
the static files service, so handle_directory() is removed.
2019-06-18 19:05:00 -04:00
Vincent Prouillet cb962f7a64 Add aliases to sections 2019-06-02 20:21:06 +02:00
Vincent Prouillet 717f2112bb Add chmod to list of events on which to rebuild on serve 2019-05-27 19:51:43 +02:00
Marcus Klaas de Vries 0d964204c3 Check command global (#683)
* Add check subcommand

* Add some brief documentation for the check subcommand

* Start working on parallel link checks

* Check all external links in Site

* Return *all* dead links in site
2019-05-27 14:05:07 +02:00
Vincent Prouillet b70f9f95e3 Process images at the end of the build process
To also process the ones found in templates

Closes #669
2019-05-20 11:29:54 +02:00
Vincent Prouillet debe0633bc Revert "Allow default base-path command line option to be set for building and serving"
This reverts commit 1815155c1d.
2019-04-20 12:50:34 +02:00
Vincent Prouillet 2aa3ea758b Set content-type for livereload script
Closes #667
2019-04-18 19:11:06 +02:00
Blake Smith 1815155c1d Allow default base-path command line option to be set for building and serving 2019-03-23 20:25:56 -05:00