Skip to content

Commit

Permalink
Merge pull request #31 from winpax/docs-build
Browse files Browse the repository at this point in the history
fix: docs.rs builds
  • Loading branch information
jewlexx authored May 24, 2024
2 parents bc14055 + 3aca788 commit 640f44d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ features = [
"vendored-libgit2",
"vendored-native-tls",
"vendored-openssl",
"zlib-ng-compat",
]
rustdoc-args = ["--cfg", "--cfg", "docsrs", "reqwest_unstable"]
rustc-args = ["--cfg", "docsrs", "--cfg", "reqwest_unstable"]

[features]
beta = []
Expand Down
24 changes: 21 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
use std::error::Error;

use serde_json::json;

fn get_known_buckets() -> Result<String, Box<dyn Error>> {
const URL: &str = "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/buckets.json";
let body = if cfg!(docsrs) {
json!({
"main": "https://github.com/ScoopInstaller/Main",
"extras": "https://github.com/ScoopInstaller/Extras",
"versions": "https://github.com/ScoopInstaller/Versions",
"nirsoft": "https://github.com/ScoopInstaller/Nirsoft",
"sysinternals": "https://github.com/niheaven/scoop-sysinternals",
"php": "https://github.com/ScoopInstaller/PHP",
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts",
"nonportable": "https://github.com/ScoopInstaller/Nonportable",
"java": "https://github.com/ScoopInstaller/Java",
"games": "https://github.com/Calinou/scoop-games"
})
} else {
let response = reqwest::blocking::get(
"https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/buckets.json",
)?;
response.json()?
};

let response = reqwest::blocking::get(URL)?;
let body: serde_json::Value = response.json()?;
let buckets = body.as_object().unwrap();

let mut output = String::new();
Expand Down

0 comments on commit 640f44d

Please sign in to comment.