mirror of
https://github.com/deps-rs/deps.rs.git
synced 2024-11-22 18:36:30 +00:00
blacklist non-compatible popular repos
This commit is contained in:
parent
b0c77b4446
commit
c135edc2a1
2 changed files with 22 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -59,7 +60,11 @@ impl Engine {
|
||||||
impl Future<Item=Vec<Repository>, Error=Error>
|
impl Future<Item=Vec<Repository>, Error=Error>
|
||||||
{
|
{
|
||||||
self.get_popular_repos.call(())
|
self.get_popular_repos.call(())
|
||||||
.from_err().map(|repos| repos.clone())
|
.from_err().map(|repos| {
|
||||||
|
repos.iter()
|
||||||
|
.filter(|repo| !POPULAR_REPOS_BLACKLIST.contains(&repo.path))
|
||||||
|
.cloned().collect()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn analyze_dependencies(&self, repo_path: RepoPath) ->
|
pub fn analyze_dependencies(&self, repo_path: RepoPath) ->
|
||||||
|
@ -96,3 +101,15 @@ impl Engine {
|
||||||
retrieve_file_at_path(self.client.clone(), &repo_path, &path.as_ref().join("Cargo.toml")).from_err()
|
retrieve_file_at_path(self.client.clone(), &repo_path, &path.as_ref().join("Cargo.toml")).from_err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref POPULAR_REPOS_BLACKLIST: HashSet<RepoPath> = {
|
||||||
|
vec![
|
||||||
|
RepoPath::from_parts("github", "rust-lang", "rust"),
|
||||||
|
RepoPath::from_parts("github", "google", "xi-editor"),
|
||||||
|
RepoPath::from_parts("github", "lk-geimfari", "awesomo"),
|
||||||
|
RepoPath::from_parts("github", "redox-os", "tfs"),
|
||||||
|
RepoPath::from_parts("github", "carols10cents", "rustlings")
|
||||||
|
].into_iter().collect::<Result<HashSet<_>, _>>().unwrap()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub struct Repository {
|
||||||
pub description: String
|
pub description: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub struct RepoPath {
|
pub struct RepoPath {
|
||||||
pub site: RepoSite,
|
pub site: RepoSite,
|
||||||
pub qual: RepoQualifier,
|
pub qual: RepoQualifier,
|
||||||
|
@ -25,7 +25,7 @@ impl RepoPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
|
||||||
pub enum RepoSite {
|
pub enum RepoSite {
|
||||||
Github
|
Github
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ impl AsRef<str> for RepoSite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub struct RepoQualifier(String);
|
pub struct RepoQualifier(String);
|
||||||
|
|
||||||
impl FromStr for RepoQualifier {
|
impl FromStr for RepoQualifier {
|
||||||
|
@ -79,7 +79,7 @@ impl AsRef<str> for RepoQualifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub struct RepoName(String);
|
pub struct RepoName(String);
|
||||||
|
|
||||||
impl FromStr for RepoName {
|
impl FromStr for RepoName {
|
||||||
|
|
Loading…
Reference in a new issue