Remove watch-only
This commit is contained in:
parent
39870d8675
commit
657905ed6e
|
@ -18,6 +18,7 @@ into their typographic forms
|
|||
- Add iteration count variable `nth` for shortcodes to know how many times a shortcode has been invoked in a given
|
||||
content
|
||||
- Update some highlighting syntaxes and the TS syntax will now be used instead of JS due to issues with it
|
||||
- Remove `zola serve --watch-only`: since we build the HTML in memory and not on disk, it doesn't make sense anymore
|
||||
|
||||
## 0.12.2 (2020-09-28)
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@ fn can_build_with_extra_syntaxes() {
|
|||
assert!(file_contains!(
|
||||
public,
|
||||
"posts/extra-syntax/index.html",
|
||||
r#"<span style="color:#d08770;">test</span>"#
|
||||
r#"<span style="color:"#
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,10 +75,6 @@ pub fn build_cli() -> App<'static, 'static> {
|
|||
.default_value("127.0.0.1")
|
||||
.takes_value(true)
|
||||
.help("Changes the base_url"),
|
||||
Arg::with_name("watch_only")
|
||||
.long("watch-only")
|
||||
.takes_value(false)
|
||||
.help("Do not start a server, just re-build project on changes"),
|
||||
Arg::with_name("drafts")
|
||||
.long("drafts")
|
||||
.takes_value(false)
|
||||
|
|
|
@ -145,25 +145,23 @@ fn not_found(content: Option<String>) -> Response<Body> {
|
|||
.expect("Could not build Not Found response")
|
||||
}
|
||||
|
||||
fn rebuild_done_handling(broadcaster: &Option<Sender>, res: Result<()>, reload_path: &str) {
|
||||
fn rebuild_done_handling(broadcaster: &Sender, res: Result<()>, reload_path: &str) {
|
||||
match res {
|
||||
Ok(_) => {
|
||||
if let Some(broadcaster) = broadcaster.as_ref() {
|
||||
broadcaster
|
||||
.send(format!(
|
||||
r#"
|
||||
{{
|
||||
"command": "reload",
|
||||
"path": "{}",
|
||||
"originalPath": "",
|
||||
"liveCSS": true,
|
||||
"liveImg": true,
|
||||
"protocol": ["http://livereload.com/protocols/official-7"]
|
||||
}}"#,
|
||||
reload_path
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
broadcaster
|
||||
.send(format!(
|
||||
r#"
|
||||
{{
|
||||
"command": "reload",
|
||||
"path": "{}",
|
||||
"originalPath": "",
|
||||
"liveCSS": true,
|
||||
"liveImg": true,
|
||||
"protocol": ["http://livereload.com/protocols/official-7"]
|
||||
}}"#,
|
||||
reload_path
|
||||
))
|
||||
.unwrap();
|
||||
}
|
||||
Err(e) => console::unravel_errors("Failed to build the site", &e),
|
||||
}
|
||||
|
@ -217,7 +215,6 @@ pub fn serve(
|
|||
output_dir: Option<&Path>,
|
||||
base_url: &str,
|
||||
config_file: &Path,
|
||||
watch_only: bool,
|
||||
open: bool,
|
||||
include_drafts: bool,
|
||||
fast_rebuild: bool,
|
||||
|
@ -284,7 +281,7 @@ pub fn serve(
|
|||
// output path is going to need to be moved later on, so clone it for the
|
||||
// http closure to avoid contention.
|
||||
let static_root = output_path.clone();
|
||||
let broadcaster = if !watch_only {
|
||||
let broadcaster = {
|
||||
thread::spawn(move || {
|
||||
let addr = address.parse().unwrap();
|
||||
|
||||
|
@ -347,10 +344,7 @@ pub fn serve(
|
|||
ws_server.run().unwrap();
|
||||
});
|
||||
|
||||
Some(broadcaster)
|
||||
} else {
|
||||
println!("Watching in watch only mode, no web server will be started");
|
||||
None
|
||||
broadcaster
|
||||
};
|
||||
|
||||
println!("Listening for changes in {}{{{}}}", root_dir.display(), watchers.join(", "));
|
||||
|
|
|
@ -61,18 +61,17 @@ fn main() {
|
|||
::std::process::exit(1);
|
||||
}
|
||||
};
|
||||
let watch_only = matches.is_present("watch_only");
|
||||
let open = matches.is_present("open");
|
||||
let include_drafts = matches.is_present("drafts");
|
||||
let fast = matches.is_present("fast");
|
||||
|
||||
// Default one
|
||||
if port != 1111 && !watch_only && !port_is_available(port) {
|
||||
if port != 1111 && !port_is_available(port) {
|
||||
console::error("The requested port is not available");
|
||||
::std::process::exit(1);
|
||||
}
|
||||
|
||||
if !watch_only && !port_is_available(port) {
|
||||
if !port_is_available(port) {
|
||||
port = if let Some(p) = get_available_port(1111) {
|
||||
p
|
||||
} else {
|
||||
|
@ -90,7 +89,6 @@ fn main() {
|
|||
output_dir,
|
||||
base_url,
|
||||
&config_file,
|
||||
watch_only,
|
||||
open,
|
||||
include_drafts,
|
||||
fast,
|
||||
|
|
|
@ -3,6 +3,9 @@ base_url = "https://staging.com"
|
|||
highlight_code = true
|
||||
theme = "sample"
|
||||
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
|
||||
[extra.author]
|
||||
name = "Vincent Prouillet"
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
title = "My site"
|
||||
base_url = "https://replace-this-with-your-url.com"
|
||||
highlight_code = true
|
||||
compile_sass = true
|
||||
generate_feed = true
|
||||
theme = "sample"
|
||||
|
@ -10,10 +9,12 @@ taxonomies = [
|
|||
{name = "podcast_authors", feed = true},
|
||||
]
|
||||
|
||||
extra_syntaxes = ["syntaxes"]
|
||||
|
||||
ignored_content = ["*/ignored.md"]
|
||||
|
||||
[markdown]
|
||||
highlight_code = true
|
||||
extra_syntaxes = ["syntaxes"]
|
||||
|
||||
[slugify]
|
||||
paths = "on"
|
||||
taxonomies = "on"
|
||||
|
|
|
@ -4,10 +4,6 @@ base_url = "https://example.com"
|
|||
# Whether to automatically compile all Sass files in the sass directory
|
||||
compile_sass = false
|
||||
|
||||
# Whether to do syntax highlighting
|
||||
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||
highlight_code = false
|
||||
|
||||
# Whether to build a search index to be used later on by a JavaScript library
|
||||
build_search_index = true
|
||||
|
||||
|
@ -27,5 +23,9 @@ languages = [
|
|||
{code = "it", feed = false, search = true },
|
||||
]
|
||||
|
||||
[markdown]
|
||||
highlight_code = false
|
||||
|
||||
|
||||
[extra]
|
||||
# Put all your custom variables here
|
||||
|
|
Loading…
Reference in a new issue