Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "docs: Merge search indexes" #299

Merged
merged 1 commit into from Jun 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 0 additions & 27 deletions xtask/src/docs/mod.rs
@@ -1,6 +1,4 @@
use std::{
fs::File,
io::BufRead,
path::{Path, PathBuf},
process::Command,
};
Expand Down Expand Up @@ -42,34 +40,9 @@ pub fn docs() -> Result<(), anyhow::Error> {
.open("./target/doc/crates.js")?;
file.write_all(crates_js)?;

let mut search_indexes = read_lines("./target/doc/search-index.js")?
.map(|l| l.unwrap())
.collect::<Vec<_>>();
search_indexes.truncate(search_indexes.len() - 2);
let mut last = search_indexes.pop().unwrap();
last = last.trim_end_matches('\\').to_string() + ",\\";
search_indexes.push(last);

for l in read_lines("./bpf/target/doc/search-index.js")?.skip(1) {
search_indexes.push(l.unwrap());
}
let mut file = fs::File::options()
.read(true)
.write(true)
.open("./target/doc/search-index.js")?;
file.write_all(search_indexes.join("\n").as_bytes())?;

Ok(())
}

fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
where
P: AsRef<Path>,
{
let file = File::open(filename)?;
Ok(io::BufReader::new(file).lines())
}

fn copy_dir_all<P: AsRef<Path>>(src: P, dst: P) -> io::Result<()> {
fs::create_dir_all(&dst)?;
for entry in fs::read_dir(src)? {
Expand Down