mirror of
https://github.com/rust-unofficial/awesome-rust.git
synced 2025-01-08 13:34:09 +02:00
Lower the required thresholds for games to 40 stars
This commit is contained in:
parent
f1d75e2aa8
commit
a22e47d46c
@ -223,7 +223,9 @@ See also [Games Made With Piston](https://github.com/PistonDevelopers/piston/wik
|
|||||||
* [ozkriff/zemeroth](https://github.com/ozkriff/zemeroth) — A small 2D turn-based hexagonal strategy game [![build badge](https://api.travis-ci.org/ozkriff/zemeroth.svg?branch=master)](https://travis-ci.org/ozkriff/zemeroth)
|
* [ozkriff/zemeroth](https://github.com/ozkriff/zemeroth) — A small 2D turn-based hexagonal strategy game [![build badge](https://api.travis-ci.org/ozkriff/zemeroth.svg?branch=master)](https://travis-ci.org/ozkriff/zemeroth)
|
||||||
* [rhex](https://github.com/dpc/rhex) — hexagonal ascii roguelike
|
* [rhex](https://github.com/dpc/rhex) — hexagonal ascii roguelike
|
||||||
* [rsaarelm/magog](https://github.com/rsaarelm/magog) — A roguelike game in Rust
|
* [rsaarelm/magog](https://github.com/rsaarelm/magog) — A roguelike game in Rust
|
||||||
|
* [schulke-214/rsnake](https://github.com/schulke-214/rsnake) — Snake written in Rust.
|
||||||
* [swatteau/sokoban-rs](https://github.com/swatteau/sokoban-rs) — A Sokoban implementation
|
* [swatteau/sokoban-rs](https://github.com/swatteau/sokoban-rs) — A Sokoban implementation
|
||||||
|
* [Thinkofname/rust-quake](https://github.com/Thinkofname/rust-quake) — Quake map renderer in Rust
|
||||||
* [Veloren](https://gitlab.com/veloren/veloren) — An open world, open source multiplayer voxel RPG game currently in alpha development [![build badge](https://gitlab.com/veloren/veloren/badges/master/pipeline.svg)](https://gitlab.com/veloren/veloren/-/pipelines)
|
* [Veloren](https://gitlab.com/veloren/veloren) — An open world, open source multiplayer voxel RPG game currently in alpha development [![build badge](https://gitlab.com/veloren/veloren/badges/master/pipeline.svg)](https://gitlab.com/veloren/veloren/-/pipelines)
|
||||||
* [Zone of Control](https://github.com/ozkriff/zoc) — A turn-based hexagonal strategy game [![build badge](https://api.travis-ci.org/ozkriff/zoc.svg?branch=master)](https://travis-ci.org/ozkriff/zoc)
|
* [Zone of Control](https://github.com/ozkriff/zoc) — A turn-based hexagonal strategy game [![build badge](https://api.travis-ci.org/ozkriff/zoc.svg?branch=master)](https://travis-ci.org/ozkriff/zoc)
|
||||||
|
|
||||||
|
36
src/main.rs
36
src/main.rs
@ -20,6 +20,17 @@ use diffy::create_patch;
|
|||||||
const MINIMUM_GITHUB_STARS: u32 = 50;
|
const MINIMUM_GITHUB_STARS: u32 = 50;
|
||||||
const MINIMUM_CARGO_DOWNLOADS: u32 = 2000;
|
const MINIMUM_CARGO_DOWNLOADS: u32 = 2000;
|
||||||
|
|
||||||
|
// Allow overriding the needed stars for a section. "level" is the header level in the markdown, default is MINIMUM_GITHUB_STARS
|
||||||
|
fn override_stars(level: u32, text: &str) -> Option<u32> {
|
||||||
|
if level == 2 && text.contains("Resources") {
|
||||||
|
Some(0)
|
||||||
|
} else if level == 3 && text.contains("Games") {
|
||||||
|
Some(40)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
// Overrides for popularity count, each needs a good reason (i.e. downloads/stars we don't support automatic counting of)
|
// Overrides for popularity count, each needs a good reason (i.e. downloads/stars we don't support automatic counting of)
|
||||||
// Each is a URL that's "enough" for an item to pass the popularity checks
|
// Each is a URL that's "enough" for an item to pass the popularity checks
|
||||||
@ -408,12 +419,15 @@ async fn main() -> Result<(), Error> {
|
|||||||
let mut list_items: Vec<ListInfo> = Vec::new();
|
let mut list_items: Vec<ListInfo> = Vec::new();
|
||||||
let mut in_list_item = false;
|
let mut in_list_item = false;
|
||||||
let mut list_item: String = String::new();
|
let mut list_item: String = String::new();
|
||||||
let mut in_resources = false;
|
|
||||||
|
|
||||||
let mut link_count: u8 = 0;
|
let mut link_count: u8 = 0;
|
||||||
let mut github_stars: u32 = 0;
|
let mut github_stars: u32 = 0;
|
||||||
let mut cargo_downloads: u32 = 0;
|
let mut cargo_downloads: u32 = 0;
|
||||||
|
|
||||||
|
let mut required_stars: u32 = MINIMUM_GITHUB_STARS;
|
||||||
|
let mut last_level: u32 = 0;
|
||||||
|
let mut star_override_level: Option<u32> = None;
|
||||||
|
|
||||||
for (event, range) in parser.into_offset_iter() {
|
for (event, range) in parser.into_offset_iter() {
|
||||||
match event {
|
match event {
|
||||||
Event::Start(tag) => {
|
Event::Start(tag) => {
|
||||||
@ -474,9 +488,12 @@ async fn main() -> Result<(), Error> {
|
|||||||
cargo_downloads = 0;
|
cargo_downloads = 0;
|
||||||
}
|
}
|
||||||
Tag::Heading(level) => {
|
Tag::Heading(level) => {
|
||||||
if level == 2 && in_resources {
|
last_level = level;
|
||||||
// Got to the next item
|
if let Some(override_level) = star_override_level {
|
||||||
in_resources = false;
|
if level == override_level {
|
||||||
|
star_override_level = None;
|
||||||
|
required_stars = MINIMUM_GITHUB_STARS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Tag::Paragraph => {}
|
Tag::Paragraph => {}
|
||||||
@ -488,9 +505,12 @@ async fn main() -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Text(text) => {
|
Event::Text(text) => {
|
||||||
if text.contains("Resources") {
|
let possible_override = override_stars(last_level, &text);
|
||||||
in_resources = true;
|
if let Some(override_value) = possible_override {
|
||||||
|
star_override_level = Some(last_level);
|
||||||
|
required_stars = override_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if in_list_item {
|
if in_list_item {
|
||||||
list_item.push_str(&text);
|
list_item.push_str(&text);
|
||||||
}
|
}
|
||||||
@ -498,9 +518,9 @@ async fn main() -> Result<(), Error> {
|
|||||||
Event::End(tag) => {
|
Event::End(tag) => {
|
||||||
match tag {
|
match tag {
|
||||||
Tag::Item => {
|
Tag::Item => {
|
||||||
if list_item.len() > 0 && !in_resources {
|
if list_item.len() > 0 {
|
||||||
if link_count > 0 {
|
if link_count > 0 {
|
||||||
if github_stars < MINIMUM_GITHUB_STARS && cargo_downloads < MINIMUM_CARGO_DOWNLOADS {
|
if github_stars < required_stars && cargo_downloads < MINIMUM_CARGO_DOWNLOADS {
|
||||||
return Err(format_err!("Not good enough ({} stars < {}, and {} cargo downloads < {}): {}", github_stars, MINIMUM_GITHUB_STARS, cargo_downloads, MINIMUM_CARGO_DOWNLOADS, list_item));
|
return Err(format_err!("Not good enough ({} stars < {}, and {} cargo downloads < {}): {}", github_stars, MINIMUM_GITHUB_STARS, cargo_downloads, MINIMUM_CARGO_DOWNLOADS, list_item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user