mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-13 23:27:13 +00:00
Load advisory-db from local repo
This commit is contained in:
parent
8ad10ec40e
commit
3b9796a8a3
3 changed files with 9 additions and 6 deletions
1
.github/workflows/docs.yml
vendored
1
.github/workflows/docs.yml
vendored
|
@ -20,5 +20,6 @@ jobs:
|
|||
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
|
||||
git clone --depth 1 https://github.com/jplatte/caniuse.rs.git /tmp/caniuse
|
||||
git clone --depth 1 https://github.com/nrc/rfc-index.git /tmp/rfcs
|
||||
git clone --depth 1 https://github.com/rustsec/advisory-db.git /tmp/advisory-db
|
||||
- name: Deloy docs
|
||||
run: ./scripts/deploy-docs.sh
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use std::{collections::HashMap, io::Write, path::Path};
|
||||
|
||||
use argh::FromArgs;
|
||||
use rustsec::{
|
||||
database::Query, repository::git::DEFAULT_URL, Advisory, Collection, Database, Repository,
|
||||
};
|
||||
use rustsec::{database::Query, Advisory, Collection, Database, Repository};
|
||||
|
||||
use super::Task;
|
||||
|
||||
|
@ -12,12 +10,16 @@ const ADVISORY_INDEX_PATH: &str = "../docs/static/advisory";
|
|||
/// Advisory task
|
||||
#[derive(FromArgs)]
|
||||
#[argh(subcommand, name = "advisory")]
|
||||
pub struct AdvisoryTask {}
|
||||
pub struct AdvisoryTask {
|
||||
/// advisory-db repository path
|
||||
#[argh(option, short = 'r')]
|
||||
repo_path: String,
|
||||
}
|
||||
|
||||
impl Task for AdvisoryTask {
|
||||
fn execute(&self) -> crate::Result<()> {
|
||||
let mut map = HashMap::new();
|
||||
let repo = Repository::fetch(DEFAULT_URL, "/tmp/advisory-db", true)?;
|
||||
let repo = Repository::open(&self.repo_path)?;
|
||||
let db = Database::load_from_repo(&repo)?;
|
||||
for advisory in db
|
||||
.query(&Query::new().collection(Collection::Crates).withdrawn(false))
|
||||
|
|
|
@ -14,7 +14,7 @@ RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml
|
|||
RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml targets -d /tmp/public/index/targets.js
|
||||
RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml caniuse -r /tmp/caniuse -d /tmp/public/index/caniuse.js
|
||||
RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml rfcs -r /tmp/rfcs -d /tmp/public/index/rfcs.js
|
||||
RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml advisory
|
||||
RUST_BACKTRACE=full cargo run --target-dir /tmp --manifest-path=rust/Cargo.toml advisory -r /tmp/advisory-db
|
||||
# Copy commands.js
|
||||
cp extension/index/commands.js /tmp/public/index/commands.js
|
||||
|
||||
|
|
Loading…
Reference in a new issue