Compare commits
14 Commits
45f72c8e5e
...
20e6683903
Author | SHA1 | Date |
---|---|---|
Tom Parker-Shemilt | 20e6683903 | |
Maciej Laskowski | 5f6fe22ef9 | |
Tom Parker-Shemilt | 5af1b52845 | |
Josh McKinney | 1b3195bdc1 | |
Tom Parker-Shemilt | 05c2c9f2fe | |
dependabot[bot] | 6565059ed6 | |
Tom Parker-Shemilt | 76ddb7e706 | |
Tom Parker-Shemilt | af0dea22db | |
Tom Parker-Shemilt | 5e181abd11 | |
Bastian Bense | f4ad40a640 | |
Bastian Bense | ca731c57be | |
Bastian Bense | aed90209e6 | |
Bastian Bense | 643d322cea | |
Bastian Bense | 8b5babbefe |
|
@ -710,9 +710,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.8"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
|
||||
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
|
|
|
@ -560,6 +560,7 @@ See also [A comparison of operating systems written in Rust](https://github.com/
|
|||
|
||||
### Web Servers
|
||||
|
||||
* [cloudflare/pingora](https://github.com/cloudflare/pingora) - A library for building fast, reliable and evolvable network services.
|
||||
* [emanuele-em/proxelar](https://github.com/emanuele-em/proxelar) — A MITM Proxy 🦀! Toolkit for HTTP/1, HTTP/2, and WebSockets with SSL/TLS Capabilities [![Rust](https://github.com/emanuele-em/proxelar/actions/workflows/rust.yml/badge.svg)](https://github.com/emanuele-em/proxelar/actions/workflows/rust.yml)
|
||||
* [mu-arch/skyfolder](https://github.com/mu-arch/skyfolder) - 🪂 Beautiful HTTP/Bittorrent server without the hassle. Secure - GUI - Pretty - Fast
|
||||
* [mufeedvh/binserve](https://github.com/mufeedvh/binserve) — A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code [![build badge](https://github.com/mufeedvh/binserve/workflows/CICD/badge.svg?branch=master)](https://github.com/mufeedvh/binserve/actions)
|
||||
|
@ -618,7 +619,7 @@ See also [A comparison of operating systems written in Rust](https://github.com/
|
|||
* [cargo-graph](https://crates.io/crates/cargo-graph) — updated fork of `cargo-dot` with additional features. Unmaintained, see `cargo-deps`
|
||||
* [cargo-info](https://crates.io/crates/cargo-info) — queries crates.io for crates details from command line
|
||||
* [cargo-license](https://crates.io/crates/cargo-license) — A cargo subcommand to quickly view the licenses of all dependencies.
|
||||
* [cargo-limit](https://crates.io/crates/cargo-limit) — Cargo with less noise: warnings are skipped until errors are fixed, Neovim integration, etc. [![build badge](https://github.com/alopatindev/cargo-limit/actions/workflows/rust.yml/badge.svg)](https://github.com/alopatindev/cargo-limit/actions)
|
||||
* [cargo-limit](https://crates.io/crates/cargo-limit) — Cargo with less noise: warnings are skipped until errors are fixed, Neovim integration, etc. [![build badge](https://github.com/cargo-limit//cargo-limit/actions/workflows/rust.yml/badge.svg)](https://github.com/cargo-limit//cargo-limit/actions)
|
||||
* [cargo-make](https://crates.io/crates/cargo-make) — Task runner and build tool. [![build badge](https://github.com/sagiegurari/cargo-make/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/cargo-make/actions)
|
||||
* [cargo-modules](https://crates.io/crates/cargo-modules) — A cargo plugin for showing a tree-like overview of a crate's modules.
|
||||
* [cargo-multi](https://crates.io/crates/cargo-multi) — runs specified cargo command on multiple crates
|
||||
|
@ -1447,6 +1448,7 @@ See also [Are we game yet?](https://arewegameyet.rs)
|
|||
* [Kiss3d](http://kiss3d.org) — draw simple geometric figures and play with them with one-liners
|
||||
* [PistonDevelopers/glfw-rs](https://github.com/PistonDevelopers/glfw-rs) —
|
||||
* PDF
|
||||
* [bastibense/libharu_ng](https://github.com/bastibense/libharu_ng) [[libharu_ng](https://crates.io/crates/libharu_ng)] - Easily generate PDFs from your Rust app.
|
||||
* [fschutt/printpdf](https://github.com/fschutt/printpdf) — PDF writing library
|
||||
* [J-F-Liu/lopdf](https://github.com/J-F-Liu/lopdf) — PDF document manipulation
|
||||
* [kaj/rust-pdf](https://github.com/kaj/rust-pdf) —
|
||||
|
@ -1753,7 +1755,7 @@ See also [Are we web yet?](https://www.arewewebyet.org) and [Rust web framework
|
|||
* [cargo-web](https://crates.io/crates/cargo-web) — A Cargo subcommand for the client-side Web
|
||||
* [leptos](https://github.com/leptos-rs/leptos) — Leptos is a full-stack, isomorphic web framework leveraging fine-grained reactivity to build declarative user interfaces.[![crate](https://img.shields.io/crates/v/create-rust-app.svg)](https://crates.io/crates/leptos)
|
||||
* [sauron](https://github.com/ivanceras/sauron) - Client side web framework which closely adheres to The Elm Architecture.
|
||||
* [seed](https://seed-rs.org/) — A framework for creating web apps
|
||||
* [seed](https://github.com/seed-rs/seed) — A framework for creating web apps
|
||||
* [stdweb](https://crates.io/crates/stdweb) — A standard library for the client-side Web
|
||||
* [yew](https://crates.io/crates/yew) — A framework for making client web apps
|
||||
* HTTP Client
|
||||
|
|
|
@ -22,7 +22,7 @@ fn fix_dashes(lines: Vec<String>) -> Vec<String> {
|
|||
}
|
||||
}
|
||||
|
||||
return fixed_lines;
|
||||
fixed_lines
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -43,9 +43,9 @@ impl MaxHandles {
|
|||
}
|
||||
}
|
||||
|
||||
async fn get<'a>(&'a self) -> Handle<'a> {
|
||||
async fn get(&self) -> Handle {
|
||||
let permit = self.remaining.acquire().await.unwrap();
|
||||
return Handle { _permit: permit };
|
||||
Handle { _permit: permit }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,10 +98,10 @@ async fn get_hacktoberfest_core(github_url: String) -> Result<Info, CheckerError
|
|||
match resp {
|
||||
Err(err) => {
|
||||
warn!("Error while getting {}: {}", github_url, err);
|
||||
return Err(CheckerError::HttpError {
|
||||
Err(CheckerError::HttpError {
|
||||
status: err.status().unwrap().as_u16(),
|
||||
location: Some(github_url.to_string()),
|
||||
});
|
||||
})
|
||||
}
|
||||
Ok(ok) => {
|
||||
if !ok.status().is_success() {
|
||||
|
@ -115,7 +115,7 @@ async fn get_hacktoberfest_core(github_url: String) -> Result<Info, CheckerError
|
|||
Ok(val) => Ok(Info {
|
||||
name: val.full_name,
|
||||
description: val.description.unwrap_or_default(),
|
||||
hacktoberfest: val.topics.iter().find(|t| *t == "hacktoberfest").is_some(),
|
||||
hacktoberfest: val.topics.iter().any(|t| *t == "hacktoberfest"),
|
||||
}),
|
||||
Err(_) => {
|
||||
panic!("{}", raw);
|
||||
|
@ -129,7 +129,7 @@ fn get_hacktoberfest(url: String) -> BoxFuture<'static, (String, Result<Info, Ch
|
|||
debug!("Need handle for {}", url);
|
||||
async move {
|
||||
let _handle = HANDLES.get().await;
|
||||
return (url.clone(), get_hacktoberfest_core(url).await);
|
||||
(url.clone(), get_hacktoberfest_core(url).await)
|
||||
}
|
||||
.boxed()
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ async fn main() -> Result<(), Error> {
|
|||
let mut results: Results = fs::read_to_string("results/hacktoberfest.yaml")
|
||||
.map_err(|e| format_err!("{}", e))
|
||||
.and_then(|x| serde_yaml::from_str(&x).map_err(|e| format_err!("{}", e)))
|
||||
.unwrap_or(Results::new());
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut url_checks = vec![];
|
||||
|
||||
|
@ -171,7 +171,7 @@ async fn main() -> Result<(), Error> {
|
|||
return;
|
||||
}
|
||||
used.insert(url.clone());
|
||||
if let Some(_) = results.get(&url) {
|
||||
if results.get(&url).is_some() {
|
||||
return;
|
||||
}
|
||||
let check = get_hacktoberfest(url).boxed();
|
||||
|
@ -181,16 +181,12 @@ async fn main() -> Result<(), Error> {
|
|||
let mut to_check: Vec<String> = vec![];
|
||||
|
||||
for (event, _) in parser.into_offset_iter() {
|
||||
match event {
|
||||
Event::Start(tag) => match tag {
|
||||
Tag::Link(_link_type, url, _title) | Tag::Image(_link_type, url, _title) => {
|
||||
if GITHUB_REPO_REGEX.is_match(&url) {
|
||||
to_check.push(url.to_string());
|
||||
}
|
||||
if let Event::Start(tag) = event {
|
||||
if let Tag::Link(_link_type, url, _title) | Tag::Image(_link_type, url, _title) = tag {
|
||||
if GITHUB_REPO_REGEX.is_match(&url) {
|
||||
to_check.push(url.to_string());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +205,7 @@ async fn main() -> Result<(), Error> {
|
|||
let mut last_written = Local::now();
|
||||
|
||||
let mut failed: u32 = 0;
|
||||
while url_checks.len() > 0 {
|
||||
while !url_checks.is_empty() {
|
||||
debug!("Waiting for {}", url_checks.len());
|
||||
let ((url, res), _index, remaining) = select_all(url_checks).await;
|
||||
url_checks = remaining;
|
||||
|
@ -224,7 +220,7 @@ async fn main() -> Result<(), Error> {
|
|||
url.clone(),
|
||||
Link {
|
||||
updated_at: Local::now(),
|
||||
info: info,
|
||||
info,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -252,7 +248,7 @@ async fn main() -> Result<(), Error> {
|
|||
"results/hacktoberfest.yaml",
|
||||
serde_yaml::to_string(&results)?,
|
||||
)?;
|
||||
println!("");
|
||||
println!();
|
||||
|
||||
if failed == 0 {
|
||||
println!("All awesome-rust repos tagged with 'hacktoberfest'");
|
||||
|
|
96
src/main.rs
96
src/main.rs
|
@ -28,9 +28,7 @@ fn override_stars(level: u32, text: &str) -> Option<u32> {
|
|||
// This is zero because a lot of the resources are non-github/non-cargo links and overriding for all would be annoying
|
||||
// These should be evaluated with more primitive means
|
||||
Some(0)
|
||||
} else if level == 3 && text.contains("Games") {
|
||||
Some(40)
|
||||
} else if level == 3 && text.contains("Emulators") {
|
||||
} else if level == 3 && (text.contains("Games") || text.contains("Emulators")) {
|
||||
Some(40)
|
||||
} else {
|
||||
None // i.e. use defaults
|
||||
|
@ -63,7 +61,6 @@ lazy_static! {
|
|||
"http://kiss3d.org".to_string(), // https://github.com/sebcrozet/kiss3d has >900 stars
|
||||
"https://github.com/rust-qt".to_string(), // Various high-stars repositories
|
||||
"https://chromium.googlesource.com/chromiumos/platform/crosvm/".to_string(), // Can't tell count directly, but various mirrors of it (e.g. https://github.com/dgreid/crosvm) have enough stars that it's got enough interest
|
||||
"https://seed-rs.org/".to_string(), // https://github.com/seed-rs/seed has 2.1k stars
|
||||
"https://crates.io".to_string(), // This one gets a free pass :)
|
||||
"https://cloudsmith.com/product/formats/cargo-registry".to_string(), // First private cargo registry (https://cloudsmith.com/blog/worlds-first-private-cargo-registry-w-cloudsmith-rust/) and not much in the way of other options yet. See also https://github.com/rust-unofficial/awesome-rust/pull/1141#discussion_r688711555
|
||||
"https://gitlab.com/ttyperacer/terminal-typeracer".to_string(), // GitLab repo with >40 stars.
|
||||
|
@ -134,9 +131,9 @@ impl MaxHandles {
|
|||
}
|
||||
}
|
||||
|
||||
async fn get<'a>(&'a self) -> Handle<'a> {
|
||||
async fn get(&self) -> Handle {
|
||||
let permit = self.remaining.acquire().await.unwrap();
|
||||
return Handle { _permit: permit };
|
||||
Handle { _permit: permit }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +160,7 @@ fn get_url(url: String) -> BoxFuture<'static, (String, Result<(), CheckerError>)
|
|||
debug!("Need handle for {}", url);
|
||||
async move {
|
||||
let _handle = HANDLES.get().await;
|
||||
return get_url_core(url).await;
|
||||
get_url_core(url).await
|
||||
}
|
||||
.boxed()
|
||||
}
|
||||
|
@ -185,7 +182,7 @@ struct GithubStars {
|
|||
async fn get_stars(github_url: &str) -> Option<u32> {
|
||||
warn!("Downloading Github stars for {}", github_url);
|
||||
let rewritten = GITHUB_REPO_REGEX
|
||||
.replace_all(&github_url, "https://api.github.com/repos/$org/$repo")
|
||||
.replace_all(github_url, "https://api.github.com/repos/$org/$repo")
|
||||
.to_string();
|
||||
let mut req = CLIENT.get(&rewritten);
|
||||
if let Ok(username) = env::var("USERNAME_FOR_GITHUB") {
|
||||
|
@ -199,7 +196,7 @@ async fn get_stars(github_url: &str) -> Option<u32> {
|
|||
match resp {
|
||||
Err(err) => {
|
||||
warn!("Error while getting {}: {}", github_url, err);
|
||||
return None;
|
||||
None
|
||||
}
|
||||
Ok(ok) => {
|
||||
let raw = ok.text().await.unwrap();
|
||||
|
@ -213,7 +210,7 @@ async fn get_stars(github_url: &str) -> Option<u32> {
|
|||
warn!("{} is archived, so ignoring stars", github_url);
|
||||
return Some(0);
|
||||
}
|
||||
return Some(data.stargazers_count);
|
||||
Some(data.stargazers_count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +229,7 @@ struct Crate {
|
|||
async fn get_downloads(github_url: &str) -> Option<u64> {
|
||||
warn!("Downloading Crates downloads for {}", github_url);
|
||||
let rewritten = CRATE_REGEX
|
||||
.replace_all(&github_url, "https://crates.io/api/v1/crates/$crate")
|
||||
.replace_all(github_url, "https://crates.io/api/v1/crates/$crate")
|
||||
.to_string();
|
||||
let req = CLIENT.get(&rewritten);
|
||||
|
||||
|
@ -240,11 +237,11 @@ async fn get_downloads(github_url: &str) -> Option<u64> {
|
|||
match resp {
|
||||
Err(err) => {
|
||||
warn!("Error while getting {}: {}", github_url, err);
|
||||
return None;
|
||||
None
|
||||
}
|
||||
Ok(ok) => {
|
||||
let data = ok.json::<Crate>().await.unwrap();
|
||||
return Some(data.info.downloads);
|
||||
Some(data.info.downloads)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +354,7 @@ fn get_url_core(url: String) -> BoxFuture<'static, (String, Result<(), CheckerEr
|
|||
break;
|
||||
}
|
||||
let query = matches.get(1).map(|x| x.as_str()).unwrap_or("");
|
||||
if !query.starts_with("?") || query.find("branch=").is_none() {
|
||||
if !query.starts_with('?') || !query.contains("branch=") {
|
||||
res = Err(CheckerError::TravisBuildNoBranch);
|
||||
break;
|
||||
}
|
||||
|
@ -403,7 +400,7 @@ async fn main() -> Result<(), Error> {
|
|||
let mut results: Results = fs::read_to_string("results/results.yaml")
|
||||
.map_err(|e| format_err!("{}", e))
|
||||
.and_then(|x| serde_yaml::from_str(&x).map_err(|e| format_err!("{}", e)))
|
||||
.unwrap_or(Results::new());
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut popularity_data: PopularityData = fs::read_to_string("results/popularity.yaml")
|
||||
.map_err(|e| format_err!("{}", e))
|
||||
|
@ -461,7 +458,7 @@ async fn main() -> Result<(), Error> {
|
|||
Event::Start(tag) => {
|
||||
match tag {
|
||||
Tag::Link(_link_type, url, _title) | Tag::Image(_link_type, url, _title) => {
|
||||
if !url.starts_with("#") {
|
||||
if !url.starts_with('#') {
|
||||
let new_url = url.to_string();
|
||||
if POPULARITY_OVERRIDES.contains(&new_url) {
|
||||
github_stars = Some(MINIMUM_GITHUB_STARS);
|
||||
|
@ -521,14 +518,14 @@ async fn main() -> Result<(), Error> {
|
|||
}
|
||||
}
|
||||
Tag::List(_) => {
|
||||
if in_list_item && list_item.len() > 0 {
|
||||
if in_list_item && !list_item.is_empty() {
|
||||
list_items.last_mut().unwrap().data.push(list_item.clone());
|
||||
in_list_item = false;
|
||||
}
|
||||
list_items.push(ListInfo { data: Vec::new() });
|
||||
}
|
||||
Tag::Item => {
|
||||
if in_list_item && list_item.len() > 0 {
|
||||
if in_list_item && !list_item.is_empty() {
|
||||
list_items.last_mut().unwrap().data.push(list_item.clone());
|
||||
}
|
||||
in_list_item = true;
|
||||
|
@ -568,19 +565,18 @@ async fn main() -> Result<(), Error> {
|
|||
Event::End(tag) => {
|
||||
match tag {
|
||||
Tag::Item => {
|
||||
if list_item.len() > 0 {
|
||||
if link_count > 0 {
|
||||
if github_stars.unwrap_or(0) < required_stars
|
||||
&& cargo_downloads.unwrap_or(0) < MINIMUM_CARGO_DOWNLOADS
|
||||
{
|
||||
if github_stars.is_none() {
|
||||
warn!("No valid github link");
|
||||
}
|
||||
if cargo_downloads.is_none() {
|
||||
warn!("No valid crates link");
|
||||
}
|
||||
return Err(format_err!("Not high enough metrics ({:?} stars < {}, and {:?} cargo downloads < {}): {}", github_stars, required_stars, cargo_downloads, MINIMUM_CARGO_DOWNLOADS, list_item));
|
||||
if !list_item.is_empty() {
|
||||
if link_count > 0
|
||||
&& github_stars.unwrap_or(0) < required_stars
|
||||
&& cargo_downloads.unwrap_or(0) < MINIMUM_CARGO_DOWNLOADS
|
||||
{
|
||||
if github_stars.is_none() {
|
||||
warn!("No valid github link");
|
||||
}
|
||||
if cargo_downloads.is_none() {
|
||||
warn!("No valid crates link");
|
||||
}
|
||||
return Err(format_err!("Not high enough metrics ({:?} stars < {}, and {:?} cargo downloads < {}): {}", github_stars, required_stars, cargo_downloads, MINIMUM_CARGO_DOWNLOADS, list_item));
|
||||
}
|
||||
list_items.last_mut().unwrap().data.push(list_item.clone());
|
||||
list_item = String::new();
|
||||
|
@ -589,18 +585,18 @@ async fn main() -> Result<(), Error> {
|
|||
}
|
||||
Tag::List(_) => {
|
||||
let list_info = list_items.pop().unwrap();
|
||||
if list_info.data.iter().find(|s| *s == "License").is_some()
|
||||
&& list_info.data.iter().find(|s| *s == "Resources").is_some()
|
||||
if list_info.data.iter().any(|s| *s == "License")
|
||||
&& list_info.data.iter().any(|s| *s == "Resources")
|
||||
{
|
||||
// Ignore wrong ordering in top-level list
|
||||
continue;
|
||||
}
|
||||
let mut sorted_recent_list = list_info.data.to_vec();
|
||||
sorted_recent_list.sort_by(|a, b| a.to_lowercase().cmp(&b.to_lowercase()));
|
||||
sorted_recent_list.sort_by_key(|a| a.to_lowercase());
|
||||
let joined_recent = list_info.data.join("\n");
|
||||
let joined_sorted = sorted_recent_list.join("\n");
|
||||
let patch = create_patch(&joined_recent, &joined_sorted);
|
||||
if patch.hunks().len() > 0 {
|
||||
if !patch.hunks().is_empty() {
|
||||
println!("{}", patch);
|
||||
return Err(format_err!("Sorting error"));
|
||||
}
|
||||
|
@ -626,30 +622,14 @@ async fn main() -> Result<(), Error> {
|
|||
)?;
|
||||
|
||||
to_check.sort_by(|a, b| {
|
||||
let get_time = |k| {
|
||||
let res = results.get(k);
|
||||
if let Some(link) = res {
|
||||
if let Some(last_working) = link.last_working {
|
||||
Some(last_working)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
let get_time = |k| results.get(k).map(|link| link.last_working);
|
||||
let res_a = get_time(a);
|
||||
let res_b = get_time(b);
|
||||
if res_a.is_none() {
|
||||
if res_b.is_none() {
|
||||
return a.cmp(b);
|
||||
} else {
|
||||
Ordering::Less
|
||||
}
|
||||
} else if res_b.is_none() {
|
||||
Ordering::Greater
|
||||
} else {
|
||||
res_a.unwrap().cmp(&res_b.unwrap())
|
||||
match (res_a, res_b) {
|
||||
(Some(a), Some(b)) => a.cmp(&b),
|
||||
(Some(_), None) => Ordering::Less,
|
||||
(None, Some(_)) => Ordering::Greater,
|
||||
(None, None) => a.cmp(b),
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -666,7 +646,7 @@ async fn main() -> Result<(), Error> {
|
|||
|
||||
let mut not_written = 0;
|
||||
let mut last_written = Local::now();
|
||||
while url_checks.len() > 0 {
|
||||
while !url_checks.is_empty() {
|
||||
debug!("Waiting for {}", url_checks.len());
|
||||
let ((url, res), _index, remaining) = select_all(url_checks).await;
|
||||
url_checks = remaining;
|
||||
|
@ -716,7 +696,7 @@ async fn main() -> Result<(), Error> {
|
|||
}
|
||||
}
|
||||
fs::write("results/results.yaml", serde_yaml::to_string(&results)?)?;
|
||||
println!("");
|
||||
println!();
|
||||
let mut failed: u32 = 0;
|
||||
|
||||
for (url, link) in results.iter() {
|
||||
|
|
Loading…
Reference in New Issue